Bug 646912. Fix grad-to-degree conversion factor. r=dholbert
authorBoris Zbarsky <bzbarsky@mit.edu>
Thu, 31 Mar 2011 15:29:44 -0400
changeset 64523 a02c78f5cf12cce9caf10f6f8141dcdfdf3b7c80
parent 64522 231d479842007d333c332be4fbb20759da63416d
child 64524 06ed3a52effd3a8a5668aff361d602414f96d7e4
push idunknown
push userunknown
push dateunknown
reviewersdholbert
bugs646912
milestone2.2a1pre
Bug 646912. Fix grad-to-degree conversion factor. r=dholbert
content/svg/content/src/nsSVGAngle.cpp
layout/reftests/svg/smil/motion/animateMotion-rotate-1.svg
layout/reftests/svg/smil/motion/animateMotion-rotate-1a.svg
layout/reftests/svg/smil/motion/animateMotion-rotate-1b.svg
layout/reftests/svg/smil/motion/reftest.list
--- a/content/svg/content/src/nsSVGAngle.cpp
+++ b/content/svg/content/src/nsSVGAngle.cpp
@@ -240,17 +240,17 @@ nsSVGAngle::GetDegreesPerUnit(PRUint8 aU
 {
   switch (aUnit) {
   case nsIDOMSVGAngle::SVG_ANGLETYPE_UNSPECIFIED:
   case nsIDOMSVGAngle::SVG_ANGLETYPE_DEG:
     return 1;
   case nsIDOMSVGAngle::SVG_ANGLETYPE_RAD:
     return static_cast<float>(180.0 / M_PI);
   case nsIDOMSVGAngle::SVG_ANGLETYPE_GRAD:
-    return 180.0f / 100.0f;
+    return 90.0f / 100.0f;
   default:
     NS_NOTREACHED("Unknown unit type");
     return 0;
   }
 }
 
 void
 nsSVGAngle::SetBaseValueInSpecifiedUnits(float aValue,
rename from layout/reftests/svg/smil/motion/animateMotion-rotate-1.svg
rename to layout/reftests/svg/smil/motion/animateMotion-rotate-1a.svg
copy from layout/reftests/svg/smil/motion/animateMotion-rotate-1.svg
copy to layout/reftests/svg/smil/motion/animateMotion-rotate-1b.svg
--- a/layout/reftests/svg/smil/motion/animateMotion-rotate-1.svg
+++ b/layout/reftests/svg/smil/motion/animateMotion-rotate-1b.svg
@@ -19,45 +19,45 @@
   <!-- Big green background to match lime.svg -->
   <rect class="background" width="100%" height="100%" />
   <!-- Red "workspace" (should be covered up, if tests pass) -->
   <rect class="workspace" x="100" y="100" width="100" height="100"/>
 
   <!-- FIRST ROW -->
   <!-- Check that 'rotate' gets applied at begin time -->
   <g>
-    <animateMotion from="150, 100" to="500, 500" rotate="90"
+    <animateMotion from="150, 100" to="500, 500" rotate="100grad"
                    begin="1" dur="1"/>
     <rect class="test" x="0" y="0" width="20" height="50"/>
     <rect class="test" x="0" y="0" width="50" height="20"/>
   </g>
   <rect class="filler" x="100" y="120" width="30" height="30"/>
 
   <!-- Check that 'rotate' gets applied at end time -->
   <g>
-    <animateMotion from="600, 700" to="200, 150" rotate="180" begin="0"
+    <animateMotion from="600, 700" to="200, 150" rotate="200grad" begin="0"
                    dur="1" fill="freeze"/>
     <rect class="test" x="0" y="0" width="20" height="50"/>
     <rect class="test" x="0" y="0" width="50" height="20"/>
   </g>
   <rect class="filler" x="150" y="100" width="30" height="30"/>
 
   <!-- SECOND ROW -->
   <!-- Check that rotate combines with existing rotate -->
   <g transform="rotate(90)">
-    <animateMotion from="150,200" to="600,600" rotate="90"
+    <animateMotion from="150,200" to="600,600" rotate="100grad"
                    begin="1" dur="1"/>
     <rect class="test" x="0" y="0" width="20" height="50"/>
     <rect class="test" x="0" y="0" width="50" height="20"/>
   </g>
   <rect class="filler" x="100" y="150" width="30" height="30"/>
 
   <!-- Check additivity of <animateMotion> "rotate" adds -->
   <g>
-    <animateMotion from="100,100" to="100,200" rotate="90"
+    <animateMotion from="100,100" to="100,200" rotate="100grad"
                    begin="0.5" dur="1"/>
-    <animateMotion by="100,-200" rotate="90"
+    <animateMotion by="100,-200" rotate="100grad"
                    begin="0.5" dur="1"/>
     <rect class="test" x="0" y="0" width="20" height="50"/>
     <rect class="test" x="0" y="0" width="50" height="20"/>
   </g>
   <rect class="filler" x="150" y="150" width="30" height="30"/>
 </svg>
--- a/layout/reftests/svg/smil/motion/reftest.list
+++ b/layout/reftests/svg/smil/motion/reftest.list
@@ -1,14 +1,15 @@
 # Tests related to SVG Animation (using SMIL), focusing on the animateMotion
 # element.
 
 == animateMotion-by-1.svg      lime.svg
 == animateMotion-from-to-1.svg lime.svg
 == animateMotion-mpath-target-transform-1.svg lime.svg
-== animateMotion-rotate-1.svg  lime.svg
+== animateMotion-rotate-1a.svg lime.svg
+== animateMotion-rotate-1b.svg lime.svg
 == animateMotion-rotate-2.svg  lime.svg
 == animateMotion-values-linear-1.svg animateMotion-values-linear-1-ref.svg
 == animateMotion-values-paced-1a.svg animateMotion-values-paced-1-ref.svg
 == animateMotion-values-paced-1b.svg animateMotion-values-paced-1-ref.svg
 
 # Tests involving <mpath> sub-element
 == animateMotion-mpath-targetChange-1.svg lime.svg