Index: third_party/WebKit/Source/core/animation/Interpolation.h |
diff --git a/third_party/WebKit/Source/core/animation/Interpolation.h b/third_party/WebKit/Source/core/animation/Interpolation.h |
index 6131a9858762cd417810491535cad51e68a42610..744d8c6158829d14f463ff65b15af4e17e9ad041 100644 |
--- a/third_party/WebKit/Source/core/animation/Interpolation.h |
+++ b/third_party/WebKit/Source/core/animation/Interpolation.h |
@@ -15,38 +15,42 @@ namespace blink { |
class PropertyHandle; |
-// Represents an animation's effect between an adjacent pair of PropertySpecificKeyframes. |
+// Represents an animation's effect between two values. |
class CORE_EXPORT Interpolation : public RefCounted<Interpolation> { |
WTF_MAKE_NONCOPYABLE(Interpolation); |
public: |
- virtual ~Interpolation(); |
- |
- virtual void interpolate(int iteration, double fraction); |
- |
+ // TODO(alancutter): Remove StyleInterpolation and LegacyStyleInterpolation and upstream StackableInterpolation as Interpolation. |
virtual bool isStyleInterpolation() const { return false; } |
- virtual bool isInvalidatableInterpolation() const { return false; } |
virtual bool isLegacyStyleInterpolation() const { return false; } |
+ virtual bool isStackableInterpolation() const { return false; } |
+ virtual bool isKeyframeInterpolation() const { return false; } |
+ virtual bool isPairwiseInterpolation() const { return false; } |
+ |
+ void interpolate(int iteration, double fraction) |
+ { |
+ if (iteration == m_currentIteration && fraction == m_currentFraction) |
+ return; |
+ m_currentIteration = iteration; |
+ m_currentFraction = fraction; |
+ interpolateImpl(); |
+ } |
+ |
virtual PropertyHandle getProperty() const = 0; |
virtual bool dependsOnUnderlyingValue() const { return false; } |
-protected: |
- const std::unique_ptr<InterpolableValue> m_start; |
- const std::unique_ptr<InterpolableValue> m_end; |
- |
- mutable double m_cachedFraction; |
- mutable int m_cachedIteration; |
- mutable std::unique_ptr<InterpolableValue> m_cachedValue; |
+ virtual ~Interpolation() {} |
- Interpolation(std::unique_ptr<InterpolableValue> start, std::unique_ptr<InterpolableValue> end); |
+protected: |
+ Interpolation() |
+ : m_currentIteration(std::numeric_limits<double>::quiet_NaN()) |
+ , m_currentFraction(std::numeric_limits<double>::quiet_NaN()) |
+ { } |
-private: |
- InterpolableValue* getCachedValueForTesting() const { return m_cachedValue.get(); } |
+ virtual void interpolateImpl() = 0; |
- friend class AnimationInterpolableValueTest; |
- friend class AnimationInterpolationEffectTest; |
- friend class AnimationDoubleStyleInterpolationTest; |
- friend class AnimationVisibilityStyleInterpolationTest; |
+ double m_currentIteration; |
+ double m_currentFraction; |
}; |
using ActiveInterpolations = Vector<RefPtr<Interpolation>, 1>; |