| Summary: | Stop applying transforms on root/canvas background-image | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Tim Nguyen (:ntim) <ntim> |
| Component: | Layout and Rendering | Assignee: | 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 | ||
|
Description
Tim Nguyen (:ntim)
2022-09-10 11:42:04 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 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. 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. 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 Pull request: https://github.com/WebKit/WebKit/pull/5069 Tests were updated here: https://github.com/web-platform-tests/wpt/pull/36306 (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. Pull request: https://github.com/WebKit/WebKit/pull/16657 Pull request: https://github.com/WebKit/WebKit/pull/17395 Pull request: https://github.com/WebKit/WebKit/pull/17570 |