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

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

Issue 2812213002: Add CSSInterpolationType specific ConversionChecker (Closed)
Patch Set: rebased Created 3 years, 7 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/CSSScaleInterpolationType.h" 5 #include "core/animation/CSSScaleInterpolationType.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include "core/css/CSSPrimitiveValue.h" 8 #include "core/css/CSSPrimitiveValue.h"
9 #include "core/css/CSSValueList.h" 9 #include "core/css/CSSValueList.h"
10 #include "core/css/resolver/StyleResolverState.h" 10 #include "core/css/resolver/StyleResolverState.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 bool is_none; 55 bool is_none;
56 }; 56 };
57 57
58 std::unique_ptr<InterpolableValue> CreateScaleIdentity() { 58 std::unique_ptr<InterpolableValue> CreateScaleIdentity() {
59 std::unique_ptr<InterpolableList> list = InterpolableList::Create(3); 59 std::unique_ptr<InterpolableList> list = InterpolableList::Create(3);
60 for (size_t i = 0; i < 3; i++) 60 for (size_t i = 0; i < 3; i++)
61 list->Set(i, InterpolableNumber::Create(1)); 61 list->Set(i, InterpolableNumber::Create(1));
62 return std::move(list); 62 return std::move(list);
63 } 63 }
64 64
65 class InheritedScaleChecker : public InterpolationType::ConversionChecker { 65 class InheritedScaleChecker
66 : public CSSInterpolationType::CSSConversionChecker {
66 public: 67 public:
67 static std::unique_ptr<InheritedScaleChecker> Create(const Scale& scale) { 68 static std::unique_ptr<InheritedScaleChecker> Create(const Scale& scale) {
68 return WTF::WrapUnique(new InheritedScaleChecker(scale)); 69 return WTF::WrapUnique(new InheritedScaleChecker(scale));
69 } 70 }
70 71
71 private: 72 private:
72 InheritedScaleChecker(const Scale& scale) : scale_(scale) {} 73 InheritedScaleChecker(const Scale& scale) : scale_(scale) {}
73 74
74 bool IsValid(const InterpolationEnvironment& environment, 75 bool IsValid(const StyleResolverState& state,
75 const InterpolationValue&) const final { 76 const InterpolationValue&) const final {
76 return scale_ == Scale(environment.GetState().ParentStyle()->Scale()); 77 return scale_ == Scale(state.ParentStyle()->Scale());
77 } 78 }
78 79
79 const Scale scale_; 80 const Scale scale_;
80 }; 81 };
81 82
82 } // namespace 83 } // namespace
83 84
84 class CSSScaleNonInterpolableValue : public NonInterpolableValue { 85 class CSSScaleNonInterpolableValue : public NonInterpolableValue {
85 public: 86 public:
86 ~CSSScaleNonInterpolableValue() final {} 87 ~CSSScaleNonInterpolableValue() final {}
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 if (scale.is_none) { 249 if (scale.is_none) {
249 state.Style()->SetScale(nullptr); 250 state.Style()->SetScale(nullptr);
250 return; 251 return;
251 } 252 }
252 state.Style()->SetScale(ScaleTransformOperation::Create( 253 state.Style()->SetScale(ScaleTransformOperation::Create(
253 scale.array[0], scale.array[1], scale.array[2], 254 scale.array[0], scale.array[1], scale.array[2],
254 TransformOperation::kScale3D)); 255 TransformOperation::kScale3D));
255 } 256 }
256 257
257 } // namespace blink 258 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698