Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Unified Diff: Source/WebCore/svg/SVGAnimationElement.cpp

Issue 11184044: Merge 130777 - Prevent animation when CSS attributeType is invalid. (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1271/
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebCore/svg/SVGAnimationElement.h ('k') | Source/WebCore/svg/animation/SVGSMILElement.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « Source/WebCore/svg/SVGAnimationElement.h ('k') | Source/WebCore/svg/animation/SVGSMILElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698