Bug 820629 - animateTransform should not animate non-transform-type attributes r=dholbert
authorRobert Longson <longsonr@gmail.com>
Wed, 12 Dec 2012 19:07:58 +0000
changeset 115821 bf469b6aef6d24edbb27b214a6579394b64901fc
parent 115820 a885614b4b331e61c2ca528742f202db34dd2abe
child 115822 ec65853affc878329af4367147bd9c4d0ca29181
push id24028
push useremorley@mozilla.com
push dateThu, 13 Dec 2012 15:56:02 +0000
treeherdermozilla-central@9db79b97abbb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs820629
milestone20.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 820629 - animateTransform should not animate non-transform-type attributes r=dholbert
content/svg/content/src/nsSVGAnimateTransformElement.cpp
layout/reftests/svg/smil/transform/animate-width-1.svg
layout/reftests/svg/smil/transform/reftest.list
--- a/content/svg/content/src/nsSVGAnimateTransformElement.cpp
+++ b/content/svg/content/src/nsSVGAnimateTransformElement.cpp
@@ -38,16 +38,18 @@ public:
   // Element specializations
   bool ParseAttribute(int32_t aNamespaceID,
                         nsIAtom* aAttribute,
                         const nsAString& aValue,
                         nsAttrValue& aResult);
 
   // nsISMILAnimationElement
   virtual nsSMILAnimationFunction& AnimationFunction();
+  virtual bool GetTargetAttributeName(PRInt32 *aNamespaceID,
+                                      nsIAtom **aLocalName) const;
 
   virtual nsXPCClassInfo* GetClassInfo();
 
   virtual nsIDOMNode* AsDOMNode() { return this; }
 };
 
 NS_IMPL_NS_NEW_SVG_ELEMENT(AnimateTransform)
 
@@ -110,8 +112,22 @@ NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGAni
 //----------------------------------------------------------------------
 // nsISMILAnimationElement methods
 
 nsSMILAnimationFunction&
 nsSVGAnimateTransformElement::AnimationFunction()
 {
   return mAnimationFunction;
 }
+
+bool
+nsSVGAnimateTransformElement::GetTargetAttributeName(PRInt32 *aNamespaceID,
+                                                     nsIAtom **aLocalName) const
+{
+  if (nsSVGAnimateTransformElementBase::GetTargetAttributeName(aNamespaceID,
+                                                               aLocalName)) {
+    return *aNamespaceID == kNameSpaceID_None &&
+           (*aLocalName == nsGkAtoms::transform ||
+            *aLocalName == nsGkAtoms::patternTransform ||
+            *aLocalName == nsGkAtoms::gradientTransform);
+  }
+  return false;
+}
new file mode 100644
--- /dev/null
+++ b/layout/reftests/svg/smil/transform/animate-width-1.svg
@@ -0,0 +1,22 @@
+<svg xmlns="http://www.w3.org/2000/svg"
+     xmlns:xlink="http://www.w3.org/1999/xlink"
+     class="reftest-wait">
+
+  <script xlink:href="../smil-util.js" type="text/javascript"/>
+  <script>
+    function doTest() {
+      setTimeAndSnapshot(101, false);
+    }
+    window.addEventListener("MozReftestInvalidate", doTest, false);
+  </script>
+
+  <rect width="100%" height="100%" fill="lime" />
+
+  <!-- Test 1: We shouldn't animate a width attribute with animateTransform -->
+
+  <rect width="0px" height="50px" fill="red">
+    <animateTransform attributeName="width" begin="100s" dur="1s"
+                      from="0" to="100" fill="freeze" />
+  </rect>
+
+</svg>
--- a/layout/reftests/svg/smil/transform/reftest.list
+++ b/layout/reftests/svg/smil/transform/reftest.list
@@ -1,12 +1,13 @@
 # Tests related to SVG Animation (using SMIL), focusing on the animateTransform
 # element.
 
 == additive-1.svg additive-1-ref.svg
+== animate-width-1.svg lime.svg
 fuzzy-if(cocoaWidget&&layersGPUAccelerated,1,18) == paced-1.svg paced-1-ref.svg
 == rotate-angle-1.svg rotate-angle-ref.svg
 == rotate-angle-2.svg rotate-angle-ref.svg
 == rotate-angle-3.svg rotate-angle-ref.svg
 fuzzy-if(Android,16,2) == rotate-angle-4.svg rotate-angle-ref.svg
 == rotate-angle-5.svg rotate-angle-ref.svg
 == scale-1.svg scale-1-ref.svg
 fuzzy-if(cocoaWidget&&layersGPUAccelerated,1,45) == skew-1.svg skew-1-ref.svg