Safari renders html elements with complex transforms in the wrong position
https://bugs.webkit.org/show_bug.cgi?id=278898
Summary Safari renders html elements with complex transforms in the wrong position
Ivan
Reported 2024-08-29 21:13:37 PDT
Created attachment 472363 [details] Issue demonstration with web inspector Check the attached screenshot, web inspector shows the right element size and position, but Safari renders it in a wrong place. The element reacts on mouse events also correctly - according to its real position. Here you can find the live example https://3dflipbook.net/css-layer-highlight This is a regression issue, it was working fine in 15.6.
Attachments
Issue demonstration with web inspector (1.11 MB, image/png)
2024-08-29 21:13 PDT, Ivan
no flags
Web Inspector screen-recording (13.74 MB, video/quicktime)
2024-08-31 06:06 PDT, zalan
no flags
Test case (1.25 KB, text/html)
2024-09-04 13:34 PDT, Simon Fraser (smfr)
no flags
Simon Fraser (smfr)
Comment 1 2024-08-30 08:52:49 PDT
Thank you for the report; I can reproduce it—the highlight rectangles are placed too high.
Radar WebKit Bug Importer
Comment 2 2024-08-30 08:53:01 PDT
zalan
Comment 3 2024-08-31 06:06:02 PDT
Created attachment 472385 [details] Web Inspector screen-recording This looks like some subpixel math on transformed layers.
Simon Fraser (smfr)
Comment 4 2024-09-04 13:34:36 PDT
Created attachment 472450 [details] Test case This is about the transforms applied. There's a `perspective` property on a containing element, then this transform on a descendant: transform: translate(-50%, -50%) translate(694px, 396.5px) translateZ(1479.76px) matrix3d(1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, -1.05957, 0, -6.15494, 1) matrix3d(0.00205, 0, 0, 0, 0, 0, 0.00205, 0, 0, 1, 0, 0, 1.05006, 0.0038, 0, 1); This seems to expose a bug in our hit-testing code.
Simon Fraser (smfr)
Comment 5 2024-09-04 13:35:47 PDT
> This seems to expose a bug in our hit-testing code. Actually, hit-testing is correct, the bug is in the rendering.
Simon Fraser (smfr)
Comment 6 2024-09-04 13:40:36 PDT
The author is trying to use CSS transforms to have HTML elements accurately overlay content drawn into a canvas.
Note You need to log in before you can comment on or make changes to this bug.