RESOLVED FIXED299912
Fix background-shorthand-serialization.html WPT expectations
https://bugs.webkit.org/show_bug.cgi?id=299912
Summary Fix background-shorthand-serialization.html WPT expectations
Karl Dubost
Reported 2025-09-30 16:39:00 PDT
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
Radar WebKit Bug Importer
Comment 1 2025-10-07 16:39:13 PDT
Darin Adler
Comment 2 2025-10-11 08:49:55 PDT
> 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
Comment 3 2025-10-11 08:55:40 PDT
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
Comment 4 2025-10-11 09:22:17 PDT
> 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
Comment 5 2025-10-11 09:32:19 PDT
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
Comment 6 2025-10-11 09:36:38 PDT
Yes, we can reproduce the same bug by setting background-size to "10rem" and it will serialize as "10rem auto".
Darin Adler
Comment 7 2025-10-11 09:40:08 PDT
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
Comment 8 2025-10-11 09:49:51 PDT
Tim’s going to fix these expectations in WPT.
Tim Nguyen (:ntim)
Comment 9 2025-10-11 10:00:46 PDT
Tim Nguyen (:ntim)
Comment 10 2025-10-11 10:03:44 PDT
Submitted web-platform-tests pull request: https://github.com/web-platform-tests/wpt/pull/55372
EWS
Comment 11 2025-10-11 11:38:30 PDT
Committed 301362@main (cdce9dcdd68a): <https://commits.webkit.org/301362@main> Reviewed commits have been landed. Closing PR #52174 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.