Bug 1353208 - Add check for attribute namespace ID when we decide if it should animate as a CSS property or not; r=dholbert draft
authorBrian Birtles <birtles@gmail.com>
Thu, 30 Mar 2017 16:13:02 +0900
changeset 555811 1a243ad6e9d9cd69cf8c74041e8d6a4bf137c039
parent 555810 d3b87bfebc50b15ea695d4a07bb8d82f2ffd3a76
child 555812 35bfa915adda4cdd435d63d47269d3dd98d23f23
push id52357
push userbbirtles@mozilla.com
push dateWed, 05 Apr 2017 01:20:37 +0000
reviewersdholbert
bugs1353208
milestone55.0a1
Bug 1353208 - Add check for attribute namespace ID when we decide if it should animate as a CSS property or not; r=dholbert This seems like an existing bug. If the content specifies attributeType="yer:opacity", we should not try to animate it as a CSS property. This patch adds a namespace check before we try to animate as a CSS property. MozReview-Commit-ID: 1LpBa23ddqX
dom/smil/nsSMILCompositor.cpp
layout/reftests/svg/smil/style/namespaced-property-1.svg
layout/reftests/svg/smil/style/reftest.list
--- a/dom/smil/nsSMILCompositor.cpp
+++ b/dom/smil/nsSMILCompositor.cpp
@@ -136,16 +136,20 @@ nsSMILCompositor::CreateSMILAttr()
 
   return mKey.mElement->GetAnimatedAttr(mKey.mAttributeNamespaceID,
                                         mKey.mAttributeName);
 }
 
 nsCSSPropertyID
 nsSMILCompositor::GetCSSPropertyToAnimate() const
 {
+  if (mKey.mAttributeNamespaceID != kNameSpaceID_None) {
+    return eCSSProperty_UNKNOWN;
+  }
+
   nsCSSPropertyID propID =
     nsCSSProps::LookupProperty(nsDependentAtomString(mKey.mAttributeName),
                                CSSEnabledState::eForAllContent);
 
   if (!nsSMILCSSProperty::IsPropertyAnimatable(propID)) {
     return eCSSProperty_UNKNOWN;
   }
 
new file mode 100644
--- /dev/null
+++ b/layout/reftests/svg/smil/style/namespaced-property-1.svg
@@ -0,0 +1,6 @@
+<svg xmlns="http://www.w3.org/2000/svg"
+     xmlns:xlink="http://www.w3.org/1999/xlink">
+  <rect x="15" y="15" width="200" height="200" fill="blue">
+    <set attributeName="xlink:opacity" to="0.5" begin="0s" fill="freeze"/>
+  </rect>
+</svg>
--- a/layout/reftests/svg/smil/style/reftest.list
+++ b/layout/reftests/svg/smil/style/reftest.list
@@ -150,8 +150,11 @@ fuzzy-if(skiaContent,1,360) == anim-css-
 == anim-css-strokewidth-4-from-by-px-px.svg   anim-css-strokewidth-4-ref.svg
 == anim-css-strokewidth-4-from-by-px-em.svg   anim-css-strokewidth-4-ref.svg
 == anim-css-strokewidth-4-from-by-em-em.svg   anim-css-strokewidth-4-ref.svg
 fuzzy-if(skiaContent,1,170) == anim-css-strokewidth-4-from-by-no-no.svg   anim-css-strokewidth-4-ref.svg
 
 # check correct handling of "!important" values
 == important-set-1.svg  anim-standard-ref.svg
 == important-set-2.svg  anim-standard-ref.svg
+
+# check namespaced attribute
+== namespaced-property-1.svg  anim-standard-ref.svg