Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(798)

Side by Side Diff: third_party/WebKit/Source/core/animation/CSSTransformInterpolationType.cpp

Issue 2812213002: Add CSSInterpolationType specific ConversionChecker (Closed)
Patch Set: rebased Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/animation/CSSTransformInterpolationType.h" 5 #include "core/animation/CSSTransformInterpolationType.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include "core/animation/LengthUnitsChecker.h" 8 #include "core/animation/LengthUnitsChecker.h"
9 #include "core/css/CSSFunctionValue.h" 9 #include "core/css/CSSFunctionValue.h"
10 #include "core/css/CSSPrimitiveValue.h" 10 #include "core/css/CSSPrimitiveValue.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 InterpolationValue ConvertTransform(TransformOperations&& transform) { 122 InterpolationValue ConvertTransform(TransformOperations&& transform) {
123 return InterpolationValue( 123 return InterpolationValue(
124 InterpolableNumber::Create(0), 124 InterpolableNumber::Create(0),
125 CSSTransformNonInterpolableValue::Create(std::move(transform))); 125 CSSTransformNonInterpolableValue::Create(std::move(transform)));
126 } 126 }
127 127
128 InterpolationValue ConvertTransform(const TransformOperations& transform) { 128 InterpolationValue ConvertTransform(const TransformOperations& transform) {
129 return ConvertTransform(TransformOperations(transform)); 129 return ConvertTransform(TransformOperations(transform));
130 } 130 }
131 131
132 class InheritedTransformChecker : public InterpolationType::ConversionChecker { 132 class InheritedTransformChecker
133 : public CSSInterpolationType::CSSConversionChecker {
133 public: 134 public:
134 static std::unique_ptr<InheritedTransformChecker> Create( 135 static std::unique_ptr<InheritedTransformChecker> Create(
135 const TransformOperations& inherited_transform) { 136 const TransformOperations& inherited_transform) {
136 return WTF::WrapUnique(new InheritedTransformChecker(inherited_transform)); 137 return WTF::WrapUnique(new InheritedTransformChecker(inherited_transform));
137 } 138 }
138 139
139 bool IsValid(const InterpolationEnvironment& environment, 140 bool IsValid(const StyleResolverState& state,
140 const InterpolationValue& underlying) const final { 141 const InterpolationValue& underlying) const final {
141 return inherited_transform_ == 142 return inherited_transform_ == state.ParentStyle()->Transform();
142 environment.GetState().ParentStyle()->Transform();
143 } 143 }
144 144
145 private: 145 private:
146 InheritedTransformChecker(const TransformOperations& inherited_transform) 146 InheritedTransformChecker(const TransformOperations& inherited_transform)
147 : inherited_transform_(inherited_transform) {} 147 : inherited_transform_(inherited_transform) {}
148 148
149 const TransformOperations inherited_transform_; 149 const TransformOperations inherited_transform_;
150 }; 150 };
151 151
152 } // namespace 152 } // namespace
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 const NonInterpolableValue* untyped_non_interpolable_value, 258 const NonInterpolableValue* untyped_non_interpolable_value,
259 StyleResolverState& state) const { 259 StyleResolverState& state) const {
260 double progress = ToInterpolableNumber(interpolable_value).Value(); 260 double progress = ToInterpolableNumber(interpolable_value).Value();
261 const CSSTransformNonInterpolableValue& non_interpolable_value = 261 const CSSTransformNonInterpolableValue& non_interpolable_value =
262 ToCSSTransformNonInterpolableValue(*untyped_non_interpolable_value); 262 ToCSSTransformNonInterpolableValue(*untyped_non_interpolable_value);
263 state.Style()->SetTransform( 263 state.Style()->SetTransform(
264 non_interpolable_value.GetInterpolatedTransform(progress)); 264 non_interpolable_value.GetInterpolatedTransform(progress));
265 } 265 }
266 266
267 } // namespace blink 267 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698