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 Interpolation_h | 5 #ifndef Interpolation_h |
6 #define Interpolation_h | 6 #define Interpolation_h |
7 | 7 |
8 #include "CSSPropertyNames.h" | 8 #include "CSSPropertyNames.h" |
9 #include "core/animation/InterpolableValue.h" | 9 #include "core/animation/InterpolableValue.h" |
10 #include "heap/Handle.h" | 10 #include "heap/Handle.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 mutable int m_cachedIteration; | 37 mutable int m_cachedIteration; |
38 mutable OwnPtrWillBeMember<InterpolableValue> m_cachedValue; | 38 mutable OwnPtrWillBeMember<InterpolableValue> m_cachedValue; |
39 | 39 |
40 Interpolation(PassOwnPtrWillBeRawPtr<InterpolableValue> start, PassOwnPtrWil
lBeRawPtr<InterpolableValue> end); | 40 Interpolation(PassOwnPtrWillBeRawPtr<InterpolableValue> start, PassOwnPtrWil
lBeRawPtr<InterpolableValue> end); |
41 | 41 |
42 private: | 42 private: |
43 InterpolableValue* getCachedValueForTesting() const { return m_cachedValue.g
et(); } | 43 InterpolableValue* getCachedValueForTesting() const { return m_cachedValue.g
et(); } |
44 | 44 |
45 friend class AnimationInterpolableValueTest; | 45 friend class AnimationInterpolableValueTest; |
46 friend class AnimationInterpolationEffectTest; | 46 friend class AnimationInterpolationEffectTest; |
| 47 |
47 }; | 48 }; |
48 | 49 |
49 class StyleInterpolation : public Interpolation { | 50 class StyleInterpolation : public Interpolation { |
50 public: | 51 public: |
51 // 1) convert m_cachedValue into an X | 52 // 1) convert m_cachedValue into an X |
52 // 2) shove X into StyleResolverState | 53 // 2) shove X into StyleResolverState |
53 // X can be: | 54 // X can be: |
54 // (1) a CSSValue (and applied via StyleBuilder::applyProperty) | 55 // (1) a CSSValue (and applied via StyleBuilder::applyProperty) |
55 // (2) an AnimatableValue (and applied via // AnimatedStyleBuilder::applyPro
perty) | 56 // (2) an AnimatableValue (and applied via // AnimatedStyleBuilder::applyPro
perty) |
56 // (3) a custom value that is inserted directly into the StyleResolverState. | 57 // (3) a custom value that is inserted directly into the StyleResolverState. |
(...skipping 18 matching lines...) Expand all Loading... |
75 class LegacyStyleInterpolation : public StyleInterpolation { | 76 class LegacyStyleInterpolation : public StyleInterpolation { |
76 public: | 77 public: |
77 static PassRefPtrWillBeRawPtr<LegacyStyleInterpolation> create(PassRefPtrWil
lBeRawPtr<AnimatableValue> start, PassRefPtrWillBeRawPtr<AnimatableValue> end, C
SSPropertyID id) | 78 static PassRefPtrWillBeRawPtr<LegacyStyleInterpolation> create(PassRefPtrWil
lBeRawPtr<AnimatableValue> start, PassRefPtrWillBeRawPtr<AnimatableValue> end, C
SSPropertyID id) |
78 { | 79 { |
79 return adoptRefWillBeNoop(new LegacyStyleInterpolation(InterpolableAnima
tableValue::create(start), InterpolableAnimatableValue::create(end), id)); | 80 return adoptRefWillBeNoop(new LegacyStyleInterpolation(InterpolableAnima
tableValue::create(start), InterpolableAnimatableValue::create(end), id)); |
80 } | 81 } |
81 | 82 |
82 virtual void apply(StyleResolverState&) const; | 83 virtual void apply(StyleResolverState&) const; |
83 | 84 |
84 virtual bool isLegacyStyleInterpolation() const OVERRIDE FINAL { return true
; } | 85 virtual bool isLegacyStyleInterpolation() const OVERRIDE FINAL { return true
; } |
85 PassRefPtr<AnimatableValue> currentValue() const | 86 AnimatableValue* currentValue() const |
86 { | 87 { |
87 InterpolableAnimatableValue* value = static_cast<InterpolableAnimatableV
alue*>(m_cachedValue.get()); | 88 InterpolableAnimatableValue* value = static_cast<InterpolableAnimatableV
alue*>(m_cachedValue.get()); |
88 return value->value(); | 89 return value->value(); |
89 } | 90 } |
90 | 91 |
91 virtual void trace(Visitor*) OVERRIDE; | 92 virtual void trace(Visitor*) OVERRIDE; |
92 | 93 |
93 private: | 94 private: |
94 LegacyStyleInterpolation(PassOwnPtrWillBeRawPtr<InterpolableValue> start, Pa
ssOwnPtrWillBeRawPtr<InterpolableValue> end, CSSPropertyID id) | 95 LegacyStyleInterpolation(PassOwnPtrWillBeRawPtr<InterpolableValue> start, Pa
ssOwnPtrWillBeRawPtr<InterpolableValue> end, CSSPropertyID id) |
95 : StyleInterpolation(start, end, id) | 96 : StyleInterpolation(start, end, id) |
96 { | 97 { |
97 } | 98 } |
98 }; | 99 }; |
99 | 100 |
100 DEFINE_TYPE_CASTS(StyleInterpolation, Interpolation, value, value->isStyleInterp
olation(), value.isStyleInterpolation()); | 101 DEFINE_TYPE_CASTS(StyleInterpolation, Interpolation, value, value->isStyleInterp
olation(), value.isStyleInterpolation()); |
101 DEFINE_TYPE_CASTS(LegacyStyleInterpolation, Interpolation, value, value->isLegac
yStyleInterpolation(), value.isLegacyStyleInterpolation()); | 102 DEFINE_TYPE_CASTS(LegacyStyleInterpolation, Interpolation, value, value->isLegac
yStyleInterpolation(), value.isLegacyStyleInterpolation()); |
102 | 103 |
103 } | 104 } |
104 #endif | 105 #endif |
OLD | NEW |