| Index: Source/core/animation/KeyframeEffectModel.h
|
| diff --git a/Source/core/animation/KeyframeEffectModel.h b/Source/core/animation/KeyframeEffectModel.h
|
| index 13840dfe3c5b9889b806b0de580428e363ab9bda..7a8a409a7adf8c1a99f9354148421463cb124de9 100644
|
| --- a/Source/core/animation/KeyframeEffectModel.h
|
| +++ b/Source/core/animation/KeyframeEffectModel.h
|
| @@ -36,6 +36,9 @@
|
| #include "core/animation/AnimationEffect.h"
|
| #include "core/animation/InterpolationEffect.h"
|
| #include "core/animation/TimedItem.h"
|
| +#include "core/dom/Element.h"
|
| +#include "core/rendering/style/RenderStyle.h"
|
| +#include "core/rendering/style/StyleInheritedData.h"
|
| #include "heap/Handle.h"
|
| #include "platform/animation/TimingFunction.h"
|
| #include "wtf/HashMap.h"
|
| @@ -269,8 +272,6 @@ private:
|
| {
|
| m_keyframes.appendVector(keyframes);
|
| }
|
| -
|
| - AVKeyframeEffectModel(PassRefPtr<InterpolationEffect>);
|
| };
|
|
|
|
|
| @@ -282,12 +283,15 @@ public:
|
| {
|
| return adoptRef(new Keyframe);
|
| }
|
| - void setPropertyValue(CSSPropertyID property, const String& value)
|
| +
|
| + // This string setter will accept shorthand properties and expand them internally.
|
| + void setPropertyValue(CSSPropertyID, const String& value);
|
| + void setPropertyValue(CSSPropertyID property, PassRefPtr<CSSValue> value)
|
| {
|
| m_propertyValues.add(property, value);
|
| }
|
| void clearPropertyValue(CSSPropertyID property) { m_propertyValues.remove(property); }
|
| - String propertyValue(CSSPropertyID property) const
|
| + CSSValue* propertyValue(CSSPropertyID property) const
|
| {
|
| ASSERT(m_propertyValues.contains(property));
|
| return m_propertyValues.get(property);
|
| @@ -320,15 +324,15 @@ public:
|
| setPropertyValue(iter->key, iter->value);
|
| }
|
|
|
| - typedef HashMap<CSSPropertyID, String> PropertyValueMap;
|
| + typedef HashMap<CSSPropertyID, RefPtr<CSSValue> > PropertyValueMap;
|
| PropertyValueMap m_propertyValues;
|
| };
|
|
|
| typedef WillBeHeapVector<RefPtrWillBeMember<Keyframe> > KeyframeVector;
|
| // FIXME: Implement accumulation.
|
| - static PassRefPtrWillBeRawPtr<SKeyframeEffectModel > create(const KeyframeVector& keyframes)
|
| + static PassRefPtrWillBeRawPtr<SKeyframeEffectModel > create(Element& element, const KeyframeVector& keyframes)
|
| {
|
| - return adoptRefWillBeNoop(new SKeyframeEffectModel(keyframes));
|
| + return adoptRefWillBeNoop(new SKeyframeEffectModel(element, keyframes));
|
| }
|
|
|
| virtual bool affects(CSSPropertyID property) OVERRIDE
|
| @@ -340,12 +344,12 @@ public:
|
| // Represents the keyframes set through the API.
|
| class PropertySpecificKeyframe : public KeyframeEffectModelBase::PropertySpecificKeyframe {
|
| public:
|
| - PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easing, const String& value, CompositeOperation op)
|
| + PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easing, PassRefPtr<CSSValue> value, CompositeOperation op)
|
| : KeyframeEffectModelBase::PropertySpecificKeyframe(offset, easing, op)
|
| , m_value(value)
|
| { }
|
|
|
| - const String& value() const { return m_value; }
|
| + CSSValue* value() const { return m_value.get(); }
|
|
|
| virtual PassOwnPtr<KeyframeEffectModelBase::PropertySpecificKeyframe> cloneWithOffset(double offset) const
|
| {
|
| @@ -356,13 +360,13 @@ public:
|
| private:
|
|
|
| // Used by cloneWithOffset().
|
| - PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easing, const String& value)
|
| + PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easing, PassRefPtr<CSSValue> value)
|
| : KeyframeEffectModelBase::PropertySpecificKeyframe(offset, easing, AnimationEffect::CompositeReplace)
|
| , m_value(value)
|
| {
|
| ASSERT(!isNull(m_offset));
|
| }
|
| - String m_value;
|
| + RefPtr<CSSValue> m_value;
|
| };
|
|
|
| virtual PassOwnPtr<KeyframeEffectModelBase::PropertySpecificKeyframe> neutralKeyframe(double offset, PassRefPtr<TimingFunction> easing) const;
|
| @@ -375,12 +379,16 @@ public:
|
| virtual PassRefPtr<Interpolation> createInterpolation(CSSPropertyID, KeyframeEffectModelBase::PropertySpecificKeyframe *start, KeyframeEffectModelBase::PropertySpecificKeyframe *end) const;
|
|
|
| private:
|
| - SKeyframeEffectModel(const KeyframeVector& keyframes)
|
| + SKeyframeEffectModel(Element& element, const KeyframeVector& keyframes)
|
| + : m_element(&element)
|
| + , m_renderStyle(RenderStyle::create())
|
| {
|
| m_keyframes.appendVector(keyframes);
|
| }
|
|
|
| - SKeyframeEffectModel(PassRefPtr<InterpolationEffect>);
|
| + // FIXME: Remove the need to snapshot computed style values, this will remove the dependency on Element and RenderStyle.
|
| + RefPtr<Element> m_element;
|
| + RefPtr<RenderStyle> m_renderStyle;
|
| };
|
|
|
| DEFINE_TYPE_CASTS(KeyframeEffectModelBase, AnimationEffect, value, value->isKeyframeEffectModel(), value.isKeyframeEffectModel());
|
|
|