Title: [93150] trunk
Revision
93150
Author
[email protected]
Date
2011-08-16 13:44:51 -0700 (Tue, 16 Aug 2011)

Log Message

Unmatrix algorithm implementation is wrong
https://bugs.webkit.org/show_bug.cgi?id=66080

Patch by Mihnea Ovidenie <[email protected]> on 2011-08-16
Reviewed by Dean Jackson.

Source/WebCore:

Current version of the algorithm negates only the scaleX while
it should negate also scaleY and scaleZ when appropriate.

Test: animations/animation-matrix-negative-scale-unmatrix.html

* platform/graphics/transforms/TransformationMatrix.cpp:
(WebCore::decompose):

LayoutTests:

* animations/animation-matrix-negative-scale-unmatrix-expected.txt: Added.
* animations/animation-matrix-negative-scale-unmatrix.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (93149 => 93150)


--- trunk/LayoutTests/ChangeLog	2011-08-16 20:28:38 UTC (rev 93149)
+++ trunk/LayoutTests/ChangeLog	2011-08-16 20:44:51 UTC (rev 93150)
@@ -1,3 +1,13 @@
+2011-08-16  Mihnea Ovidenie  <[email protected]>
+
+        Unmatrix algorithm implementation is wrong
+        https://bugs.webkit.org/show_bug.cgi?id=66080
+
+        Reviewed by Dean Jackson.
+
+        * animations/animation-matrix-negative-scale-unmatrix-expected.txt: Added.
+        * animations/animation-matrix-negative-scale-unmatrix.html: Added.
+
 2011-08-16  Eric Carlson  <[email protected]>
 
         Make video-controls-no-scripting.html results platform independent.

Added: trunk/LayoutTests/animations/animation-matrix-negative-scale-unmatrix-expected.txt (0 => 93150)


--- trunk/LayoutTests/animations/animation-matrix-negative-scale-unmatrix-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/animations/animation-matrix-negative-scale-unmatrix-expected.txt	2011-08-16 20:44:51 UTC (rev 93150)
@@ -0,0 +1 @@
+PASS

Added: trunk/LayoutTests/animations/animation-matrix-negative-scale-unmatrix.html (0 => 93150)


--- trunk/LayoutTests/animations/animation-matrix-negative-scale-unmatrix.html	                        (rev 0)
+++ trunk/LayoutTests/animations/animation-matrix-negative-scale-unmatrix.html	2011-08-16 20:44:51 UTC (rev 93150)
@@ -0,0 +1,61 @@
+<!doctype html>
+<html>
+    <head>
+        <!--
+        This test performs an animation of the matrix operator. The matrix is defined so that the
+        decomposition (unmatrix) algorithm is tested on the path where the matrix is negated and the
+        the scaling factors are also negated.
+        The animation is started and a snapshot is taken after start. The "d" component of matrix
+        should be negative.
+        -->
+        <style type="text/css" media="screen">
+            #box {
+                width: 100px;
+                height: 100px;
+                background-color: blue;
+                -webkit-animation-duration: 1s;
+            }
+
+            @-webkit-keyframes anim {
+                from { -webkit-transform: matrix(1, 0, 0, -1, 0, 0); }
+                to { -webkit-transform: matrix(1, 0, 0, 1, 0, 0); }
+            }
+        </style>
+        <script type="text/_javascript_" charset="utf-8">
+            if (window.layoutTestController) {
+                layoutTestController.dumpAsText();
+                layoutTestController.waitUntilDone();
+            }
+
+            result = "PASS";
+
+            function snapshot()
+            {
+                var boxComputedStyle = window.getComputedStyle(document.getElementById('box'));
+                var matrix = new WebKitCSSMatrix(boxComputedStyle.webkitTransform);
+
+                // "d" component (scaleY) should be negative.
+                if (matrix["d"] > 0)
+                    result = "FAIL(scaleY was positive, expected to be negative)";
+
+                document.getElementById('result').innerHTML = result;
+                if (window.layoutTestController)
+                    layoutTestController.notifyDone();
+            }
+
+            function startAnimation()
+            {
+                document.getElementById("box").style.webkitAnimationName = "anim";
+            }
+
+            document.addEventListener('webkitAnimationStart', snapshot, false);
+        </script>
+    </head>
+    <body>
+        <div id="box"></div>
+        <div id="result"></div>
+        <script>
+            startAnimation();
+        </script>
+    </body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (93149 => 93150)


--- trunk/Source/WebCore/ChangeLog	2011-08-16 20:28:38 UTC (rev 93149)
+++ trunk/Source/WebCore/ChangeLog	2011-08-16 20:44:51 UTC (rev 93150)
@@ -1,3 +1,18 @@
+2011-08-16  Mihnea Ovidenie  <[email protected]>
+
+        Unmatrix algorithm implementation is wrong
+        https://bugs.webkit.org/show_bug.cgi?id=66080
+
+        Reviewed by Dean Jackson.
+
+        Current version of the algorithm negates only the scaleX while
+        it should negate also scaleY and scaleZ when appropriate.
+
+        Test: animations/animation-matrix-negative-scale-unmatrix.html
+
+        * platform/graphics/transforms/TransformationMatrix.cpp:
+        (WebCore::decompose):
+
 2011-08-16  Joseph Pecoraro  <[email protected]>
 
         Unreviewed Chromium Windows build fix after r93140.

Modified: trunk/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp (93149 => 93150)


--- trunk/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp	2011-08-16 20:28:38 UTC (rev 93149)
+++ trunk/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp	2011-08-16 20:44:51 UTC (rev 93150)
@@ -395,8 +395,12 @@
     // is -1, then negate the matrix and the scaling factors.
     v3Cross(row[1], row[2], pdum3);
     if (v3Dot(row[0], pdum3) < 0) {
+
+        result.scaleX *= -1;
+        result.scaleY *= -1;
+        result.scaleZ *= -1;
+
         for (i = 0; i < 3; i++) {
-            result.scaleX *= -1;
             row[i][0] *= -1;
             row[i][1] *= -1;
             row[i][2] *= -1;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to