| Index: Source/core/svg/properties/NewSVGAnimatedProperty.h
|
| diff --git a/Source/core/svg/properties/NewSVGAnimatedProperty.h b/Source/core/svg/properties/NewSVGAnimatedProperty.h
|
| index 5010d2a27ec21276780aa8e97cbaf4d63dc645a2..6f80988b54c82638432d418e6667d966723e3ba9 100644
|
| --- a/Source/core/svg/properties/NewSVGAnimatedProperty.h
|
| +++ b/Source/core/svg/properties/NewSVGAnimatedProperty.h
|
| @@ -47,14 +47,17 @@ class NewSVGAnimatedPropertyBase : public RefCounted<NewSVGAnimatedPropertyBase>
|
| public:
|
| virtual ~NewSVGAnimatedPropertyBase();
|
|
|
| + virtual NewSVGPropertyBase* baseValueBase() = 0;
|
| virtual NewSVGPropertyBase* currentValueBase() = 0;
|
|
|
| virtual void animationStarted() = 0;
|
| - virtual void resetToBaseVal() = 0;
|
| + virtual PassRefPtr<NewSVGPropertyBase> createAnimatedValue() = 0;
|
| + virtual void setAnimatedValue(PassRefPtr<NewSVGPropertyBase>) = 0;
|
| virtual void animationEnded() = 0;
|
| virtual void animValWillChange() = 0;
|
| virtual void animValDidChange() = 0;
|
|
|
| + virtual bool needsSynchronizeAttribute() = 0;
|
| void synchronizeAttribute();
|
|
|
| SVGElement* contextElement()
|
| @@ -68,11 +71,7 @@ public:
|
| }
|
|
|
| protected:
|
| - NewSVGAnimatedPropertyBase(SVGElement* contextElement, const QualifiedName& attributeName)
|
| - : m_contextElement(contextElement)
|
| - , m_attributeName(attributeName)
|
| - {
|
| - }
|
| + NewSVGAnimatedPropertyBase(SVGElement* contextElement, const QualifiedName& attributeName);
|
|
|
| private:
|
| // This reference is kept alive from V8 wrapper
|
| @@ -113,6 +112,11 @@ public:
|
| return m_baseValue.get();
|
| }
|
|
|
| + virtual NewSVGPropertyBase* baseValueBase()
|
| + {
|
| + return baseValue();
|
| + }
|
| +
|
| Property* currentValue()
|
| {
|
| return m_currentValue ? m_currentValue.get() : m_baseValue.get();
|
| @@ -135,36 +139,41 @@ public:
|
|
|
| bool isAnimating() const
|
| {
|
| - // |m_currentValue| only exists while animation is active,
|
| - // so this can be used to check if this property is being animated.
|
| - return m_currentValue;
|
| + return m_isAnimating;
|
| }
|
|
|
| virtual void animationStarted()
|
| {
|
| ASSERT(!isAnimating());
|
| - m_currentValue = m_baseValue->clone();
|
| + m_isAnimating = true;
|
| + }
|
|
|
| - if (m_animValTearOff)
|
| - m_animValTearOff->setTarget(m_currentValue);
|
| + virtual PassRefPtr<NewSVGPropertyBase> createAnimatedValue()
|
| + {
|
| + return m_baseValue->clone();
|
| }
|
|
|
| - virtual void animationEnded()
|
| + virtual void setAnimatedValue(PassRefPtr<NewSVGPropertyBase> value)
|
| {
|
| ASSERT(isAnimating());
|
| - m_currentValue.clear();
|
| +
|
| + // FIXME: add type check
|
| + m_currentValue = static_pointer_cast<Property>(value);
|
|
|
| if (m_animValTearOff)
|
| - m_animValTearOff->setTarget(m_baseValue);
|
| + m_animValTearOff->setTarget(m_currentValue);
|
| }
|
|
|
| - virtual void resetToBaseVal()
|
| + virtual void animationEnded()
|
| {
|
| ASSERT(isAnimating());
|
| - m_currentValue = m_baseValue->clone();
|
| + m_isAnimating = false;
|
| +
|
| + ASSERT(m_currentValue);
|
| + m_currentValue.clear();
|
|
|
| if (m_animValTearOff)
|
| - m_animValTearOff->setTarget(m_currentValue);
|
| + m_animValTearOff->setTarget(m_baseValue);
|
| }
|
|
|
| virtual void animValWillChange()
|
| @@ -177,6 +186,13 @@ public:
|
| ASSERT(isAnimating());
|
| }
|
|
|
| + virtual bool needsSynchronizeAttribute()
|
| + {
|
| + // DOM attribute synchronization is only needed if tear-off is being touched from javascript or the property is being animated.
|
| + // This prevents unnecessary attribute creation on target element.
|
| + return m_baseValTearOff || isAnimating();
|
| + }
|
| +
|
| // SVGAnimated* DOM Spec implementations:
|
|
|
| // baseVal()/animVal() are only to be used from SVG DOM implementation.
|
| @@ -200,12 +216,15 @@ public:
|
| protected:
|
| NewSVGAnimatedProperty(SVGElement* contextElement, const QualifiedName& attributeName, PassRefPtr<Property> initialValue)
|
| : NewSVGAnimatedPropertyBase(contextElement, attributeName)
|
| + , m_isReadOnly(false)
|
| + , m_isAnimating(false)
|
| , m_baseValue(initialValue)
|
| {
|
| }
|
|
|
| private:
|
| bool m_isReadOnly;
|
| + bool m_isAnimating;
|
|
|
| // When still (not animated):
|
| // Both m_animValTearOff and m_baseValTearOff target m_baseValue.
|
|
|