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

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

Issue 194733002: Web Animations: Use StringKeyframes for element.animate() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: More comments Created 6 years, 8 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/KeyframeEffectModel.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
index fb8a452b00ade9774190302cc8fc3a35a545bae3..f1646ab1c9550064c447d857518dc16ce7d7d092 100644
--- a/Source/core/animation/StringKeyframe.h
+++ b/Source/core/animation/StringKeyframe.h
@@ -5,26 +5,26 @@
#ifndef StringKeyframe_h
#define StringKeyframe_h
-#include "core/animation/AnimatableValue.h"
#include "core/animation/Keyframe.h"
+#include "core/css/StylePropertySet.h"
namespace WebCore {
+class StyleSheetContents;
+
class StringKeyframe : public Keyframe {
public:
static PassRefPtrWillBeRawPtr<StringKeyframe> create()
{
return adoptRefWillBeNoop(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
+ void setPropertyValue(CSSPropertyID, const String& value, StyleSheetContents*);
+ void clearPropertyValue(CSSPropertyID property) { m_propertySet->removeProperty(property); }
+ CSSValue* propertyValue(CSSPropertyID property) const
{
- ASSERT(m_propertyValues.contains(property));
- return m_propertyValues.get(property);
+ int index = m_propertySet->findPropertyIndex(property);
+ RELEASE_ASSERT(index >= 0);
+ return m_propertySet->propertyAt(static_cast<unsigned>(index)).value();
}
virtual PropertySet properties() const OVERRIDE;
@@ -32,40 +32,45 @@ public:
class PropertySpecificKeyframe : public Keyframe::PropertySpecificKeyframe {
public:
- PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easing, const String& value, AnimationEffect::CompositeOperation);
+ PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easing, CSSValue*, AnimationEffect::CompositeOperation);
- const String& value() const { return m_value; }
+ CSSValue* value() const { return m_value.get(); }
virtual PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> neutralKeyframe(double offset, PassRefPtr<TimingFunction> easing) const OVERRIDE FINAL;
- virtual PassRefPtrWillBeRawPtr<Interpolation> createInterpolation(CSSPropertyID, WebCore::Keyframe::PropertySpecificKeyframe* end) const OVERRIDE FINAL;
+ virtual PassRefPtrWillBeRawPtr<Interpolation> createInterpolation(CSSPropertyID, WebCore::Keyframe::PropertySpecificKeyframe* end, Element*) const OVERRIDE FINAL;
virtual void trace(Visitor*) OVERRIDE;
private:
- PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easing, const String& value);
+ PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easing, CSSValue*);
virtual PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> cloneWithOffset(double offset) const;
virtual bool isStringPropertySpecificKeyframe() const OVERRIDE { return true; }
- String m_value;
+ RefPtrWillBeRawPtr<CSSValue> m_value;
};
private:
- StringKeyframe() { }
+ StringKeyframe()
+ : m_propertySet(MutableStylePropertySet::create())
+ { }
StringKeyframe(const StringKeyframe& copyFrom);
+ void setPropertyCSSValue(CSSPropertyID, CSSValue*);
virtual PassRefPtrWillBeRawPtr<Keyframe> clone() const OVERRIDE;
virtual PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> createPropertySpecificKeyframe(CSSPropertyID) const OVERRIDE;
virtual bool isStringKeyframe() const OVERRIDE { return true; }
- typedef HashMap<CSSPropertyID, String> PropertyValueMap;
- PropertyValueMap m_propertyValues;
+ RefPtrWillBeRawPtr<MutableStylePropertySet> m_propertySet;
};
typedef StringKeyframe::PropertySpecificKeyframe StringPropertySpecificKeyframe;
+DEFINE_TYPE_CASTS(StringKeyframe, Keyframe, value, value->isStringKeyframe(), value.isStringKeyframe());
+DEFINE_TYPE_CASTS(StringPropertySpecificKeyframe, Keyframe::PropertySpecificKeyframe, value, value->isStringPropertySpecificKeyframe(), value.isStringPropertySpecificKeyframe());
+
}
#endif
« no previous file with comments | « Source/core/animation/KeyframeEffectModel.cpp ('k') | Source/core/animation/StringKeyframe.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698