| 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 | |
| 48 }; | 47 }; |
| 49 | 48 |
| 50 class StyleInterpolation : public Interpolation { | 49 class StyleInterpolation : public Interpolation { |
| 51 public: | 50 public: |
| 52 // 1) convert m_cachedValue into an X | 51 // 1) convert m_cachedValue into an X |
| 53 // 2) shove X into StyleResolverState | 52 // 2) shove X into StyleResolverState |
| 54 // X can be: | 53 // X can be: |
| 55 // (1) a CSSValue (and applied via StyleBuilder::applyProperty) | 54 // (1) a CSSValue (and applied via StyleBuilder::applyProperty) |
| 56 // (2) an AnimatableValue (and applied via // AnimatedStyleBuilder::applyPro
perty) | 55 // (2) an AnimatableValue (and applied via // AnimatedStyleBuilder::applyPro
perty) |
| 57 // (3) a custom value that is inserted directly into the StyleResolverState. | 56 // (3) a custom value that is inserted directly into the StyleResolverState. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 76 class LegacyStyleInterpolation : public StyleInterpolation { | 75 class LegacyStyleInterpolation : public StyleInterpolation { |
| 77 public: | 76 public: |
| 78 static PassRefPtrWillBeRawPtr<LegacyStyleInterpolation> create(PassRefPtrWil
lBeRawPtr<AnimatableValue> start, PassRefPtrWillBeRawPtr<AnimatableValue> end, C
SSPropertyID id) | 77 static PassRefPtrWillBeRawPtr<LegacyStyleInterpolation> create(PassRefPtrWil
lBeRawPtr<AnimatableValue> start, PassRefPtrWillBeRawPtr<AnimatableValue> end, C
SSPropertyID id) |
| 79 { | 78 { |
| 80 return adoptRefWillBeNoop(new LegacyStyleInterpolation(InterpolableAnima
tableValue::create(start), InterpolableAnimatableValue::create(end), id)); | 79 return adoptRefWillBeNoop(new LegacyStyleInterpolation(InterpolableAnima
tableValue::create(start), InterpolableAnimatableValue::create(end), id)); |
| 81 } | 80 } |
| 82 | 81 |
| 83 virtual void apply(StyleResolverState&) const; | 82 virtual void apply(StyleResolverState&) const; |
| 84 | 83 |
| 85 virtual bool isLegacyStyleInterpolation() const OVERRIDE FINAL { return true
; } | 84 virtual bool isLegacyStyleInterpolation() const OVERRIDE FINAL { return true
; } |
| 86 AnimatableValue* currentValue() const | 85 PassRefPtrWillBeRawPtr<AnimatableValue> currentValue() const |
| 87 { | 86 { |
| 88 InterpolableAnimatableValue* value = static_cast<InterpolableAnimatableV
alue*>(m_cachedValue.get()); | 87 InterpolableAnimatableValue* value = static_cast<InterpolableAnimatableV
alue*>(m_cachedValue.get()); |
| 89 return value->value(); | 88 return value->value(); |
| 90 } | 89 } |
| 91 | 90 |
| 92 virtual void trace(Visitor*) OVERRIDE; | 91 virtual void trace(Visitor*) OVERRIDE; |
| 93 | 92 |
| 94 private: | 93 private: |
| 95 LegacyStyleInterpolation(PassOwnPtrWillBeRawPtr<InterpolableValue> start, Pa
ssOwnPtrWillBeRawPtr<InterpolableValue> end, CSSPropertyID id) | 94 LegacyStyleInterpolation(PassOwnPtrWillBeRawPtr<InterpolableValue> start, Pa
ssOwnPtrWillBeRawPtr<InterpolableValue> end, CSSPropertyID id) |
| 96 : StyleInterpolation(start, end, id) | 95 : StyleInterpolation(start, end, id) |
| 97 { | 96 { |
| 98 } | 97 } |
| 99 }; | 98 }; |
| 100 | 99 |
| 101 DEFINE_TYPE_CASTS(StyleInterpolation, Interpolation, value, value->isStyleInterp
olation(), value.isStyleInterpolation()); | 100 DEFINE_TYPE_CASTS(StyleInterpolation, Interpolation, value, value->isStyleInterp
olation(), value.isStyleInterpolation()); |
| 102 DEFINE_TYPE_CASTS(LegacyStyleInterpolation, Interpolation, value, value->isLegac
yStyleInterpolation(), value.isLegacyStyleInterpolation()); | 101 DEFINE_TYPE_CASTS(LegacyStyleInterpolation, Interpolation, value, value->isLegac
yStyleInterpolation(), value.isLegacyStyleInterpolation()); |
| 103 | 102 |
| 104 } | 103 } |
| 105 #endif | 104 #endif |
| OLD | NEW |