Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(449)

Unified Diff: Source/core/animation/Interpolation.h

Issue 194673002: Web Animations: Refactor KeyframeEffectModel to work via an InterpolationEffect. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@interpolationWrap
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/animation/InertAnimation.cpp ('k') | Source/core/animation/Interpolation.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « Source/core/animation/InertAnimation.cpp ('k') | Source/core/animation/Interpolation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698