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 27 matching lines...) Expand all Loading... |
38 mutable int m_cachedIteration; | 38 mutable int m_cachedIteration; |
39 mutable OwnPtr<InterpolableValue> m_cachedValue; | 39 mutable OwnPtr<InterpolableValue> m_cachedValue; |
40 | 40 |
41 Interpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<InterpolableVa
lue> end); | 41 Interpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<InterpolableVa
lue> end); |
42 | 42 |
43 private: | 43 private: |
44 InterpolableValue* getCachedValueForTesting() const { return m_cachedValue.g
et(); } | 44 InterpolableValue* getCachedValueForTesting() const { return m_cachedValue.g
et(); } |
45 | 45 |
46 friend class AnimationInterpolableValueTest; | 46 friend class AnimationInterpolableValueTest; |
47 friend class AnimationInterpolationEffectTest; | 47 friend class AnimationInterpolationEffectTest; |
48 | |
49 }; | 48 }; |
50 | 49 |
51 class StyleInterpolation : public Interpolation { | 50 class StyleInterpolation : public Interpolation { |
52 public: | 51 public: |
53 // 1) convert m_cachedValue into an X | 52 // 1) convert m_cachedValue into an X |
54 // 2) shove X into StyleResolverState | 53 // 2) shove X into StyleResolverState |
55 // X can be: | 54 // X can be: |
56 // (1) a CSSValue (and applied via StyleBuilder::applyProperty) | 55 // (1) a CSSValue (and applied via StyleBuilder::applyProperty) |
57 // (2) an AnimatableValue (and applied via // AnimatedStyleBuilder::applyPro
perty) | 56 // (2) an AnimatableValue (and applied via // AnimatedStyleBuilder::applyPro
perty) |
58 // (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... |
77 class LegacyStyleInterpolation : public StyleInterpolation { | 76 class LegacyStyleInterpolation : public StyleInterpolation { |
78 public: | 77 public: |
79 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) |
80 { | 79 { |
81 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)); |
82 } | 81 } |
83 | 82 |
84 virtual void apply(StyleResolverState&) const; | 83 virtual void apply(StyleResolverState&) const; |
85 | 84 |
86 virtual bool isLegacyStyleInterpolation() const OVERRIDE FINAL { return true
; } | 85 virtual bool isLegacyStyleInterpolation() const OVERRIDE FINAL { return true
; } |
87 AnimatableValue* currentValue() const | 86 PassRefPtr<AnimatableValue> currentValue() const |
88 { | 87 { |
89 InterpolableAnimatableValue* value = static_cast<InterpolableAnimatableV
alue*>(m_cachedValue.get()); | 88 InterpolableAnimatableValue* value = static_cast<InterpolableAnimatableV
alue*>(m_cachedValue.get()); |
90 return value->value(); | 89 return value->value(); |
91 } | 90 } |
92 | 91 |
93 virtual void trace(Visitor*) OVERRIDE; | 92 virtual void trace(Visitor*) OVERRIDE; |
94 | 93 |
95 private: | 94 private: |
96 LegacyStyleInterpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<Int
erpolableValue> end, CSSPropertyID id) | 95 LegacyStyleInterpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<Int
erpolableValue> end, CSSPropertyID id) |
97 : StyleInterpolation(start, end, id) | 96 : StyleInterpolation(start, end, id) |
98 { | 97 { |
99 } | 98 } |
100 }; | 99 }; |
101 | 100 |
102 DEFINE_TYPE_CASTS(StyleInterpolation, Interpolation, value, value->isStyleInterp
olation(), value.isStyleInterpolation()); | 101 DEFINE_TYPE_CASTS(StyleInterpolation, Interpolation, value, value->isStyleInterp
olation(), value.isStyleInterpolation()); |
103 DEFINE_TYPE_CASTS(LegacyStyleInterpolation, Interpolation, value, value->isLegac
yStyleInterpolation(), value.isLegacyStyleInterpolation()); | 102 DEFINE_TYPE_CASTS(LegacyStyleInterpolation, Interpolation, value, value->isLegac
yStyleInterpolation(), value.isLegacyStyleInterpolation()); |
104 | 103 |
105 } | 104 } |
106 #endif | 105 #endif |
OLD | NEW |