Index: third_party/WebKit/Source/core/svg/SVGAnimateElement.cpp |
diff --git a/third_party/WebKit/Source/core/svg/SVGAnimateElement.cpp b/third_party/WebKit/Source/core/svg/SVGAnimateElement.cpp |
index 98750224b2ae136853738015b69ef3edd86a8157..c4046985b7b838aad015a5ec28085b9eb0d0ca00 100644 |
--- a/third_party/WebKit/Source/core/svg/SVGAnimateElement.cpp |
+++ b/third_party/WebKit/Source/core/svg/SVGAnimateElement.cpp |
@@ -65,7 +65,9 @@ SVGAnimateElement::SVGAnimateElement(const QualifiedName& tagName, |
: SVGAnimationElement(tagName, document), |
m_animator(this), |
m_fromPropertyValueType(RegularPropertyValue), |
- m_toPropertyValueType(RegularPropertyValue) {} |
+ m_toPropertyValueType(RegularPropertyValue), |
+ m_attributeType(AttributeTypeAuto), |
+ m_hasInvalidCSSAttributeType(false) {} |
SVGAnimateElement* SVGAnimateElement::create(Document& document) { |
return new SVGAnimateElement(SVGNames::animateTag, document); |
@@ -95,6 +97,24 @@ bool SVGAnimateElement::isSVGAnimationAttributeSettingJavaScriptURL( |
return SVGSMILElement::isSVGAnimationAttributeSettingJavaScriptURL(attribute); |
} |
+void SVGAnimateElement::parseAttribute(const QualifiedName& name, |
+ const AtomicString& oldValue, |
+ const AtomicString& value) { |
+ if (name == SVGNames::attributeTypeAttr) { |
+ setAttributeType(value); |
+ return; |
+ } |
+ SVGAnimationElement::parseAttribute(name, oldValue, value); |
+} |
+ |
+void SVGAnimateElement::svgAttributeChanged(const QualifiedName& attrName) { |
+ if (attrName == SVGNames::attributeTypeAttr) { |
+ animationAttributeChanged(); |
+ return; |
+ } |
+ SVGAnimationElement::svgAttributeChanged(attrName); |
+} |
+ |
AnimatedPropertyType SVGAnimateElement::animatedPropertyType() { |
if (!targetElement()) |
return AnimatedUnknown; |
@@ -390,14 +410,47 @@ float SVGAnimateElement::calculateDistance(const String& fromString, |
void SVGAnimateElement::setTargetElement(SVGElement* target) { |
SVGAnimationElement::setTargetElement(target); |
+ checkInvalidCSSAttributeType(); |
resetAnimatedPropertyType(); |
} |
void SVGAnimateElement::setAttributeName(const QualifiedName& attributeName) { |
SVGAnimationElement::setAttributeName(attributeName); |
+ checkInvalidCSSAttributeType(); |
resetAnimatedPropertyType(); |
} |
+void SVGAnimateElement::setAttributeType(const AtomicString& attributeType) { |
+ if (attributeType == "CSS") |
+ m_attributeType = AttributeTypeCSS; |
+ else if (attributeType == "XML") |
+ m_attributeType = AttributeTypeXML; |
+ else |
+ m_attributeType = AttributeTypeAuto; |
+ checkInvalidCSSAttributeType(); |
+} |
+ |
+void SVGAnimateElement::checkInvalidCSSAttributeType() { |
+ bool hasInvalidCSSAttributeType = |
+ targetElement() && hasValidAttributeName() && |
+ getAttributeType() == AttributeTypeCSS && |
+ !isTargetAttributeCSSProperty(targetElement(), attributeName()); |
+ |
+ if (hasInvalidCSSAttributeType != m_hasInvalidCSSAttributeType) { |
+ if (hasInvalidCSSAttributeType) |
+ unscheduleIfScheduled(); |
+ |
+ m_hasInvalidCSSAttributeType = hasInvalidCSSAttributeType; |
+ |
+ if (!hasInvalidCSSAttributeType) |
+ schedule(); |
+ } |
+ |
+ // Clear values that may depend on the previous target. |
+ if (targetElement()) |
+ clearAnimatedType(); |
+} |
+ |
void SVGAnimateElement::resetAnimatedPropertyType() { |
ASSERT(!m_animatedProperty); |
m_fromProperty.clear(); |