From 5c11f2e6978fe0b7dfee790f10467b43391edf03 Mon Sep 17 00:00:00 2001 From: Keith Schwarz Date: Sat, 20 Sep 2008 18:52:12 +0200 Subject: [PATCH] Bug 455265 - Default Y parameter for -moz-transform:translate differs from Apple's proposal; r+sr=dbaron --- layout/reftests/transform/abspos-1a.html | 2 +- layout/reftests/transform/abspos-1b.html | 2 +- layout/reftests/transform/abspos-1c.html | 2 +- layout/reftests/transform/abspos-1d.html | 2 +- layout/reftests/transform/abspos-1e.html | 2 +- layout/reftests/transform/percent-1-ref.html | 2 +- layout/reftests/transform/percent-1a.html | 2 +- layout/reftests/transform/percent-1b.html | 2 +- layout/reftests/transform/percent-1d.html | 2 +- layout/reftests/transform/reftest.list | 3 ++- layout/reftests/transform/transform-svg-2a.xhtml | 2 +- layout/reftests/transform/translate-1c.html | 2 +- layout/reftests/transform/translate-1d.html | 2 +- layout/reftests/transform/translate-1e.html | 2 +- layout/reftests/transform/translate-2-ref.html | 9 +++++++++ layout/reftests/transform/translate-2a.html | 9 +++++++++ layout/style/nsStyleTransformMatrix.cpp | 16 +++++++++------- 17 files changed, 42 insertions(+), 21 deletions(-) create mode 100644 layout/reftests/transform/translate-2-ref.html create mode 100644 layout/reftests/transform/translate-2a.html diff --git a/layout/reftests/transform/abspos-1a.html b/layout/reftests/transform/abspos-1a.html index bdff8bb7b5c8..a999bee745d2 100644 --- a/layout/reftests/transform/abspos-1a.html +++ b/layout/reftests/transform/abspos-1a.html @@ -2,7 +2,7 @@ -
+
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
0 1 2 3 4 5 6 7 8 9 diff --git a/layout/reftests/transform/abspos-1b.html b/layout/reftests/transform/abspos-1b.html index dc95fb3e9eec..54c37fdf65d8 100644 --- a/layout/reftests/transform/abspos-1b.html +++ b/layout/reftests/transform/abspos-1b.html @@ -2,7 +2,7 @@ -
+
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
0 1 2 3 4 5 6 7 8 9 diff --git a/layout/reftests/transform/abspos-1c.html b/layout/reftests/transform/abspos-1c.html index 8eadb232a855..d3cc9a4c25b1 100644 --- a/layout/reftests/transform/abspos-1c.html +++ b/layout/reftests/transform/abspos-1c.html @@ -2,7 +2,7 @@ -
+
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
0 1 2 3 4 5 6 7 8 9 diff --git a/layout/reftests/transform/abspos-1d.html b/layout/reftests/transform/abspos-1d.html index f3836e50b7c0..47ac1b9dc2f8 100644 --- a/layout/reftests/transform/abspos-1d.html +++ b/layout/reftests/transform/abspos-1d.html @@ -2,7 +2,7 @@ -
+
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
0 1 2 3 4 5 6 7 8 9 diff --git a/layout/reftests/transform/abspos-1e.html b/layout/reftests/transform/abspos-1e.html index 2f1324f6714f..310d33e4b517 100644 --- a/layout/reftests/transform/abspos-1e.html +++ b/layout/reftests/transform/abspos-1e.html @@ -2,7 +2,7 @@ -
+
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
0 1 2 3 4 5 6 7 8 9 diff --git a/layout/reftests/transform/percent-1-ref.html b/layout/reftests/transform/percent-1-ref.html index 6c2b395ae4af..2f011ce6fb86 100644 --- a/layout/reftests/transform/percent-1-ref.html +++ b/layout/reftests/transform/percent-1-ref.html @@ -3,7 +3,7 @@ diff --git a/layout/reftests/transform/percent-1a.html b/layout/reftests/transform/percent-1a.html index cf5507096e06..4641d89689c2 100644 --- a/layout/reftests/transform/percent-1a.html +++ b/layout/reftests/transform/percent-1a.html @@ -3,7 +3,7 @@ diff --git a/layout/reftests/transform/percent-1b.html b/layout/reftests/transform/percent-1b.html index 36675260dc5a..e836b92ddda8 100644 --- a/layout/reftests/transform/percent-1b.html +++ b/layout/reftests/transform/percent-1b.html @@ -3,7 +3,7 @@ diff --git a/layout/reftests/transform/percent-1d.html b/layout/reftests/transform/percent-1d.html index fa4ad4a1de03..9a4a88ec0d93 100644 --- a/layout/reftests/transform/percent-1d.html +++ b/layout/reftests/transform/percent-1d.html @@ -3,7 +3,7 @@ diff --git a/layout/reftests/transform/reftest.list b/layout/reftests/transform/reftest.list index 3c151df2b21d..eb3684776cd9 100644 --- a/layout/reftests/transform/reftest.list +++ b/layout/reftests/transform/reftest.list @@ -18,11 +18,12 @@ random == translatey-1b.html translatey-1-ref.html # bug 455138 == translatex-2.html translatex-1-ref.html == translatey-2.html translatey-1-ref.html # translate should act like position: relative -== translate-1a.html translate-1-ref.html +!= translate-1a.html translate-1-ref.html random == translate-1b.html translate-1-ref.html # bug 455138 == translate-1c.html translate-1-ref.html == translate-1d.html translate-1-ref.html == translate-1e.html translate-1-ref.html +== translate-2a.html translate-2-ref.html # rotate: Several rotations of the same object should be idempotent == rotate-1a.html rotate-1-ref.html == rotate-1b.html rotate-1-ref.html diff --git a/layout/reftests/transform/transform-svg-2a.xhtml b/layout/reftests/transform/transform-svg-2a.xhtml index 1ac2853e3cb1..c6e86b294b44 100644 --- a/layout/reftests/transform/transform-svg-2a.xhtml +++ b/layout/reftests/transform/transform-svg-2a.xhtml @@ -6,7 +6,7 @@ xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> -
+
diff --git a/layout/reftests/transform/translate-1c.html b/layout/reftests/transform/translate-1c.html index af2f4ff439e7..485f7dcc9ce4 100644 --- a/layout/reftests/transform/translate-1c.html +++ b/layout/reftests/transform/translate-1c.html @@ -2,7 +2,7 @@ -
+
Test Text
diff --git a/layout/reftests/transform/translate-1d.html b/layout/reftests/transform/translate-1d.html index 2876815bfc99..686c721aa2cc 100644 --- a/layout/reftests/transform/translate-1d.html +++ b/layout/reftests/transform/translate-1d.html @@ -2,7 +2,7 @@ -
+
Test Text
diff --git a/layout/reftests/transform/translate-1e.html b/layout/reftests/transform/translate-1e.html index 1ed31311d6d3..c7b8fc0d49c9 100644 --- a/layout/reftests/transform/translate-1e.html +++ b/layout/reftests/transform/translate-1e.html @@ -2,7 +2,7 @@ -
+
Test Text
diff --git a/layout/reftests/transform/translate-2-ref.html b/layout/reftests/transform/translate-2-ref.html new file mode 100644 index 000000000000..e89c01854968 --- /dev/null +++ b/layout/reftests/transform/translate-2-ref.html @@ -0,0 +1,9 @@ + + + + +
+ Test Text +
+ + diff --git a/layout/reftests/transform/translate-2a.html b/layout/reftests/transform/translate-2a.html new file mode 100644 index 000000000000..194f4cbb973b --- /dev/null +++ b/layout/reftests/transform/translate-2a.html @@ -0,0 +1,9 @@ + + + + +
+ Test Text +
+ + diff --git a/layout/style/nsStyleTransformMatrix.cpp b/layout/style/nsStyleTransformMatrix.cpp index 1831f86c6275..08a87af85eb1 100644 --- a/layout/style/nsStyleTransformMatrix.cpp +++ b/layout/style/nsStyleTransformMatrix.cpp @@ -321,24 +321,26 @@ static void ProcessTranslate(nscoord aDelta[2], float aX[2], float aY[2], /* There are several cases to consider. * First, we might have one value, or we might have two. If we have - * one, pretend we got two of the same value. + * two, we need to consider both dX and dY components. * Next, the values might be lengths, or they might be percents. If they're * percents, store them in the dX and dY components. Otherwise, store them in * the main matrix. */ const nsCSSValue &dx = aData->Item(1); - const nsCSSValue &dy = (aData->Count() == 2 ? dx : aData->Item(2)); - if (dx.GetUnit() == eCSSUnit_Percent) aX[0] = dx.GetPercentValue(); else SetCoordToValue(dx, aContext, aPresContext, aDelta[0]); - if (dy.GetUnit() == eCSSUnit_Percent) - aY[1] = dy.GetPercentValue(); - else - SetCoordToValue(dy, aContext, aPresContext, aDelta[1]); + /* If we read in a Y component, set it appropriately */ + if (aData->Count() == 3) { + const nsCSSValue &dy = aData->Item(2); + if (dy.GetUnit() == eCSSUnit_Percent) + aY[1] = dy.GetPercentValue(); + else + SetCoordToValue(dy, aContext, aPresContext, aDelta[1]); + } } /* Helper function to set up a scale matrix. */