| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 InvalidatableStyleInterpolation_h | 5 #ifndef InvalidatableStyleInterpolation_h |
| 6 #define InvalidatableStyleInterpolation_h | 6 #define InvalidatableStyleInterpolation_h |
| 7 | 7 |
| 8 #include "core/animation/InterpolationType.h" | 8 #include "core/animation/InterpolationType.h" |
| 9 #include "core/animation/InterpolationValue.h" | 9 #include "core/animation/InterpolationValue.h" |
| 10 #include "core/animation/PrimitiveInterpolation.h" | 10 #include "core/animation/PrimitiveInterpolation.h" |
| 11 #include "core/animation/StyleInterpolation.h" | 11 #include "core/animation/StyleInterpolation.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 // TODO(alancutter): This class will replace *StyleInterpolation, SVGInterpolati
on, Interpolation. | 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. | 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. | 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 { | 18 class CORE_EXPORT InvalidatableStyleInterpolation : public StyleInterpolation { |
| 19 public: | 19 public: |
| 20 static PassRefPtr<InvalidatableStyleInterpolation> create( | 20 static PassRefPtr<InvalidatableStyleInterpolation> create( |
| 21 const Vector<const InterpolationType*>& InterpolationTypes, | 21 const Vector<const InterpolationType*>& InterpolationTypes, |
| 22 const CSSPropertySpecificKeyframe& startKeyframe, | 22 const CSSPropertySpecificKeyframe& startKeyframe, |
| 23 const CSSPropertySpecificKeyframe& endKeyframe) | 23 const CSSPropertySpecificKeyframe& endKeyframe) |
| 24 { | 24 { |
| 25 return adoptRef(new InvalidatableStyleInterpolation(InterpolationTypes,
startKeyframe, endKeyframe)); | 25 return adoptRef(new InvalidatableStyleInterpolation(InterpolationTypes,
startKeyframe, endKeyframe)); |
| 26 } | 26 } |
| 27 | 27 |
| 28 virtual void interpolate(int iteration, double fraction); | 28 virtual void interpolate(int iteration, double fraction); |
| 29 virtual void apply(StyleResolverState&) const; | 29 bool dependsOnUnderlyingValue() const; |
| 30 virtual void apply(StyleResolverState&) const { ASSERT_NOT_REACHED(); } |
| 31 static void applyStack(const ActiveInterpolations&, StyleResolverState&); |
| 30 | 32 |
| 31 virtual bool isInvalidatableStyleInterpolation() const { return true; } | 33 virtual bool isInvalidatableStyleInterpolation() const { return true; } |
| 32 | 34 |
| 33 private: | 35 private: |
| 34 InvalidatableStyleInterpolation( | 36 InvalidatableStyleInterpolation( |
| 35 const Vector<const InterpolationType*>& InterpolationTypes, | 37 const Vector<const InterpolationType*>& InterpolationTypes, |
| 36 const CSSPropertySpecificKeyframe& startKeyframe, | 38 const CSSPropertySpecificKeyframe& startKeyframe, |
| 37 const CSSPropertySpecificKeyframe& endKeyframe); | 39 const CSSPropertySpecificKeyframe& endKeyframe); |
| 38 | 40 |
| 39 PassOwnPtr<InterpolationValue> maybeConvertUnderlyingValue(const StyleResolv
erState&) const; | 41 PassOwnPtr<InterpolationValue> maybeConvertUnderlyingValue(const StyleResolv
erState&) const; |
| 40 void ensureValidInterpolation(const StyleResolverState&, const Interpolation
Value* underlyingValue) const; | 42 const InterpolationValue* ensureValidInterpolation(const StyleResolverState&
, const InterpolationValue* underlyingValue) const; |
| 41 bool dependsOnUnderlyingValue() const; | |
| 42 bool isCacheValid(const StyleResolverState&, const InterpolationValue* under
lyingValue) const; | 43 bool isCacheValid(const StyleResolverState&, const InterpolationValue* under
lyingValue) const; |
| 43 bool isNeutralKeyframeActive() const; | 44 bool isNeutralKeyframeActive() const; |
| 44 bool maybeCachePairwiseConversion(const StyleResolverState*, const Interpola
tionValue* underlyingValue) const; | 45 bool maybeCachePairwiseConversion(const StyleResolverState*, const Interpola
tionValue* underlyingValue) const; |
| 45 PassOwnPtr<InterpolationValue> convertSingleKeyframe(const CSSPropertySpecif
icKeyframe&, const StyleResolverState&, const InterpolationValue* underlyingValu
e) const; | 46 PassOwnPtr<InterpolationValue> convertSingleKeyframe(const CSSPropertySpecif
icKeyframe&, const StyleResolverState&, const InterpolationValue* underlyingValu
e) const; |
| 46 void setFlagIfInheritUsed(StyleResolverState&) const; | 47 void setFlagIfInheritUsed(StyleResolverState&) const; |
| 47 | 48 |
| 48 const Vector<const InterpolationType*>& m_interpolationTypes; | 49 const Vector<const InterpolationType*>& m_interpolationTypes; |
| 49 const CSSPropertySpecificKeyframe* m_startKeyframe; | 50 const CSSPropertySpecificKeyframe* m_startKeyframe; |
| 50 const CSSPropertySpecificKeyframe* m_endKeyframe; | 51 const CSSPropertySpecificKeyframe* m_endKeyframe; |
| 51 double m_currentFraction; | 52 double m_currentFraction; |
| 52 mutable OwnPtr<PrimitiveInterpolation> m_cachedConversion; | 53 mutable OwnPtr<PrimitiveInterpolation> m_cachedConversion; |
| 53 mutable InterpolationType::ConversionCheckers m_conversionCheckers; | 54 mutable InterpolationType::ConversionCheckers m_conversionCheckers; |
| 54 mutable OwnPtr<InterpolationValue> m_cachedValue; | 55 mutable OwnPtr<InterpolationValue> m_cachedValue; |
| 55 }; | 56 }; |
| 56 | 57 |
| 57 DEFINE_TYPE_CASTS(InvalidatableStyleInterpolation, Interpolation, value, value->
isInvalidatableStyleInterpolation(), value.isInvalidatableStyleInterpolation()); | 58 DEFINE_TYPE_CASTS(InvalidatableStyleInterpolation, Interpolation, value, value->
isInvalidatableStyleInterpolation(), value.isInvalidatableStyleInterpolation()); |
| 58 | 59 |
| 59 } // namespace blink | 60 } // namespace blink |
| 60 | 61 |
| 61 #endif // InvalidatableStyleInterpolation_h | 62 #endif // InvalidatableStyleInterpolation_h |
| OLD | NEW |