LibWeb: Parse CSS image-set()

Add an abstract image style value for image-set() and parse both the
standard and -webkit-prefixed spellings through the existing <image>
value path. The parser accepts URL and string image candidates,
optional resolution descriptors, and type() filters.

Track attr-taint through substituted component values so image-set()
candidates using attr()-derived URL-producing tokens are rejected when
resolved for URL-using properties.

Update the relevant WPT baselines now that image-set() parsing is
supported in additional value contexts.
This commit is contained in:
Andreas Kling
2026-04-25 08:00:11 +02:00
committed by Andreas Kling
parent 30f37d691c
commit 61d79a1e47
Notes: github-actions[bot] 2026-04-25 12:55:37 +00:00
18 changed files with 583 additions and 118 deletions

View File

@@ -2,11 +2,11 @@ Harness status: OK
Found 43 tests
28 Pass
15 Fail
29 Pass
14 Fail
Pass '--x: image-set(attr(data-foo))' with data-foo="https://does-not-exist.test/404.png"
Pass 'background-image: image-set(attr(data-foo))' with data-foo="https://does-not-exist.test/404.png"
Fail 'background-image: image-set("https://does-not-exist.test/404.png")' with data-foo="https://does-not-exist.test/404.png"
Pass 'background-image: image-set("https://does-not-exist.test/404.png")' with data-foo="https://does-not-exist.test/404.png"
Pass '--x: src(attr(data-foo))' with data-foo="https://does-not-exist.test/404.png"
Fail 'background-image: src(attr(data-foo))' with data-foo="https://does-not-exist.test/404.png"
Fail 'background-image: src("https://does-not-exist.test/404.png")' with data-foo="https://does-not-exist.test/404.png"
@@ -42,11 +42,11 @@ Pass 'background-image: image-set(
if(style(--some-string): url(https://does-not-exist.test/404.png);))' with data-foo="https://does-not-exist.test/404.png"
Pass 'background-image: image-set(
if(style(--condition-val: attr(data-foo type(*))): url(https://does-not-exist.test/404.png);))' with data-foo="3"
Pass 'background-image: image-set(
Fail 'background-image: image-set(
if(style(--condition-val: attr(data-foo type(*))): url(https://does-not-exist.test/404.png);
style(--true): url(https://does-not-exist.test/404.png);
else: url(https://does-not-exist.test/404.png);))' with data-foo="1"
Fail 'background-image: image-set(if(style(--true): url(https://does-not-exist.test/404.png);
Pass 'background-image: image-set(if(style(--true): url(https://does-not-exist.test/404.png);
style(--condition-val): url(https://does-not-exist.test/404.png);
else: url(https://does-not-exist.test/404.png);))' with data-foo="attr(data-foo type(*))"
Pass 'background-image: image-set(