OLD | NEW |
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/CSSBasicShapeInterpolationType.h" | 5 #include "core/animation/CSSBasicShapeInterpolationType.h" |
6 | 6 |
7 #include "core/animation/BasicShapeInterpolationFunctions.h" | 7 #include "core/animation/BasicShapeInterpolationFunctions.h" |
8 #include "core/animation/BasicShapePropertyFunctions.h" | 8 #include "core/animation/BasicShapePropertyFunctions.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 11 matching lines...) Expand all Loading... |
22 public: | 22 public: |
23 static std::unique_ptr<UnderlyingCompatibilityChecker> create( | 23 static std::unique_ptr<UnderlyingCompatibilityChecker> create( |
24 PassRefPtr<NonInterpolableValue> underlyingNonInterpolableValue) { | 24 PassRefPtr<NonInterpolableValue> underlyingNonInterpolableValue) { |
25 return WTF::wrapUnique(new UnderlyingCompatibilityChecker( | 25 return WTF::wrapUnique(new UnderlyingCompatibilityChecker( |
26 std::move(underlyingNonInterpolableValue))); | 26 std::move(underlyingNonInterpolableValue))); |
27 } | 27 } |
28 | 28 |
29 private: | 29 private: |
30 UnderlyingCompatibilityChecker( | 30 UnderlyingCompatibilityChecker( |
31 PassRefPtr<NonInterpolableValue> underlyingNonInterpolableValue) | 31 PassRefPtr<NonInterpolableValue> underlyingNonInterpolableValue) |
32 : m_underlyingNonInterpolableValue(underlyingNonInterpolableValue) {} | 32 : m_underlyingNonInterpolableValue( |
| 33 std::move(underlyingNonInterpolableValue)) {} |
33 | 34 |
34 bool isValid(const InterpolationEnvironment&, | 35 bool isValid(const InterpolationEnvironment&, |
35 const InterpolationValue& underlying) const final { | 36 const InterpolationValue& underlying) const final { |
36 return BasicShapeInterpolationFunctions::shapesAreCompatible( | 37 return BasicShapeInterpolationFunctions::shapesAreCompatible( |
37 *m_underlyingNonInterpolableValue, *underlying.nonInterpolableValue); | 38 *m_underlyingNonInterpolableValue, *underlying.nonInterpolableValue); |
38 } | 39 } |
39 | 40 |
40 RefPtr<NonInterpolableValue> m_underlyingNonInterpolableValue; | 41 RefPtr<NonInterpolableValue> m_underlyingNonInterpolableValue; |
41 }; | 42 }; |
42 | 43 |
43 class InheritedShapeChecker : public InterpolationType::ConversionChecker { | 44 class InheritedShapeChecker : public InterpolationType::ConversionChecker { |
44 public: | 45 public: |
45 static std::unique_ptr<InheritedShapeChecker> create( | 46 static std::unique_ptr<InheritedShapeChecker> create( |
46 CSSPropertyID property, | 47 CSSPropertyID property, |
47 PassRefPtr<BasicShape> inheritedShape) { | 48 PassRefPtr<BasicShape> inheritedShape) { |
48 return WTF::wrapUnique( | 49 return WTF::wrapUnique( |
49 new InheritedShapeChecker(property, std::move(inheritedShape))); | 50 new InheritedShapeChecker(property, std::move(inheritedShape))); |
50 } | 51 } |
51 | 52 |
52 private: | 53 private: |
53 InheritedShapeChecker(CSSPropertyID property, | 54 InheritedShapeChecker(CSSPropertyID property, |
54 PassRefPtr<BasicShape> inheritedShape) | 55 PassRefPtr<BasicShape> inheritedShape) |
55 : m_property(property), m_inheritedShape(inheritedShape) {} | 56 : m_property(property), m_inheritedShape(std::move(inheritedShape)) {} |
56 | 57 |
57 bool isValid(const InterpolationEnvironment& environment, | 58 bool isValid(const InterpolationEnvironment& environment, |
58 const InterpolationValue&) const final { | 59 const InterpolationValue&) const final { |
59 return dataEquivalent(m_inheritedShape.get(), | 60 return dataEquivalent(m_inheritedShape.get(), |
60 BasicShapePropertyFunctions::getBasicShape( | 61 BasicShapePropertyFunctions::getBasicShape( |
61 m_property, *environment.state().parentStyle())); | 62 m_property, *environment.state().parentStyle())); |
62 } | 63 } |
63 | 64 |
64 const CSSPropertyID m_property; | 65 const CSSPropertyID m_property; |
65 RefPtr<BasicShape> m_inheritedShape; | 66 RefPtr<BasicShape> m_inheritedShape; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 const NonInterpolableValue* nonInterpolableValue, | 154 const NonInterpolableValue* nonInterpolableValue, |
154 StyleResolverState& state) const { | 155 StyleResolverState& state) const { |
155 BasicShapePropertyFunctions::setBasicShape( | 156 BasicShapePropertyFunctions::setBasicShape( |
156 cssProperty(), *state.style(), | 157 cssProperty(), *state.style(), |
157 BasicShapeInterpolationFunctions::createBasicShape( | 158 BasicShapeInterpolationFunctions::createBasicShape( |
158 interpolableValue, *nonInterpolableValue, | 159 interpolableValue, *nonInterpolableValue, |
159 state.cssToLengthConversionData())); | 160 state.cssToLengthConversionData())); |
160 } | 161 } |
161 | 162 |
162 } // namespace blink | 163 } // namespace blink |
OLD | NEW |