Bug 245032

Summary: Stop applying transforms on root/canvas background-image
Product: WebKit Reporter: Tim Nguyen (:ntim) <ntim>
Component: Layout and RenderingAssignee: Matt Woodrow <mattwoodrow>
Status: NEW    
Severity: Normal CC: ahmad.saleem792, bfulgham, karlcow, mattwoodrow, nmouchtaris, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: BrowserCompat, InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Tim Nguyen (:ntim)
Reported 2022-09-10 11:42:04 PDT
Affected WPT: css/css-transforms/transform-root-bg-001.html : https://wpt.live/css/css-transforms/transform-root-bg-001.html css/css-transforms/transform-root-bg-002.html : https://wpt.live/css/css-transforms/transform-root-bg-002.html css/css-transforms/transform-root-bg-003.html : https://wpt.live/css/css-transforms/transform-root-bg-003.html
Attachments
Radar WebKit Bug Importer
Comment 1 2022-09-10 11:57:23 PDT
Tim Nguyen (:ntim)
Comment 2 2022-09-12 18:26:51 PDT
There are more affected WPT: css/css-transforms/transform-translate-background-001.html css/css-transforms/transform-translate-background-002.html css/css-transforms/transform-background-007.html css/css-transforms/transform-background-008.html
Matt Woodrow
Comment 3 2022-09-20 19:50:06 PDT
I think these tests are potentially wrong, depending on the outcome of https://github.com/w3c/csswg-drafts/issues/6683. As dbaron says, the current spec wording expects us to not transform backgrounds on the root element, unless background-attachment is fixed. If that's the case, then the tests are invalid, since they're testing that the transform does get applied (which is why Gecko also fails the test, since they don't apply the transform). I think we should consider getting these tests removed from interop, until we have a clear spec resolution, and tests that reflect it.
Matt Woodrow
Comment 4 2022-09-20 19:54:49 PDT
The bug as originally stated (incorrect number of repeated images for transformed repeated backgrounds) is because BackgroundPainter::calculateBackgroundImageGeometry is computing a destination drawing area in coordinates after the transform has been applied. We then pass that rectangle to GraphicsContext::drawTiledImage, which expects a destination rectangle in pre-transform coordinates. I think we'd need to transform all the relevant coordinates by the inverse of the transform on the root element (destinationRect, borderBoxRect, positioningAreaSize, left, top etc). There's a lot of complexity around which coordinate space to use when computing tiling size, pixel snapping, background-repeat: round/space etc. None of that appears to be specified currently, nor are there any tests.
Tim Nguyen (:ntim)
Comment 5 2022-10-05 21:02:04 PDT
So the CSSWG resolution was to stop applying transforms on background-images for the root: https://github.com/w3c/csswg-drafts/issues/6683#issuecomment-1269092125
Tim Nguyen (:ntim)
Comment 6 2022-10-05 21:57:53 PDT
Tim Nguyen (:ntim)
Comment 7 2022-10-06 07:42:21 PDT
Ahmad Saleem
Comment 8 2023-05-13 17:42:25 PDT
(In reply to Tim Nguyen (:ntim) from comment #2) > There are more affected WPT: > css/css-transforms/transform-translate-background-001.html > css/css-transforms/transform-translate-background-002.html > css/css-transforms/transform-background-007.html > css/css-transforms/transform-background-008.html Still failing as of STP169.
Matt Woodrow
Comment 9 2023-08-13 21:11:03 PDT
Matt Woodrow
Comment 10 2023-09-03 19:19:19 PDT
Matt Woodrow
Comment 11 2023-09-07 21:03:50 PDT
Note You need to log in before you can comment on or make changes to this bug.