Bug 245032
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 |
Tim Nguyen (:ntim)
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 | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/99782177>
Tim Nguyen (:ntim)
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
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
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)
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)
Pull request: https://github.com/WebKit/WebKit/pull/5069
Tim Nguyen (:ntim)
Tests were updated here: https://github.com/web-platform-tests/wpt/pull/36306
Ahmad Saleem
(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
Pull request: https://github.com/WebKit/WebKit/pull/16657
Matt Woodrow
Pull request: https://github.com/WebKit/WebKit/pull/17395
Matt Woodrow
Pull request: https://github.com/WebKit/WebKit/pull/17570