Skip to content

Commit 2553e3c

Browse files
[border-shape] Disable border-radius and corner-shape with border-shape
https://drafts.csswg.org/css-borders-4/#border-shape-radius-interaction The border-shape property is not compatible with border-radius and corner-shape, so disable it explicitly instead of doing so in layout/ paint. Fixed: 501626908 Change-Id: I34eb29d8de2c8c4049e0b7e315b5cc0e640ff67c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7748831 Reviewed-by: Rune Lillesveen <futhark@chromium.org> Commit-Queue: Daniil Sakhapov <sakhapov@chromium.org> Cr-Commit-Position: refs/heads/main@{#1614410}
1 parent f46909d commit 2553e3c

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!DOCTYPE html>
2+
<title>CSS Border Shape: border-radius is ignored in computed style when border-shape is specified</title>
3+
<link rel="help" href="https://drafts.csswg.org/css-borders-4/#border-shape-radius-interaction">
4+
<script src="/resources/testharness.js"></script>
5+
<script src="/resources/testharnessreport.js"></script>
6+
<style>
7+
#test {
8+
border-shape: inset(0px) inset(0px round 20px);
9+
border-radius: 999px;
10+
corner-shape: bevel;
11+
}
12+
</style>
13+
<div id="test"></div>
14+
<script>
15+
test(() => {
16+
const style = getComputedStyle(document.getElementById('test'));
17+
assert_not_equals(style.borderShape, 'none', 'borderShape should be parsed successfully');
18+
assert_equals(style.borderTopLeftRadius, '999px');
19+
assert_equals(style.borderTopRightRadius, '999px');
20+
assert_equals(style.borderBottomRightRadius, '999px');
21+
assert_equals(style.borderBottomLeftRadius, '999px');
22+
assert_equals(style.cornerTopLeftShape, 'bevel');
23+
assert_equals(style.cornerTopRightShape, 'bevel');
24+
assert_equals(style.cornerBottomRightShape, 'bevel');
25+
assert_equals(style.cornerBottomLeftShape, 'bevel');
26+
}, "border-radius and corner-shape are NOT reset in computed style when border-shape is specified");
27+
</script>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE html>
2+
<style>
3+
.test {
4+
width: 200px;
5+
height: 200px;
6+
box-sizing: border-box;
7+
margin: 50px auto;
8+
outline: 1px solid black;
9+
border: 10px solid transparent;
10+
background: linear-gradient(green, green);
11+
/* Same border-shape as the test, but with border-radius: 0.
12+
If they match, then border-radius on the test was successfully ignored. */
13+
border-shape: inset(0px) inset(10px round 20px);
14+
border-radius: 0px;
15+
}
16+
</style>
17+
<div class="test"></div>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!DOCTYPE html>
2+
<title>CSS Border Shape: border-radius is ignored when border-shape is specified</title>
3+
<link rel="help" href="https://drafts.csswg.org/css-borders-4/#border-shape-radius-interaction">
4+
<link rel="match" href="border-shape-ignore-radius-ref.html">
5+
<style>
6+
.test {
7+
width: 200px;
8+
height: 200px;
9+
box-sizing: border-box;
10+
margin: 50px auto;
11+
outline: 1px solid black;
12+
border: 10px solid transparent;
13+
background: linear-gradient(green, green);
14+
/* Outer shape is sharp border-box (inset 0).
15+
Inner shape is rounded, inset by 10px (matching the border width). */
16+
border-shape: inset(0px) inset(10px round 20px);
17+
border-radius: 999px;
18+
}
19+
</style>
20+
<div class="test"></div>

0 commit comments

Comments
 (0)