Files
ladybird/Tests/LibWeb/Text/expected/wpt-import/css/css-values/attr-security.txt
Andreas Kling 61d79a1e47 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.
2026-04-25 14:54:10 +02:00

63 lines
5.5 KiB
Plaintext

Harness status: OK
Found 43 tests
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"
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"
Pass '--x: src(string("https://does-not-exist.test" attr(data-foo)))' with data-foo="/404.png"
Pass 'background-image: src(string("https://does-not-exist.test" attr(data-foo)))' with data-foo="/404.png"
Fail 'background-image: src(string("https://does-not-exist.test/""404.png"))' with data-foo="/404.png"
Pass '--x: attr(data-foo type(<url>))' with data-foo="url(https://does-not-exist.test/404.png)"
Fail 'background-image: attr(data-foo type(<url>))' with data-foo="url(https://does-not-exist.test/404.png)"
Pass 'background-image: url("https://does-not-exist.test/404.png")' with data-foo="url(https://does-not-exist.test/404.png)"
Pass '--x: image(attr(data-foo))' with data-foo="https://does-not-exist.test/404.png"
Pass 'background-image: image(attr(data-foo))' with data-foo="https://does-not-exist.test/404.png"
Fail 'background-image: image("https://does-not-exist.test/404.png")' with data-foo="https://does-not-exist.test/404.png"
Pass 'background-image: url(https://does-not-exist.test/404.png), attr(data-foo type(<image>))' with data-foo="linear-gradient(#000000, #ffffff)"
Fail '--x: image-set(var(--y, attr(data-foo)))' with data-foo="https://does-not-exist.test/404.png"
Pass 'background-image: image-set(var(--y, attr(data-foo)))' with data-foo="https://does-not-exist.test/404.png"
Pass '--x: image-set(var(--some-string))' with data-foo="https://does-not-exist.test/404.png"
Pass 'background-image: image-set(var(--some-string))' with data-foo="https://does-not-exist.test/404.png"
Pass '--x: image-set(var(--some-string-list))' with data-foo="https://does-not-exist.test/404.png"
Pass 'background-image: image-set(var(--some-string-list))' with data-foo="https://does-not-exist.test/404.png"
Fail '--registered-url: attr(data-foo type(<url>))' with data-foo="https://does-not-exist.test/404.png"
Fail '--registered-color: attr(data-foo type(<color>))' with data-foo="blue"
Pass '--x: image-set(var(--some-other-url))' with data-foo="https://does-not-exist.test/404.png"
Pass 'background-image: image-set(var(--some-other-url))' with data-foo="https://does-not-exist.test/404.png"
Fail 'background-image: attr(data-foo type(*))' with data-foo="url(https://does-not-exist.test/404.png), linear-gradient(black, white)"
Pass 'background-image: image-set(var(--image-set-valid))' with data-foo="image/jpeg"
Pass 'background-image: image-set(var(--image-set-invalid))' with data-foo="https://does-not-exist.test/404.png"
Fail '--x: image-set(if(style(--true): attr(data-foo);))' with data-foo="https://does-not-exist.test/404.png"
Pass 'background-image: image-set(if(style(--true): attr(data-foo);))' with data-foo="https://does-not-exist.test/404.png"
Fail 'background-image: image-set(
if(style(--true): url(https://does-not-exist-2.test/404.png);
else: attr(data-foo);))' with data-foo="https://does-not-exist-2.test/404.png"
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"
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"
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(
if(style(--condition-val: if(style(--true): attr(data-foo type(*));)): url(https://does-not-exist.test/404.png);))' with data-foo="3"
Fail '--x: image-set(if(style(--condition-val: if(style(--true): attr(data-foo type(*));)): url(https://does-not-exist.test/404.png);))' with data-foo="3"
Fail '--x: 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(
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(
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(
if(style(--str < attr(data-foo type(*))): url(https://does-not-exist.test/404.png);))' with data-foo="3"
Pass 'background-image: image-set(
if(style(--condition-val < attr(data-foo type(*))): url(https://does-not-exist.test/404.png);))' with data-foo="text"