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

Unified Diff: third_party/WebKit/Source/core/svg/SVGAnimateElement.cpp

Issue 2391993006: Move handling of 'attributeType' to SVGAnimateElement (Closed)
Patch Set: Created 4 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
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();
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGAnimateElement.h ('k') | third_party/WebKit/Source/core/svg/SVGAnimationElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698