Open Bug 1303037 Opened 6 years ago Updated 5 years ago
3D decomposition of 2D matrix is inverted
Opening the attached testcase (and hovering over the yellow area) shows a transition between a 3d transform (`translatez()`) and a 2d matrix transform. The transition is smooth, but once the transition is over the transformed box jumps. There's a transparent div in the testcase that shows where the div *should* transition to. It seems like the div chooses to transition to a different point, but post-transition it jumps to where it's supposed to be. I think there's a bug in the 3d decomposition algorithm when applied to 2d. This happens in Chrome as well. However, neither browser seems to implement the spec exactly (The spec specifies different sets of steps for 2d matrices, including different interpolation and recomposition algorithms. Firefox has a different decomposition algorithm for 2d but recomposes the same way, and chrome just uses 3d for both). This might not matter here since I think we implement 3d decomposition as per spec, and 2d code paths shouldn't be hit for this test case. Not sure though.
Attachment #8791612 - Attachment mime type: text/plain → text/html
Chromium bug at https://bugs.chromium.org/p/chromium/issues/detail?id=647554
Safari actually gets this right.
So does Edge. Probably not a spec bug then?
(In reply to Manish Goregaokar [:manishearth] from comment #0) > and 2d code paths shouldn't be hit for this test case. Not sure though. A problem is here. The 2d matrix in the test case, matrix(1, 1, 1, 0, 0, 0), is a matrix that can not be decomposed by Decompose3DMatrix. (I guess the decomposed one is a mirror image of the original?)
> The 2d matrix in the test case, matrix(1, 1, 1, 0, 0, 0), is a matrix that can not be decomposed by Decompose3DMatrix. All valid 2d matrices should be ones which can be decomposed by the 3d algorithm > I guess the decomposed one is a mirror image of the original? Yes, that's what is happening currently
I don't think the patch is correct. The spec explicitly says that we use the 3d decomposition for both when one of the two is 3d. In fact, it's not possible to do it any other way since the interpolation primitives of the 3d and 2d algorithms differ. We don't really implement decomposition per spec (in particular, we have merged a lot of the codepaths for 3d and 2d) so this is a bit fuzzy.
Worth noting that on a bunch of these cases: https://dbaron.org/css/test/2010/transition-negative-determinant Chromium's behavior is different from ours. We handle all of them without flipping at the end of the transition, whereas Chromium flips the third one in the second row, and the first three in the third row. There's a bit of a history of proposed edits to the spec on the decomposition. I'm not sure if all of the agreed edits to the spec were actually made...
I think our 2d decomposition does not match to the spec (It's bug 937494), but 3d decomposition matches to the spec. I also think chromium 3d decomposition on the compositor matches to the spec, that's the reason why chromium does not render the test case in comment 0 correctly on the compositor.
Note that the decomposition results of matrix(1, 1, 1, 0, 0) * by Decompose2DMatrix XY Shear: -1 Quaternion(w, x, y, z): (0.382683, 0, 0, -0.923880) scale(x, y, z): (-1.414214, 0.707107, 1) * by Decompose3DMatrix XY Shear: 1 Quaternion(w, x, y, z): (0.382683, 0.923880, 0, 0) scale(x, y, z): (-1.414214, -0.707107, -1)
You need to log in before you can comment on or make changes to this bug.