WebCore:
authorbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Nov 2007 19:05:55 +0000 (19:05 +0000)
committerbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Nov 2007 19:05:55 +0000 (19:05 +0000)
        Reviewed by Oliver.

        Fix for <rdar://problem/5586370> CSS Transform - incorrect matrix
        math leads to crazy problems

        Transform matrices accept the first four parameters as CSS lengths.
        CSS lengths get mapped into WebCore::Lengths as percents by
        WebCore::convertToLength(). Percent lengths cannot call value(). It
        does not yield a correct result and it asserts on Debug builds.

        * rendering/RenderStyle.h:
        (WebCore::MatrixTransformOperation::apply): Instead of calling
        value() on the lengths, call calcValue. This fixes the assert and
        the bad rendering.

LayoutTests:

        Reviewed by Oliver.

        Test for <rdar://problem/5586370> CSS Transform - incorrect matrix
        math leads to crazy problems

        * fast/transforms/identity-matrix.html: Added.
        * platform/mac/fast/transforms/identity-matrix-expected.checksum: Added.
        * platform/mac/fast/transforms/identity-matrix-expected.png: Added.
        * platform/mac/fast/transforms/identity-matrix-expected.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27649 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/transforms/identity-matrix.html [new file with mode: 0644]
LayoutTests/platform/mac/fast/transforms/identity-matrix-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/transforms/identity-matrix-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/transforms/identity-matrix-expected.txt [new file with mode: 0644]
WebCore/ChangeLog
WebCore/rendering/RenderStyle.h

index 9ea2d8ccafe1951ef17a7c1cb6d46962666a7d0a..217bd38db188f5941e3731a3170f53d81049974b 100644 (file)
@@ -1,3 +1,15 @@
+2007-11-09  Beth Dakin  <bdakin@apple.com>
+
+        Reviewed by Oliver.
+
+        Test for <rdar://problem/5586370> CSS Transform - incorrect matrix 
+        math leads to crazy problems
+
+        * fast/transforms/identity-matrix.html: Added.
+        * platform/mac/fast/transforms/identity-matrix-expected.checksum: Added.
+        * platform/mac/fast/transforms/identity-matrix-expected.png: Added.
+        * platform/mac/fast/transforms/identity-matrix-expected.txt: Added.
+
 2007-11-08  Oliver Hunt  <oliver@apple.com>
 
         Reviewed by Maciej.
diff --git a/LayoutTests/fast/transforms/identity-matrix.html b/LayoutTests/fast/transforms/identity-matrix.html
new file mode 100644 (file)
index 0000000..cefbe73
--- /dev/null
@@ -0,0 +1,20 @@
+ <head>
+<style>
+        div {
+            float:left;
+            width:100px;
+            height:100px;
+            background-color:skyblue;
+            border: 5px solid black;
+            margin:5px;
+        }
+        .matrix{ -webkit-transform: matrix(1, 0, 0, 1, 0, 0); }
+</style>
+</head>
+<body>
+The following divs should be idential:
+    <br>
+
+    <div></div>
+    <div class="matrix"></div>
+</body>
diff --git a/LayoutTests/platform/mac/fast/transforms/identity-matrix-expected.checksum b/LayoutTests/platform/mac/fast/transforms/identity-matrix-expected.checksum
new file mode 100644 (file)
index 0000000..2bd45be
--- /dev/null
@@ -0,0 +1 @@
+90f9ead95952ec5a4e0d209c890c94c0
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/transforms/identity-matrix-expected.png b/LayoutTests/platform/mac/fast/transforms/identity-matrix-expected.png
new file mode 100644 (file)
index 0000000..0e91b91
Binary files /dev/null and b/LayoutTests/platform/mac/fast/transforms/identity-matrix-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/transforms/identity-matrix-expected.txt b/LayoutTests/platform/mac/fast/transforms/identity-matrix-expected.txt
new file mode 100644 (file)
index 0000000..0025291
--- /dev/null
@@ -0,0 +1,14 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderText {#text} at (0,0) size 243x18
+        text run at (0,0) width 243: "The following divs should be idential: "
+      RenderBR {BR} at (0,0) size 0x0
+      RenderBlock (floating) {DIV} at (5,23) size 110x110 [bgcolor=#87CEEB] [border: (5px solid #000000)]
+      RenderText {#text} at (0,0) size 0x0
+      RenderText {#text} at (0,0) size 0x0
+      RenderText {#text} at (0,0) size 0x0
+layer at (133,31) size 110x110
+  RenderBlock (floating) {DIV} at (125,23) size 110x110 [bgcolor=#87CEEB] [border: (5px solid #000000)]
index f95819714b5939d93bc381f39d1e8ba7bbb52d04..f07075661c6bd12e527a2c057bc896cc4b1a6efd 100644 (file)
@@ -1,3 +1,20 @@
+2007-11-09  Beth Dakin  <bdakin@apple.com>
+
+        Reviewed by Oliver.
+
+        Fix for <rdar://problem/5586370> CSS Transform - incorrect matrix 
+        math leads to crazy problems
+
+        Transform matrices accept the first four parameters as CSS lengths. 
+        CSS lengths get mapped into WebCore::Lengths as percents by 
+        WebCore::convertToLength(). Percent lengths cannot call value(). It 
+        does not yield a correct result and it asserts on Debug builds. 
+
+        * rendering/RenderStyle.h:
+        (WebCore::MatrixTransformOperation::apply): Instead of calling 
+        value() on the lengths, call calcValue. This fixes the assert and 
+        the bad rendering. 
+
 2007-11-09  Simon Hausmann  <hausmann@kde.org>
 
         Reviewed by nobody, build/link fix for Qt/Windows.
index 368f05720b93b9f714e7b23b82b55fc139f4ea99..bf7a686d0a23e93fb05941260beb0fc4cd09b578 100644 (file)
@@ -786,7 +786,7 @@ public:
 
     virtual void apply(AffineTransform& transform, const IntSize& borderBoxSize)
     {
-        AffineTransform matrix(m_a.value(), m_b.value(), m_c.value(), m_d.value(), m_e.calcValue(borderBoxSize.width()), m_f.calcValue(borderBoxSize.height()));
+        AffineTransform matrix(m_a.calcValue(1), m_b.calcValue(1), m_c.calcValue(1), m_d.calcValue(1), m_e.calcValue(borderBoxSize.width()), m_f.calcValue(borderBoxSize.height()));
         transform.multiply(matrix);
     }