Unmatrix algorithm implementation is wrong

https://bugs.webkit.org/show_bug.cgi?id=66080

Patch by Mihnea Ovidenie <mihnea@adobe.com> 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.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@93150 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent d3eed0f4
2011-08-16 Mihnea Ovidenie <mihnea@adobe.com>
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 <eric.carlson@apple.com>
Make video-controls-no-scripting.html results platform independent.
<!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>
2011-08-16 Mihnea Ovidenie <mihnea@adobe.com>
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 <joepeck@webkit.org>
Unreviewed Chromium Windows build fix after r93140.
......@@ -395,8 +395,12 @@ static bool decompose(const TransformationMatrix::Matrix4& mat, TransformationMa
// 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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment