Bug 299912
| Summary: | Fix background-shorthand-serialization.html WPT expectations | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Karl Dubost <karlcow> |
| Component: | CSS | Assignee: | Tim Nguyen (:ntim) <ntim> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | darin, koivisto, ntim, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar, WPTImpact |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| URL: | https://wpt.live/css/css-backgrounds/parsing/background-shorthand-serialization.html | ||
| See Also: | https://github.com/web-platform-tests/wpt/pull/55372 | ||
Karl Dubost
https://wpt.live/css/css-backgrounds/parsing/background-shorthand-serialization.html
https://wpt.fyi/css/css-backgrounds/parsing/background-shorthand-serialization.html
background-size with non-initial background-position
EXPECTED "url(\"/favicon.ico\") 0% 0% / 10rem"
ACTUAL "url(\"/favicon.ico\") 0% 0% / 10rem auto"
multiple backgrounds with varying values
EXPECTED "url(\"/favicon.ico\") left top no-repeat, url(\"/favicon.ico\") center center / 100% 100% no-repeat, white url(\"/favicon.ico\")"
ACTUAL "url(\"/favicon.ico\") left top no-repeat, url(\"/favicon.ico\") center center / 100% 100% no-repeat, url(\"/favicon.ico\") white"
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/162156366>
Darin Adler
> EXPECTED "url(\"/favicon.ico\") left top no-repeat, url(\"/favicon.ico\") center center / 100% 100% no-repeat, white url(\"/favicon.ico\")"
This expectation doesn’t make sense to me; WebKit’s behavior seems correct and the WPT test expectation incorrect. The grammar in the CSS specification <https://drafts.csswg.org/css-backgrounds-3/#typedef-final-bg-layer> says:
<final-bg-layer> = <bg-image> || <bg-position> [ / <bg-size> ]? || <repeat-style> || <attachment> || <visual-box> || <visual-box> || <'background-color'>
The color comes after the image in this production, so "white" should come after the URL. If the color was supposed to be first, then it would be at the start, before <bg-image>.
Darin Adler
To change that behavior if we want to match the test expected result rather than the CSS specification, we can probably just move background-color to the start of the longhands for background in CSSProperties.json.
Darin Adler
> EXPECTED "url(\"/favicon.ico\") 0% 0% / 10rem"
> ACTUAL "url(\"/favicon.ico\") 0% 0% / 10rem auto"
The stray "auto" seems to be background-size; now to find out why it’s serialized.
Darin Adler
No, I think the "10rem auto" together is background-size, the mystery is why it’s not serialized as "10rem" without the "auto".
Darin Adler
Yes, we can reproduce the same bug by setting background-size to "10rem" and it will serialize as "10rem auto".
Darin Adler
Tim points out that WebKit’s behavior is correct for that too and https://github.com/w3c/csswg-drafts/issues/7802 explains why.
So I think that both of these are WPT mistakes; WebKit behavior is correct and WPT is wrong.
Darin Adler
Tim’s going to fix these expectations in WPT.
Tim Nguyen (:ntim)
Pull request: https://github.com/WebKit/WebKit/pull/52174
Tim Nguyen (:ntim)
Submitted web-platform-tests pull request: https://github.com/web-platform-tests/wpt/pull/55372
EWS
Committed 301362@main (cdce9dcdd68a): <https://commits.webkit.org/301362@main>
Reviewed commits have been landed. Closing PR #52174 and removing active labels.