| Index: Source/core/svg/SVGAnimateElement.cpp
|
| diff --git a/Source/core/svg/SVGAnimateElement.cpp b/Source/core/svg/SVGAnimateElement.cpp
|
| index cceb579b6dd86d3bc914ef9a6d3943a8058ebc51..0bb5ee07ac815b95c1d8d06439ff131ce49cc5f3 100644
|
| --- a/Source/core/svg/SVGAnimateElement.cpp
|
| +++ b/Source/core/svg/SVGAnimateElement.cpp
|
| @@ -36,7 +36,6 @@ namespace WebCore {
|
|
|
| SVGAnimateElement::SVGAnimateElement(const QualifiedName& tagName, Document& document)
|
| : SVGAnimationElement(tagName, document)
|
| - , m_animatedPropertyType(AnimatedString)
|
| {
|
| ASSERT(isSVGAnimateElement(*this));
|
| ScriptWrappable::init(this);
|
| @@ -56,13 +55,18 @@ SVGAnimateElement::~SVGAnimateElement()
|
| #endif
|
| }
|
|
|
| +AnimatedPropertyType SVGAnimateElement::animatedPropertyType()
|
| +{
|
| + return ensureAnimator()->type();
|
| +}
|
| +
|
| bool SVGAnimateElement::hasValidAttributeType()
|
| {
|
| SVGElement* targetElement = this->targetElement();
|
| if (!targetElement)
|
| return false;
|
|
|
| - return m_animatedPropertyType != AnimatedUnknown && !hasInvalidCSSAttributeType();
|
| + return animatedPropertyType() != AnimatedUnknown && !hasInvalidCSSAttributeType();
|
| }
|
|
|
| void SVGAnimateElement::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGSMILElement* resultElement)
|
| @@ -72,20 +76,17 @@ void SVGAnimateElement::calculateAnimatedValue(float percentage, unsigned repeat
|
| if (!targetElement || !isSVGAnimateElement(*resultElement))
|
| return;
|
|
|
| - ASSERT(m_animatedPropertyType == determineAnimatedPropertyType());
|
| -
|
| ASSERT(percentage >= 0 && percentage <= 1);
|
| - ASSERT(m_animatedPropertyType != AnimatedTransformList || isSVGAnimateTransformElement(*this));
|
| - ASSERT(m_animatedPropertyType != AnimatedUnknown);
|
| ASSERT(m_animator);
|
| - ASSERT(m_animator->type() == m_animatedPropertyType);
|
| + ASSERT(animatedPropertyType() != AnimatedTransformList || isSVGAnimateTransformElement(*this));
|
| + ASSERT(animatedPropertyType() != AnimatedUnknown);
|
| ASSERT(m_fromProperty);
|
| - ASSERT(m_fromProperty->type() == m_animatedPropertyType);
|
| + ASSERT(m_fromProperty->type() == animatedPropertyType());
|
| ASSERT(m_toProperty);
|
|
|
| SVGAnimateElement* resultAnimationElement = toSVGAnimateElement(resultElement);
|
| ASSERT(resultAnimationElement->m_animatedProperty);
|
| - ASSERT(resultAnimationElement->m_animatedPropertyType == m_animatedPropertyType);
|
| + ASSERT(resultAnimationElement->animatedPropertyType() == animatedPropertyType());
|
|
|
| if (isSVGSetElement(*this))
|
| percentage = 1;
|
| @@ -117,7 +118,6 @@ bool SVGAnimateElement::calculateFromAndToValues(const String& fromString, const
|
|
|
| determinePropertyValueTypes(fromString, toString);
|
| ensureAnimator()->calculateFromAndToValues(m_fromProperty, m_toProperty, fromString, toString);
|
| - ASSERT(m_animatedPropertyType == m_animator->type());
|
| return true;
|
| }
|
|
|
| @@ -138,7 +138,6 @@ bool SVGAnimateElement::calculateFromAndByValues(const String& fromString, const
|
|
|
| determinePropertyValueTypes(fromString, byString);
|
| ensureAnimator()->calculateFromAndByValues(m_fromProperty, m_toProperty, fromString, byString);
|
| - ASSERT(m_animatedPropertyType == m_animator->type());
|
| return true;
|
| }
|
|
|
| @@ -166,7 +165,6 @@ WillBeHeapVector<RawPtrWillBeMember<SVGElement> > findElementInstances(SVGElemen
|
| void SVGAnimateElement::resetAnimatedType()
|
| {
|
| SVGAnimatedTypeAnimator* animator = ensureAnimator();
|
| - ASSERT(m_animatedPropertyType == animator->type());
|
|
|
| SVGElement* targetElement = this->targetElement();
|
| const QualifiedName& attributeName = this->attributeName();
|
| @@ -320,15 +318,15 @@ void SVGAnimateElement::clearAnimatedType(SVGElement* targetElement)
|
|
|
| void SVGAnimateElement::applyResultsToTarget()
|
| {
|
| - ASSERT(m_animatedPropertyType != AnimatedTransformList || isSVGAnimateTransformElement(*this));
|
| - ASSERT(m_animatedPropertyType != AnimatedUnknown);
|
| ASSERT(m_animator);
|
| + ASSERT(animatedPropertyType() != AnimatedTransformList || isSVGAnimateTransformElement(*this));
|
| + ASSERT(animatedPropertyType() != AnimatedUnknown);
|
|
|
| // Early exit if our animated type got destructed by a previous endedActiveInterval().
|
| if (!m_animatedProperty)
|
| return;
|
|
|
| - if (ensureAnimator()->isAnimatingCSSProperty()) {
|
| + if (m_animator->isAnimatingCSSProperty()) {
|
| // CSS properties animation code-path.
|
| // Convert the result of the animation to a String and apply it as CSS property on the target & all instances.
|
| applyCSSPropertyToTargetAndInstances(targetElement(), attributeName(), m_animatedProperty->valueAsString());
|
| @@ -341,10 +339,10 @@ void SVGAnimateElement::applyResultsToTarget()
|
| notifyTargetAndInstancesAboutAnimValChange(targetElement(), attributeName());
|
| }
|
|
|
| -bool SVGAnimateElement::animatedPropertyTypeSupportsAddition() const
|
| +bool SVGAnimateElement::animatedPropertyTypeSupportsAddition()
|
| {
|
| // Spec: http://www.w3.org/TR/SVG/animate.html#AnimationAttributesAndProperties.
|
| - switch (m_animatedPropertyType) {
|
| + switch (animatedPropertyType()) {
|
| case AnimatedBoolean:
|
| case AnimatedEnumeration:
|
| case AnimatedPreserveAspectRatio:
|
| @@ -356,7 +354,7 @@ bool SVGAnimateElement::animatedPropertyTypeSupportsAddition() const
|
| }
|
| }
|
|
|
| -bool SVGAnimateElement::isAdditive() const
|
| +bool SVGAnimateElement::isAdditive()
|
| {
|
| if (animationMode() == ByAnimation || animationMode() == FromByAnimation)
|
| if (!animatedPropertyTypeSupportsAddition())
|
| @@ -394,14 +392,12 @@ void SVGAnimateElement::resetAnimatedPropertyType()
|
| m_toProperty.clear();
|
| m_toAtEndOfDurationProperty.clear();
|
| m_animator.clear();
|
| - m_animatedPropertyType = determineAnimatedPropertyType();
|
| }
|
|
|
| SVGAnimatedTypeAnimator* SVGAnimateElement::ensureAnimator()
|
| {
|
| if (!m_animator)
|
| - m_animator = SVGAnimatedTypeAnimator::create(m_animatedPropertyType, this, targetElement());
|
| - ASSERT(m_animatedPropertyType == m_animator->type());
|
| + m_animator = SVGAnimatedTypeAnimator::create(this, targetElement());
|
| return m_animator.get();
|
| }
|
|
|
|
|