Index: Source/WebCore/svg/SVGAnimationElement.cpp |
=================================================================== |
--- Source/WebCore/svg/SVGAnimationElement.cpp (revision 131765) |
+++ Source/WebCore/svg/SVGAnimationElement.cpp (working copy) |
@@ -55,6 +55,8 @@ |
, m_fromPropertyValueType(RegularPropertyValue) |
, m_toPropertyValueType(RegularPropertyValue) |
, m_animationValid(false) |
+ , m_attributeType(AttributeTypeAuto) |
+ , m_hasInvalidCSSAttributeType(false) |
{ |
registerAnimatedPropertiesForSVGAnimationElement(); |
} |
@@ -145,6 +147,7 @@ |
supportedAttributes.add(SVGNames::keyTimesAttr); |
supportedAttributes.add(SVGNames::keyPointsAttr); |
supportedAttributes.add(SVGNames::keySplinesAttr); |
+ supportedAttributes.add(SVGNames::attributeTypeAttr); |
} |
return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); |
} |
@@ -185,6 +188,11 @@ |
return; |
} |
+ if (attribute.name() == SVGNames::attributeTypeAttr) { |
+ setAttributeType(attribute.value()); |
+ return; |
+ } |
+ |
if (SVGTests::parseAttribute(attribute)) |
return; |
if (SVGExternalResourcesRequired::parseAttribute(attribute)) |
@@ -281,16 +289,17 @@ |
return hasTagName(SVGNames::animateMotionTag) ? CalcModePaced : CalcModeLinear; |
} |
-SVGAnimationElement::AttributeType SVGAnimationElement::attributeType() const |
-{ |
+void SVGAnimationElement::setAttributeType(const AtomicString& attributeType) |
+{ |
DEFINE_STATIC_LOCAL(const AtomicString, css, ("CSS")); |
DEFINE_STATIC_LOCAL(const AtomicString, xml, ("XML")); |
- const AtomicString& value = fastGetAttribute(SVGNames::attributeTypeAttr); |
- if (value == css) |
- return AttributeTypeCSS; |
- if (value == xml) |
- return AttributeTypeXML; |
- return AttributeTypeAuto; |
+ if (attributeType == css) |
+ m_attributeType = AttributeTypeCSS; |
+ else if (attributeType == xml) |
+ m_attributeType = AttributeTypeXML; |
+ else |
+ m_attributeType = AttributeTypeAuto; |
+ checkInvalidCSSAttributeType(targetElement(DoNotResolveNewTarget)); |
} |
String SVGAnimationElement::toValue() const |
@@ -648,6 +657,25 @@ |
m_toPropertyValueType = InheritValue; |
} |
+void SVGAnimationElement::targetElementWillChange(SVGElement* currentTarget, SVGElement* newTarget) |
+{ |
+ SVGSMILElement::targetElementWillChange(currentTarget, newTarget); |
+ |
+ checkInvalidCSSAttributeType(newTarget); |
} |
+void SVGAnimationElement::setAttributeName(const QualifiedName& attributeName) |
+{ |
+ SVGSMILElement::setAttributeName(attributeName); |
+ |
+ checkInvalidCSSAttributeType(targetElement(DoNotResolveNewTarget)); |
+} |
+ |
+void SVGAnimationElement::checkInvalidCSSAttributeType(SVGElement* target) |
+{ |
+ m_hasInvalidCSSAttributeType = target && hasValidAttributeName() && attributeType() == AttributeTypeCSS && !isTargetAttributeCSSProperty(target, attributeName()); |
+} |
+ |
+} |
+ |
#endif // ENABLE(SVG) |