| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef InvalidatableStyleInterpolation_h |
| 6 #define InvalidatableStyleInterpolation_h |
| 7 |
| 8 #include "core/animation/AnimationConversion.h" |
| 9 #include "core/animation/AnimationType.h" |
| 10 #include "core/animation/AnimationValue.h" |
| 11 #include "core/animation/StyleInterpolation.h" |
| 12 |
| 13 namespace blink { |
| 14 |
| 15 // TODO(alancutter): This class will replace *StyleInterpolation, SVGInterpolati
on, Interpolation. |
| 16 // For now it needs to distinguish itself during the refactor and temporarily ha
s an ugly name. |
| 17 // TODO(alancutter): Make this class generic for any animation environment so it
can be reused for SVG animations. |
| 18 class CORE_EXPORT InvalidatableStyleInterpolation : public StyleInterpolation { |
| 19 public: |
| 20 static PassRefPtrWillBeRawPtr<InvalidatableStyleInterpolation> create( |
| 21 const Vector<const AnimationType*>& animationTypes, |
| 22 PassRefPtrWillBeRawPtr<CSSPropertySpecificKeyframe> startKeyframe, |
| 23 PassRefPtrWillBeRawPtr<CSSPropertySpecificKeyframe> endKeyframe) |
| 24 { |
| 25 return adoptRefWillBeNoop(new InvalidatableStyleInterpolation(animationT
ypes, startKeyframe, endKeyframe)); |
| 26 } |
| 27 |
| 28 virtual void interpolate(int iteration, double fraction); |
| 29 void validateCache(const StyleResolverState&) const; |
| 30 virtual void apply(StyleResolverState&) const; |
| 31 |
| 32 virtual bool isInvalidatableStyleInterpolation() const { return true; } |
| 33 |
| 34 DEFINE_INLINE_VIRTUAL_TRACE() |
| 35 { |
| 36 StyleInterpolation::trace(visitor); |
| 37 visitor->trace(m_startKeyframe); |
| 38 visitor->trace(m_endKeyframe); |
| 39 visitor->trace(m_cachedConversion); |
| 40 visitor->trace(m_cachedValue); |
| 41 } |
| 42 |
| 43 private: |
| 44 InvalidatableStyleInterpolation( |
| 45 const Vector<const AnimationType*>& animationTypes, |
| 46 PassRefPtrWillBeRawPtr<CSSPropertySpecificKeyframe> startKeyframe, |
| 47 PassRefPtrWillBeRawPtr<CSSPropertySpecificKeyframe> endKeyframe); |
| 48 |
| 49 bool maybeCachePairwiseConversion(const StyleResolverState*) const; |
| 50 |
| 51 const Vector<const AnimationType*>& m_animationTypes; |
| 52 const RefPtrWillBeMember<CSSPropertySpecificKeyframe> m_startKeyframe; |
| 53 const RefPtrWillBeMember<CSSPropertySpecificKeyframe> m_endKeyframe; |
| 54 double m_currentFraction; |
| 55 mutable OwnPtrWillBeMember<AnimationConversion> m_cachedConversion; |
| 56 mutable AnimationValue m_cachedValue; |
| 57 }; |
| 58 |
| 59 DEFINE_TYPE_CASTS(InvalidatableStyleInterpolation, Interpolation, value, value->
isInvalidatableStyleInterpolation(), value.isInvalidatableStyleInterpolation()); |
| 60 |
| 61 } // namespace blink |
| 62 |
| 63 #endif // InvalidatableStyleInterpolation_h |
| OLD | NEW |