RESOLVED DUPLICATE of bug 245353 88587
Z coordinate incorrect in -webkit-transform-origin Safari
https://bugs.webkit.org/show_bug.cgi?id=88587
Summary Z coordinate incorrect in -webkit-transform-origin Safari
Christopher Cameron
Reported 2012-06-07 15:58:13 PDT
Created attachment 146404 [details] Sample image rendered in Chrome It appears that the Z coordinate of -webkit-transform-origin does not behave correctly on Safari. If the point <x,y,z> is specified by -webkit-transform-origin, and the transformation matrix T is specified by -webkit-transform, then the overall transformation should be: [1 0 0 x] [1 0 0 -x] [0 1 0 y] * T * [0 1 0 -y] [0 0 1 z] [0 0 0 -z] [0 0 0 1] [0 0 0 1] It appears that in Safari, the transformation is actually: [1 0 0 x] [1 0 0 -x] [0 1 0 y] * T * [0 1 0 -y] [0 0 1 0] [0 0 0 -z] [0 0 0 1] [0 0 0 1] Note the zero in row 3 column 4 of the leftmost matrix. Consequently, the resulting Z position is incorrect. I've attached a stripped-down test (from the Chromium bug) which shows this behavior, along with pictures of its rendering. In the example, the top image shows text that should have no transformation applied to it, but it has a translation in the Z dimension as a consequence of this bug. The middle image shows an ordinary rotateY(180deg), which renders correctly on Safari. The bottom image does a rotateY(180deg) around non-zero Z-origin, which is also impacted by this bug on Safari.
Attachments
Sample image rendered in Chrome (75.47 KB, image/png)
2012-06-07 15:58 PDT, Christopher Cameron
no flags
Rendering in Safari (97.27 KB, image/png)
2012-06-07 15:58 PDT, Christopher Cameron
no flags
Source HTML file (1.91 KB, text/html)
2012-06-07 15:59 PDT, Christopher Cameron
no flags
Testcase (1.39 KB, text/html)
2015-01-22 18:21 PST, Simon Fraser (smfr)
no flags
Christopher Cameron
Comment 1 2012-06-07 15:58:45 PDT
Created attachment 146405 [details] Rendering in Safari
Christopher Cameron
Comment 2 2012-06-07 15:59:05 PDT
Created attachment 146406 [details] Source HTML file
Christopher Cameron
Comment 3 2012-06-07 16:00:23 PDT
Adding myself and Simon Fraser to CC.
Simon Fraser (smfr)
Comment 4 2012-06-07 16:05:39 PDT
Is this this same as the issue described by http://jsfiddle.net/fnJyd/ ?
Christopher Cameron
Comment 5 2012-06-07 16:07:40 PDT
(In reply to comment #4) > Is this this same as the issue described by http://jsfiddle.net/fnJyd/ ? > When changing the value of a transform-origin's z component > Safari seems to automatically translate the element to the > specificed position if a transform has been defined. Yes, this is the same issue.
Simon Fraser (smfr)
Comment 6 2012-07-18 12:37:04 PDT
*** Bug 91494 has been marked as a duplicate of this bug. ***
Simon Fraser (smfr)
Comment 7 2013-06-18 16:05:53 PDT
Glen Huang
Comment 8 2015-01-21 22:32:21 PST
Any progress on this one? Allowing specifying the z axis for transform-origin can greatly simplify the creation of a transformed cube for example. Blink has already fixed it, I wonder if webkit can borrow the code directly?
Simon Fraser (smfr)
Comment 9 2015-01-22 08:34:01 PST
Do you have a link to the chromium bug?
Glen Huang
Comment 10 2015-01-22 17:59:18 PST
Actually it seems blink uses different code. I believe this chrome issue is what leads Christopher to open this bug report: https://code.google.com/p/chromium/issues/detail?id=130339
Simon Fraser (smfr)
Comment 11 2015-01-22 18:21:02 PST
Created attachment 245187 [details] Testcase
Tomas Roggero
Comment 12 2017-12-21 20:14:20 PST
Another sample, in this case with animation https://codepen.io/tomasdev/pen/eydWQj If you compare that demo in Chrome vs Safari iOS you will see the origin, even though it's explicitly set, is not calculated the same way.
Tomas Roggero
Comment 13 2017-12-21 20:36:19 PST
Just modified my pen to include a working version, that has an extra wrapper with the proper Z-translate.
Simon Fraser (smfr)
Comment 14 2018-12-01 11:35:25 PST
Still reproduces.
Ahmad Saleem
Comment 15 2022-10-05 09:28:51 PDT
I am able to reproduce this still in Safari Technical Preview 154 using attached test case and Safari show "different" container size for both compared to other browsers (Chrome Canary 108 and Firefox Nightly 107), which shows it of same size. Thanks! Also changing this to "Layout and Rendering" category.
Ahmad Saleem
Comment 16 2023-01-27 10:55:13 PST
I think this is now fixed because Safari 16.3, Chrome Canary 111 are matching each other in both "Source HTML File" and "Testcase". @smfr - can we close this now?
Simon Fraser (smfr)
Comment 17 2023-01-27 10:57:44 PST
I recall Matt fixing something like this.
Matt Woodrow
Comment 18 2023-01-29 12:11:19 PST
*** This bug has been marked as a duplicate of bug 245353 ***
Note You need to log in before you can comment on or make changes to this bug.