OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef StyleInterpolation_h | 5 #ifndef StyleInterpolation_h |
6 #define StyleInterpolation_h | 6 #define StyleInterpolation_h |
7 | 7 |
8 #include "core/CSSPropertyNames.h" | 8 #include "core/CSSPropertyNames.h" |
9 #include "core/CoreExport.h" | 9 #include "core/CoreExport.h" |
10 #include "core/animation/Interpolation.h" | 10 #include "core/animation/Interpolation.h" |
11 #include "core/animation/PropertyHandle.h" | 11 #include "core/animation/PropertyHandle.h" |
12 #include <memory> | 12 #include <memory> |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 class StyleResolverState; | 16 class StyleResolverState; |
17 | 17 |
18 class CORE_EXPORT StyleInterpolation : public Interpolation { | 18 class CORE_EXPORT StyleInterpolation : public Interpolation { |
19 public: | 19 public: |
20 // 1) convert m_cachedValue into an X | 20 // 1) convert m_cachedValue into an X |
21 // 2) shove X into StyleResolverState | 21 // 2) shove X into StyleResolverState |
22 // X can be: | 22 // X can be: |
23 // (1) a CSSValue (and applied via StyleBuilder::applyProperty) | 23 // (1) a CSSValue (and applied via StyleBuilder::applyProperty) |
24 // (2) an AnimatableValue (and applied via // AnimatedStyleBuilder::applyPrope
rty) | 24 // (2) an AnimatableValue (and applied via |
| 25 // AnimatedStyleBuilder::applyProperty) |
25 // (3) a custom value that is inserted directly into the StyleResolverState. | 26 // (3) a custom value that is inserted directly into the StyleResolverState. |
26 virtual void apply(StyleResolverState&) const = 0; | 27 virtual void apply(StyleResolverState&) const = 0; |
27 | 28 |
28 bool isStyleInterpolation() const final { return true; } | 29 bool isStyleInterpolation() const final { return true; } |
29 | 30 |
30 CSSPropertyID id() const { return m_id; } | 31 CSSPropertyID id() const { return m_id; } |
31 | 32 |
32 PropertyHandle getProperty() const final { return PropertyHandle(id()); } | 33 PropertyHandle getProperty() const final { return PropertyHandle(id()); } |
33 | 34 |
34 protected: | 35 protected: |
35 CSSPropertyID m_id; | 36 CSSPropertyID m_id; |
36 | 37 |
37 StyleInterpolation(std::unique_ptr<InterpolableValue> start, | 38 StyleInterpolation(std::unique_ptr<InterpolableValue> start, |
38 std::unique_ptr<InterpolableValue> end, | 39 std::unique_ptr<InterpolableValue> end, |
39 CSSPropertyID id) | 40 CSSPropertyID id) |
40 : Interpolation(std::move(start), std::move(end)), m_id(id) {} | 41 : Interpolation(std::move(start), std::move(end)), m_id(id) {} |
41 }; | 42 }; |
42 | 43 |
43 DEFINE_TYPE_CASTS(StyleInterpolation, | 44 DEFINE_TYPE_CASTS(StyleInterpolation, |
44 Interpolation, | 45 Interpolation, |
45 value, | 46 value, |
46 value->isStyleInterpolation(), | 47 value->isStyleInterpolation(), |
47 value.isStyleInterpolation()); | 48 value.isStyleInterpolation()); |
48 | 49 |
49 } // namespace blink | 50 } // namespace blink |
50 | 51 |
51 #endif | 52 #endif |
OLD | NEW |