Skip to content

Commit e27546d

Browse files
Compute stroke from the first not none border property in logical order
Compute the derived stroke thickness and color from the first renderable logical border side (block-start, inline-start, block-end, inline-end) according to https://drafts.csswg.org/css-borders-4/#relevant-side-for-border-shape. When two <basic-shape> values are given, the border is rendered as the shape between the two paths. When only a single <basic-shape> is given, the border is rendered as a stroke with the relevant side’s computed border width as the stroke width. The fill color of border is the relevant side’s computed border-color. This CL also removes the use of fill and stroke properties. Bug: 448653232 Change-Id: Iff2f592a7cd0d413a55f6ef62fefd308967a9fb1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7072931 Reviewed-by: Philip Rogers <[email protected]> Commit-Queue: Daniil Sakhapov <[email protected]> Cr-Commit-Position: refs/heads/main@{#1537333}
1 parent 156bb7c commit e27546d

16 files changed

+160
-102
lines changed
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<!DOCTYPE html>
22
<style>
3-
@import "resources/stroke-variants.css";
4-
53
svg {
64
position: absolute;
75
top: 200px;
@@ -12,8 +10,9 @@
1210
stroke: purple;
1311
stroke-width: 20px;
1412
fill: green;
13+
border: 20px solid transparent;
1514
}
1615
</style>
1716
<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
18-
<polygon points="0,0 200,0, 100,200" />
17+
<polygon points="6,0 194,0, 100,188" />
1918
</svg>

css/css-borders/border-shape-absolute-coords-shape.tentative.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<link rel="help" href="https://www.w3.org/TR/css-borders-4/#propdef-border-shape">
44
<link rel="help" href="https://drafts.csswg.org/css-shapes-1/#shape-function">
55
<link rel="match" href="border-shape-absolute-coords-shape-ref.tentative.html">
6+
<meta name="fuzzy" content="maxDifference=0-70;totalPixels=0-1200">
67
<style>
78
.bs-target {
89
position: absolute;
@@ -11,8 +12,7 @@
1112
width: 200px;
1213
height: 200px;
1314
border-shape: shape(from 0% 0%, line to 100% 0%, line to 50% 100%, close);
14-
stroke: purple;
15-
stroke-width: 20px;
15+
border: 20px solid purple;
1616
background: green;
1717
}
1818
</style>

css/css-borders/tentative/border-shape/border-shape-clips-background-ref.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
width: 100px;
66
height: 100px;
77
overflow: visible;
8+
border: 10px solid transparent;
89
}
910

10-
polygon {
11+
circle {
1112
stroke: purple;
1213
stroke-width: 10px;
1314
fill: green;
1415
}
1516
</style>
1617
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
17-
<polygon points="50,0 100,50, 50,100, 0,50" />
18+
<circle cx="50" cy="50" r="50" />
1819
</svg>

css/css-borders/tentative/border-shape/border-shape-clips-background.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
<!DOCTYPE html>
22
<link rel="help" href="https://drafts.csswg.org/css-borders-4/#border-shape">
33
<link rel="match" href="border-shape-clips-background-ref.html">
4-
<meta name="fuzzy" content="maxDifference=0-32;totalPixels=0-128">
4+
<meta name="fuzzy" content="maxDifference=0-110;totalPixels=0-200">
55
<style>
66
#target {
77
width: 100px;
88
height: 100px;
9-
border-shape: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
10-
stroke: purple;
11-
stroke-width: 10px;
9+
border-shape: circle();
10+
border: 10px solid purple;
1211
background: green;
1312
border-radius: 10px;
1413
}

css/css-borders/tentative/border-shape/border-shape-geometry-box-ref.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
<div class="container">
3232
<svg xmlns="http://www.w3.org/2000/svg" width="160" height="160">
3333
<rect width="160" height="160" fill="yellow" />
34-
<rect x="10" y="10" width="140" height="140" fill="thistle" />
3534
<rect x="20" y="20" width="120" height="120" fill="palegoldenrod" />
3635
<rect x="30" y="30" width="100" height="100" fill="lightblue" />
3736
</svg>

css/css-borders/tentative/border-shape/border-shape-geometry-box.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
background: thistle;
1717
padding: 10px;
1818
margin: 10px;
19-
border: 10px solid black;
20-
fill: palegoldenrod;
19+
border: 10px solid palegoldenrod;
2120
}
2221
.contents {
2322
width: 100%;

css/css-borders/tentative/border-shape/border-shape-inner-outer-ref.html

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@
77
overflow: visible;
88
}
99

10-
polygon, circle {
11-
stroke: purple;
12-
stroke-width: 3px;
13-
}
14-
1510
polygon {
1611
fill: yellow;
1712
}

css/css-borders/tentative/border-shape/border-shape-inner-outer.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
<!DOCTYPE html>
22
<link rel="help" href="https://drafts.csswg.org/css-borders-4/#border-shape">
33
<link rel="match" href="border-shape-inner-outer-ref.html">
4-
<meta name="fuzzy" content="maxDifference=0-32;totalPixels=0-128">
4+
<meta name="fuzzy" content="maxDifference=0-170;totalPixels=0-130">
55
<style>
66
#target {
77
width: 100px;
88
height: 100px;
99
border-shape: polygon(50% 0, 100% 50%, 50% 100%, 0 50%) circle(20%);
10-
stroke: purple;
11-
stroke-width: 3px;
10+
border-color: yellow;
1211
background: green;
13-
fill: yellow;
1412
border-radius: 10px;
1513
}
1614
</style>

css/css-borders/tentative/border-shape/border-shape-overflow-stroke.html

Lines changed: 0 additions & 24 deletions
This file was deleted.

css/css-borders/tentative/border-shape/border-shape-shadow-ref.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
svg {
88
width: 200px;
99
height: 200px;
10+
overflow: visible;
11+
border: 2px solid transparent;
1012
}
1113
.shadow {
1214
fill: purple;
@@ -21,6 +23,6 @@
2123
</style>
2224

2325
<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
24-
<polygon points="70,10 130,60, 70,110, 10,60" class="shadow" />
25-
<polygon points="70,10 130,60, 70,110, 10,60" class="target" />
26+
<polygon points="100,0 200,100, 100,200, 0,100" class="shadow" />
27+
<polygon points="100,0 200,100, 100,200, 0,100" class="target" />
2628
</svg>

0 commit comments

Comments
 (0)