| 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/InterpolationType.h" | |
| 9 #include "core/animation/InterpolationValue.h" | |
| 10 #include "core/animation/PrimitiveInterpolation.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 class CORE_EXPORT InvalidatableStyleInterpolation : public Interpolation { | |
| 18 public: | |
| 19 static PassRefPtr<InvalidatableStyleInterpolation> create( | |
| 20 const Vector<const InterpolationType*>& InterpolationTypes, | |
| 21 const PropertySpecificKeyframe& startKeyframe, | |
| 22 const PropertySpecificKeyframe& endKeyframe) | |
| 23 { | |
| 24 return adoptRef(new InvalidatableStyleInterpolation(InterpolationTypes,
startKeyframe, endKeyframe)); | |
| 25 } | |
| 26 | |
| 27 PropertyHandle property() const final { return m_interpolationTypes.first()-
>property(); } | |
| 28 virtual void interpolate(int iteration, double fraction); | |
| 29 bool dependsOnUnderlyingValue() const; | |
| 30 virtual void apply(InterpolationEnvironment&) const { ASSERT_NOT_REACHED();
} | |
| 31 static void applyStack(const ActiveInterpolations&, InterpolationEnvironment
&); | |
| 32 | |
| 33 virtual bool isInvalidatableStyleInterpolation() const { return true; } | |
| 34 | |
| 35 private: | |
| 36 InvalidatableStyleInterpolation( | |
| 37 const Vector<const InterpolationType*>& interpolationTypes, | |
| 38 const PropertySpecificKeyframe& startKeyframe, | |
| 39 const PropertySpecificKeyframe& endKeyframe) | |
| 40 : Interpolation(nullptr, nullptr) | |
| 41 , m_interpolationTypes(interpolationTypes) | |
| 42 , m_startKeyframe(&startKeyframe) | |
| 43 , m_endKeyframe(&endKeyframe) | |
| 44 , m_currentFraction(std::numeric_limits<double>::quiet_NaN()) | |
| 45 , m_isCached(false) | |
| 46 { } | |
| 47 | |
| 48 PassOwnPtr<InterpolationValue> maybeConvertUnderlyingValue(const Interpolati
onEnvironment&) const; | |
| 49 const InterpolationValue* ensureValidInterpolation(const InterpolationEnviro
nment&, const UnderlyingValue&) const; | |
| 50 void clearCache() const; | |
| 51 bool isCacheValid(const InterpolationEnvironment&, const UnderlyingValue&) c
onst; | |
| 52 bool isNeutralKeyframeActive() const; | |
| 53 PassOwnPtr<PairwisePrimitiveInterpolation> maybeConvertPairwise(const Interp
olationEnvironment*, const UnderlyingValue&) const; | |
| 54 PassOwnPtr<InterpolationValue> convertSingleKeyframe(const PropertySpecificK
eyframe&, const InterpolationEnvironment&, const UnderlyingValue&) const; | |
| 55 void setFlagIfInheritUsed(InterpolationEnvironment&) const; | |
| 56 double underlyingFraction() const; | |
| 57 | |
| 58 const Vector<const InterpolationType*>& m_interpolationTypes; | |
| 59 const PropertySpecificKeyframe* m_startKeyframe; | |
| 60 const PropertySpecificKeyframe* m_endKeyframe; | |
| 61 double m_currentFraction; | |
| 62 mutable bool m_isCached; | |
| 63 mutable OwnPtr<PrimitiveInterpolation> m_cachedPairConversion; | |
| 64 mutable InterpolationType::ConversionCheckers m_conversionCheckers; | |
| 65 mutable OwnPtr<InterpolationValue> m_cachedValue; | |
| 66 }; | |
| 67 | |
| 68 DEFINE_TYPE_CASTS(InvalidatableStyleInterpolation, Interpolation, value, value->
isInvalidatableStyleInterpolation(), value.isInvalidatableStyleInterpolation()); | |
| 69 | |
| 70 } // namespace blink | |
| 71 | |
| 72 #endif // InvalidatableStyleInterpolation_h | |
| OLD | NEW |