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

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

Issue 215883005: Web Animations: Introduce String based KeyframeEffectModel (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
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/KeyframeEffectModelTest.cpp ('k') | Source/core/animation/StringKeyframe.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/animation/StringKeyframe.h
diff --git a/Source/core/animation/StringKeyframe.h b/Source/core/animation/StringKeyframe.h
new file mode 100644
index 0000000000000000000000000000000000000000..c2cd1283e24118068955860580081df47d4555c4
--- /dev/null
+++ b/Source/core/animation/StringKeyframe.h
@@ -0,0 +1,63 @@
+// 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 StringKeyframe_h
+#define StringKeyframe_h
+
+#include "core/animation/AnimatableValue.h"
+#include "core/animation/Keyframe.h"
+
+namespace WebCore {
+
+class StringKeyframe : public Keyframe {
+public:
+ static PassRefPtr<StringKeyframe> create() { return adoptRef(new StringKeyframe); }
+ void setPropertyValue(CSSPropertyID property, const String& value)
+ {
+ m_propertyValues.add(property, value);
+ }
+ void clearPropertyValue(CSSPropertyID property) { m_propertyValues.remove(property); }
+ String propertyValue(CSSPropertyID property) const
+ {
+ ASSERT(m_propertyValues.contains(property));
+ return m_propertyValues.get(property);
+ }
+ virtual PropertySet properties() const OVERRIDE;
+
+ class PropertySpecificKeyframe : public Keyframe::PropertySpecificKeyframe {
+ public:
+ PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easing, const String& value, AnimationEffect::CompositeOperation);
+
+ const String& value() const { return m_value; }
+
+ virtual PassOwnPtr<Keyframe::PropertySpecificKeyframe> neutralKeyframe(double offset, PassRefPtr<TimingFunction> easing) const OVERRIDE FINAL;
+ virtual PassRefPtr<Interpolation> createInterpolation(CSSPropertyID, WebCore::Keyframe::PropertySpecificKeyframe* end) const OVERRIDE FINAL;
+ private:
+ PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easing, const String& value);
+
+ virtual PassOwnPtr<Keyframe::PropertySpecificKeyframe> cloneWithOffset(double offset) const;
+ virtual bool isStringPropertySpecificKeyframe() const OVERRIDE { return true; }
+
+ String m_value;
+ };
+
+private:
+ StringKeyframe() { }
+
+ StringKeyframe(const StringKeyframe& copyFrom);
+
+ virtual PassRefPtrWillBeRawPtr<Keyframe> clone() const OVERRIDE;
+ virtual PassOwnPtr<Keyframe::PropertySpecificKeyframe> createPropertySpecificKeyframe(CSSPropertyID) const OVERRIDE;
+
+ virtual bool isStringKeyframe() const OVERRIDE { return true; }
+
+ typedef HashMap<CSSPropertyID, String> PropertyValueMap;
+ PropertyValueMap m_propertyValues;
+};
+
+typedef StringKeyframe::PropertySpecificKeyframe StringPropertySpecificKeyframe;
+
+}
+
+#endif
« no previous file with comments | « Source/core/animation/KeyframeEffectModelTest.cpp ('k') | Source/core/animation/StringKeyframe.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698