Files
sousa-gecko/testing/web-platform/tests/css/css-backgrounds/parsing/border-image-source-computed.sub.html
T
Javier Fernández García-Boente f22ea673e7 Bug 1989937 [wpt PR 54972] - Apply the CSSGradientValue resolution to other properties, a=testonly
Automatic update from web-platform-tests
Apply the CSSGradientValue resolution to other properties

This change calls to the ResolveGradient function for several CSS
properties that accept CSSGRadientValues as <image> values. These
properties are "border-image-source", "list-style-image", "content",
"shape-outside", "cursor" and "-webkit-mask-box-image".

It's worth mentioning that the "cursor" property doesn't support <image>
values yet as <cursor-image>, although it's specified [1], just <url> or
<url-set>. That's why the new WPT tests have failure expectations for
now.

The failures expectations of the shape-outside test cases are related to
the issue #40468636 or a subset of it. The problem is that chrome
serializes 50% as center, when it should use a <LengthPercentage> as
computed value.

[1] https://drafts.csswg.org/css-ui-4/#typedef-cursor-cursor-image

Bug: 40620723
Change-Id: I7df1712902bb505492f667bb4578b4ef36b5cf76
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6722514
Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org>
Commit-Queue: Javier Fernandez <jfernandez@igalia.com>
Cr-Commit-Position: refs/heads/main@{#1518568}

--

wpt-commits: d0a21a80fa45b6727d0f647c4a58f3d5d8bbfbc2
wpt-pr: 54972
2025-09-24 11:06:41 +00:00

41 lines
2.3 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Backgrounds and Borders: getComputedStyle().borderImageSource</title>
<link rel="help" href="https://drafts.csswg.org/css-backgrounds/#border-image-source">
<meta name="assert" content="border-image-source computed value is the keyword none or the specified image with URIs made absolute.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/computed-testcommon.js"></script>
<style>
#target {
color: blue;
}
</style>
</head>
<body>
<div id="target"></div>
<script>
test_computed_value("border-image-source", "none");
test_computed_value("border-image-source", 'url("http://{{host}}/")');
test_computed_value('border-image-source', 'linear-gradient(-45deg, red, currentcolor)', 'linear-gradient(-45deg, rgb(255, 0, 0), rgb(0, 0, 255))');
test_computed_value("border-image-source", 'linear-gradient(45deg, red calc(10% + 5px), blue 90%)', 'linear-gradient(45deg, rgb(255, 0, 0) calc(10% + 5px), rgb(0, 0, 255) 90%)');
test_computed_value('border-image-source', 'repeating-linear-gradient(-45deg, red, 30%, currentcolor 70%, lime)', 'repeating-linear-gradient(-45deg, rgb(255, 0, 0), 30%, rgb(0, 0, 255) 70%, rgb(0, 255, 0))');
test_computed_value('border-image-source', 'radial-gradient(10px at 20px 30px, currentcolor, lime)', 'radial-gradient(10px at 20px 30px, rgb(0, 0, 255), rgb(0, 255, 0))');
test_computed_value("border-image-source", 'radial-gradient(circle at calc(50% * 2 / 4) 40%, red, blue)', 'radial-gradient(circle at 25% 40%, rgb(255, 0, 0), rgb(0, 0, 255))');
test_computed_value('border-image-source', 'conic-gradient(from 90deg at 80% 90%, lime, black)', 'conic-gradient(from 90deg at 80% 90%, rgb(0, 255, 0), rgb(0, 0, 0))');
test_computed_value("border-image-source", 'conic-gradient(from 2rad at 50% 50%, red, blue calc(270deg - 20deg))', 'conic-gradient(from 114.592deg, rgb(255, 0, 0), rgb(0, 0, 255) 250deg)');
test(() => {
const target = document.getElementById('target');
target.style['border-image-source'] = 'url("a.b#c")';
const result = getComputedStyle(target)['border-image-source'];
const resolved = new URL("a.b#c", document.URL).href;
assert_equals(result, 'url("' + resolved + '")');
}, 'url values are made absolute');
</script>
</body>
</html>