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

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

Issue 182383011: Web Animations: Add Interpolation class. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@interpolableValue
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/InterpolableValueTest.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
new file mode 100644
index 0000000000000000000000000000000000000000..1294ed39c896273ddc577272cbcb5ed95484e7f6
--- /dev/null
+++ b/Source/core/animation/Interpolation.h
@@ -0,0 +1,58 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef Interpolation_h
+#define Interpolation_h
+
+#include "core/animation/InterpolableValue.h"
+#include "core/css/resolver/StyleResolverState.h"
+#include "wtf/RefCounted.h"
+
+namespace WebCore {
+
+class Interpolation : public RefCounted<Interpolation> {
+public:
+ static PassRefPtr<Interpolation> create(PassOwnPtr<InterpolableValue> start, PassOwnPtr<InterpolableValue> end)
+ {
+ return adoptRef(new Interpolation(start, end));
+ }
+
+ void interpolate(double fraction) const;
+
+protected:
+ const OwnPtr<InterpolableValue> m_start;
+ const OwnPtr<InterpolableValue> m_end;
+
+ mutable double m_cachedFraction;
+ mutable OwnPtr<InterpolableValue> m_cachedValue;
+
+ Interpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<InterpolableValue> end);
+
+private:
+ InterpolableValue* getCachedValueForTesting() const { return m_cachedValue.get(); }
+
+ friend class AnimationInterpolableValueTest;
+};
+
+class StyleInterpolation : public Interpolation {
+public:
+ // 1) convert m_cachedValue into an X
+ // 2) shove X into StyleResolverState
+ // X can be:
+ // (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;
+
+protected:
+ CSSPropertyID m_id;
+
+ StyleInterpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<InterpolableValue> end, CSSPropertyID id)
+ : Interpolation(start, end)
+ , m_id(id)
+ { }
+};
+
+}
+#endif
« no previous file with comments | « Source/core/animation/InterpolableValueTest.cpp ('k') | Source/core/animation/Interpolation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698