| Index: Source/core/animation/Interpolation.h
|
| diff --git a/Source/core/animation/Interpolation.h b/Source/core/animation/Interpolation.h
|
| index 206dab004231cec89f3977c0ff8827a376c6946d..f1aa0e1478223a4f3e68eccbf1379011f581546b 100644
|
| --- a/Source/core/animation/Interpolation.h
|
| +++ b/Source/core/animation/Interpolation.h
|
| @@ -6,11 +6,12 @@
|
| #define Interpolation_h
|
|
|
| #include "core/animation/InterpolableValue.h"
|
| -#include "core/css/resolver/StyleResolverState.h"
|
| #include "wtf/RefCounted.h"
|
|
|
| namespace WebCore {
|
|
|
| +class StyleResolverState;
|
| +
|
| class Interpolation : public RefCounted<Interpolation> {
|
| public:
|
| static PassRefPtr<Interpolation> create(PassOwnPtr<InterpolableValue> start, PassOwnPtr<InterpolableValue> end)
|
| @@ -20,6 +21,12 @@ public:
|
|
|
| void interpolate(int iteration, double fraction) const;
|
|
|
| + virtual bool isStyleInterpolation() const { return false; }
|
| + virtual bool isLegacyStyleInterpolation() const { return false; }
|
| +
|
| + virtual ~Interpolation()
|
| + { }
|
| +
|
| protected:
|
| const OwnPtr<InterpolableValue> m_start;
|
| const OwnPtr<InterpolableValue> m_end;
|
| @@ -35,6 +42,7 @@ private:
|
|
|
| friend class AnimationInterpolableValueTest;
|
| friend class AnimationInterpolationEffectTest;
|
| +
|
| };
|
|
|
| class StyleInterpolation : public Interpolation {
|
| @@ -45,7 +53,11 @@ public:
|
| // (1) a CSSValue (and applied via StyleBuilder::applyProperty)
|
| // (2) an AnimatableValue (and applied via // AnimatedStyleBuilder::applyProperty)
|
| // (3) a custom value that is inserted directly into the StyleResolverState.
|
| - virtual void apply(StyleResolverState&) = 0;
|
| + virtual void apply(StyleResolverState&) const = 0;
|
| +
|
| + virtual bool isStyleInterpolation() const OVERRIDE FINAL { return true; }
|
| +
|
| + CSSPropertyID id() const { return m_id; }
|
|
|
| protected:
|
| CSSPropertyID m_id;
|
| @@ -56,5 +68,30 @@ protected:
|
| { }
|
| };
|
|
|
| +class LegacyStyleInterpolation : public StyleInterpolation {
|
| +public:
|
| + static PassRefPtr<LegacyStyleInterpolation> create(PassRefPtr<AnimatableValue> start, PassRefPtr<AnimatableValue> end, CSSPropertyID id)
|
| + {
|
| + return adoptRef(new LegacyStyleInterpolation(InterpolableAnimatableValue::create(start), InterpolableAnimatableValue::create(end), id));
|
| + }
|
| +
|
| + virtual void apply(StyleResolverState&) const;
|
| +
|
| + virtual bool isLegacyStyleInterpolation() const OVERRIDE FINAL { return true; }
|
| + AnimatableValue* currentValue() const
|
| + {
|
| + InterpolableAnimatableValue *value = static_cast<InterpolableAnimatableValue *>(m_cachedValue.get());
|
| + return value->value();
|
| + }
|
| +
|
| +private:
|
| + LegacyStyleInterpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<InterpolableValue> end, CSSPropertyID id)
|
| + : StyleInterpolation(start, end, id)
|
| + { }
|
| +};
|
| +
|
| +DEFINE_TYPE_CASTS(StyleInterpolation, Interpolation, value, value->isStyleInterpolation(), value.isStyleInterpolation());
|
| +DEFINE_TYPE_CASTS(LegacyStyleInterpolation, Interpolation, value, value->isLegacyStyleInterpolation(), value.isLegacyStyleInterpolation());
|
| +
|
| }
|
| #endif
|
|
|