Bug 456213 - -moz-transform matrix function with percentages confuses X and Y translate components; r+sr=dbaron
authorKeith Schwarz <keith@keithschwarz.com>
Sun, 21 Sep 2008 07:14:52 +0200
changeset 19468 78beaa82e920b91c9493dc42d4c5afb65c6b65de
parent 19467 afa8c22eb62aec4e1dba676ae824ec13880cf0c8
child 19469 ccce859a94aa7b827c4eb7c92013714e7319d5e8
push id2256
push usersgautherie.bz@free.fr
push dateSun, 21 Sep 2008 05:15:12 +0000
treeherderautoland@78beaa82e920 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs456213
milestone1.9.1b1pre
Bug 456213 - -moz-transform matrix function with percentages confuses X and Y translate components; r+sr=dbaron
layout/reftests/transform/matrix-1-ref.html
layout/reftests/transform/matrix-1a.html
layout/reftests/transform/matrix-2-ref.html
layout/reftests/transform/matrix-2a.html
layout/reftests/transform/matrix-3-ref.html
layout/reftests/transform/matrix-3a.html
layout/reftests/transform/matrix-4-ref.html
layout/reftests/transform/matrix-4a.html
layout/reftests/transform/matrix-5-ref.html
layout/reftests/transform/matrix-5a.html
layout/reftests/transform/matrix-6-ref.html
layout/reftests/transform/matrix-6a.html
layout/reftests/transform/matrix-7-ref.html
layout/reftests/transform/matrix-7a.html
layout/reftests/transform/reftest.list
layout/style/nsStyleTransformMatrix.cpp
new file mode 100644
--- /dev/null
+++ b/layout/reftests/transform/matrix-1-ref.html
@@ -0,0 +1,8 @@
+<html>
+<head>
+</head>
+<body>
+	<div style="-moz-transform: translatex(100px); width: 100px; height: 100px; background-color: gold;">
+        </div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/transform/matrix-1a.html
@@ -0,0 +1,8 @@
+<html>
+<head>
+</head>
+<body>
+	<div style="-moz-transform: matrix(1, 0, 0, 1, 100px, 0); width: 100px; height: 100px; background-color: gold;">
+        </div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/transform/matrix-2-ref.html
@@ -0,0 +1,8 @@
+<html>
+<head>
+</head>
+<body>
+	<div style="-moz-transform: translatey(100px); width: 100px; height: 100px; background-color: gold;">
+        </div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/transform/matrix-2a.html
@@ -0,0 +1,8 @@
+<html>
+<head>
+</head>
+<body>
+	<div style="-moz-transform: matrix(1, 0, 0, 1, 0, 100px); width: 100px; height: 100px; background-color: gold;">
+        </div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/transform/matrix-3-ref.html
@@ -0,0 +1,8 @@
+<html>
+<head>
+</head>
+<body>
+	<div style="-moz-transform: translatex(47%); width: 100px; height: 100px; background-color: gold;">
+        </div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/transform/matrix-3a.html
@@ -0,0 +1,8 @@
+<html>
+<head>
+</head>
+<body>
+	<div style="-moz-transform: matrix(1, 0, 0, 1, 47%, 0); width: 100px; height: 100px; background-color: gold;">
+        </div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/transform/matrix-4-ref.html
@@ -0,0 +1,8 @@
+<html>
+<head>
+</head>
+<body>
+	<div style="-moz-transform: translatey(23%); width: 100px; height: 100px; background-color: gold;">
+        </div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/transform/matrix-4a.html
@@ -0,0 +1,8 @@
+<html>
+<head>
+</head>
+<body>
+	<div style="-moz-transform: matrix(1, 0, 0, 1, 0, 23%); width: 100px; height: 100px; background-color: gold;">
+        </div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/transform/matrix-5-ref.html
@@ -0,0 +1,8 @@
+<html>
+<head>
+</head>
+<body>
+	<div style="-moz-transform: skewx(45deg); width: 100px; height: 100px; background-color: gold;">
+        </div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/transform/matrix-5a.html
@@ -0,0 +1,8 @@
+<html>
+<head>
+</head>
+<body>
+	<div style="-moz-transform: matrix(1, 0, 1, 1, 0, 0); width: 100px; height: 100px; background-color: gold;">
+        </div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/transform/matrix-6-ref.html
@@ -0,0 +1,8 @@
+<html>
+<head>
+</head>
+<body>
+	<div style="-moz-transform: skewy(45deg); width: 100px; height: 100px; background-color: gold;">
+        </div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/transform/matrix-6a.html
@@ -0,0 +1,8 @@
+<html>
+<head>
+</head>
+<body>
+	<div style="-moz-transform: matrix(1, 1, 0, 1, 0, 0); width: 100px; height: 100px; background-color: gold;">
+        </div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/transform/matrix-7-ref.html
@@ -0,0 +1,8 @@
+<html>
+<head>
+</head>
+<body>
+	<div style="-moz-transform: scale(2, 4); width: 100px; height: 100px; background-color: gold;">
+        </div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/transform/matrix-7a.html
@@ -0,0 +1,8 @@
+<html>
+<head>
+</head>
+<body>
+	<div style="-moz-transform: matrix(2, 0, 0, 4, 0, 0); width: 100px; height: 100px; background-color: gold;">
+        </div>
+</body>
+</html>
--- a/layout/reftests/transform/reftest.list
+++ b/layout/reftests/transform/reftest.list
@@ -66,8 +66,16 @@ random == percent-1g.html percent-1-ref.
 # SVG effects should work on transforms.
 == transform-svg-1a.xhtml transform-svg-1-ref.xhtml
 == transform-svg-2a.xhtml transform-svg-2-ref.xhtml
 != transform-svg-2a.xhtml transform-svg-2-fail.xhtml
 # skew should allow a mix of one and two parameters.
 == skew-1a.html skew-1-ref.html
 == skew-1b.html skew-1-ref.html
 == skew-2a.html skew-2-ref.html
+# matrix with values equal to other transforms should behave indistinguishably
+== matrix-1a.html matrix-1-ref.html
+== matrix-2a.html matrix-2-ref.html
+== matrix-3a.html matrix-3-ref.html
+== matrix-4a.html matrix-4-ref.html
+== matrix-5a.html matrix-5-ref.html
+== matrix-6a.html matrix-6-ref.html
+== matrix-7a.html matrix-7-ref.html
--- a/layout/style/nsStyleTransformMatrix.cpp
+++ b/layout/style/nsStyleTransformMatrix.cpp
@@ -251,17 +251,17 @@ static void ProcessMatrix(float aMain[4]
     aX[0] = aData->Item(5).GetPercentValue();
   else
     SetCoordToValue(aData->Item(5), aContext, aPresContext, aDelta[0]);
 
   /* For the final element, if it's a percentage, store it in aY[1].
    * Otherwise, it's a length that needs to go in aDelta[1].
    */
   if (aData->Item(6).GetUnit() == eCSSUnit_Percent)
-    aY[1] = aData->Item(5).GetPercentValue();
+    aY[1] = aData->Item(6).GetPercentValue();
   else
     SetCoordToValue(aData->Item(6), aContext, aPresContext, aDelta[1]);
 }
 
 /* Helper function to process a translatex function. */
 static void ProcessTranslateX(nscoord aDelta[2], float aX[2],
 			      const nsCSSValue::Array* aData,
 			      nsStyleContext* aContext,