WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 251196
image-set() should serialize in authored order
https://bugs.webkit.org/show_bug.cgi?id=251196
Summary
image-set() should serialize in authored order
Karl Dubost
Reported
2023-01-25 23:22:33 PST
Go to
http://wpt.live/css/css-images/image-set/image-set-computed.sub.html
Two tests are failing. expected: "image-set(url(\"
http://wpt.live/example.png
\") 63.5dppx, url(\"
http://wpt.live/example.png
\") 2dppx)" actual: "image-set(url(\"
http://wpt.live/example.png
\") 2dppx, url(\"
http://wpt.live/example.png
\") 63.5dppx)" expected: "image-set(url(\"
http://wpt.live/example.png
\") 2dppx, linear-gradient(rgb(0, 0, 0), rgb(255, 255, 255)) 1dppx)" actual: "image-set(linear-gradient(rgb(0, 0, 0), rgb(255, 255, 255)) 1dppx, url(\"
http://wpt.live/example.png
\") 2dppx)" The order of the rules have been swapped.
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2023-01-25 23:23:25 PST
<
rdar://problem/104683422
>
Ryan Reno
Comment 2
2023-02-06 17:41:58 PST
I wonder if the output is the sorted list of images after the engine calculated the preferred image order.
Ryan Reno
Comment 3
2023-02-07 07:35:49 PST
Yes that's almost it. If I remove this sort the tests have the serialized arguments to image-set in the expected order:
https://github.com/WebKit/WebKit/blob/6055ee6392589ea77765c0a3d4d8b8898a6534ff/Source/WebCore/css/CSSImageSetValue.cpp#L82
When we're constructing the style from the CSSImageSetValue object we sort the images by resolution so we can more quickly search for an appropriate resolution later when we need to pick one of the images. When we serialize the computed style we may no longer have the arguments in the order the author wrote them. So it's not in "engine preferred order" but in ascending resolution order.
Ryan Reno
Comment 4
2023-02-07 08:11:26 PST
When we implement support for type() (
https://bugs.webkit.org/show_bug.cgi?id=225185
) we will need to filter the set of images on supported MIME type. One thing that could be done to fix this bug is store the image-set as written by the author in the StyleImageSet object. On construction that object could then create a second list of sorted-by-resolution and filtered-by-MIME-type images that it uses in the algorithm to determine which image to use.
Ryan Reno
Comment 5
2023-02-24 23:25:16 PST
Pull request:
https://github.com/WebKit/WebKit/pull/10680
Ryan Reno
Comment 6
2023-02-24 23:52:28 PST
Submitted web-platform-tests pull request:
https://github.com/web-platform-tests/wpt/pull/38709
EWS
Comment 7
2023-03-01 10:29:09 PST
Committed
261015@main
(2fff06ab22a9): <
https://commits.webkit.org/261015@main
> Reviewed commits have been landed. Closing PR #10680 and removing active labels.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug