Skip to content

Commit 5812df6

Browse files
noamrtabatkins
andauthored
[css-borders-4] [css-shapes-1] Specify rendering of single-path border-shape (#12897)
* [css-borders-4] [css-shapes-1] Specify rendering of single-path border-shape border-shape takes its color (and thickness if single-path) from one of the border sides, namely the first one (in logical order) that has a border-style other than none. Also define half-border-box as per resolution, in css-shapes-1. #11662 (comment) Closes #11662 * Update css-borders-4/Overview.bs Co-authored-by: Tab Atkins Jr. <[email protected]> --------- Co-authored-by: Tab Atkins Jr. <[email protected]>
1 parent df03e2f commit 5812df6

File tree

2 files changed

+27
-10
lines changed

2 files changed

+27
-10
lines changed

css-borders-4/Overview.bs

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3048,23 +3048,33 @@ The 'border-shape' property</h3>
30483048
Initial: none
30493049
Applies to: all elements
30503050
Inherited: no
3051-
Percentages: relative to the given <<geometry-box>>, or to [=border box=] if not given.
3051+
Percentages: see prose
30523052
Computed value: list, each item a computed color
30533053
Animation type: by computed value
30543054
</pre>
30553055

30563056
The 'border-shape' property is provided with either a single <<basic-shape>> or two <<basic-shape>>s,
30573057
resulting in one or two paths, respectively.
3058-
The single-path border shape varint uses the existing ''border'' properties of the element to stroke the
3059-
path that the given <<basic-shape>> resolves to,
3060-
while the double-path border shape variant fills the area between the two paths as if it were the border.
3058+
3059+
When two <<basic-shape>> values are given, the border is rendered between the paths generated shapes.
3060+
When only a single <<basic-shape>> is given, the border is rendered as a stroke with the
3061+
[=relevant side for border shape|relevant side=]'s [=computed value|computed=] [=border width=] as the stroke width.
3062+
3063+
The fill color of the border is the [=relevant side for border shape|relevant side=]'s [=computed value|computed=]'border-color'.
3064+
3065+
When a <<geometry-box>> is not given, the default computation of percentage differs based on the number of given <<basic-shape>> values.
3066+
3067+
When two <<basic-shape>> values are given, the first (outer) one defaults to the [=border box=] and the second (inner) one defaults to the [=padding box=].
3068+
This allows using the different 'border-width' properties to affect the final shape.
3069+
3070+
When a single <<basic-shape>> value is given, the <<geometry-box>> defaults to the ''half-border-box'' value, which allows stroking in a way that matches the default border behavior.
30613071

30623072
The 'border-shape' property is not compatible with 'border-radius' and 'corner-shape'.
30633073
When an element's [=computed value=] of 'border-shape' is not <css>none</css>,
30643074
its 'border-radius' is ignored, as if it was set to 0.
30653075
'corner-shape' is implicitly ignored, as it can only work in tandem with 'border-radius'.
30663076

3067-
A 'box-shadow' follows both the inner and outer border paths.
3077+
A 'box-shadow' follows both the outer border path.
30683078

30693079
'border-shape' does not affect geometry or layout,
30703080
which is still computed using the existing 'border-width' properties.
@@ -3077,11 +3087,15 @@ as described in <a href="https://drafts.csswg.org/css-backgrounds-3/#corner-clip
30773087

30783088
Issue: how should this affect clipping replaced elements?
30793089

3080-
The fill and stroke color, as well as the stroke width, are taken from the respective 'border-color' and 'border-width' properties.
3081-
3082-
Issue: define this in detail. Perhaps it should be overridable somehow?
3090+
<div algorithm="choose-relevant-side-for-border-shape">
3091+
An element's <dfn>relevant side for border shape</dfn> is the first side (in the order [=block-start=], [=inline-start=], [=block-end=], and [=inline-end]) that has a non-''border-style/none'' [=border style=], or [=block-start=] if they're all ''border-style/none''.
3092+
1. If |element|'s [=computed value|computed=] 'border-block-start-style' is not ''border-style/none'', then return [=block-start=].
3093+
1. If |element|'s [=computed value|computed=] 'border-inline-start-style' is not ''border-style/none'', then return [=inline-start=].
3094+
1. If |element|'s [=computed value|computed=] 'border-block-end-style' is not ''border-style/none'', then return [=block-end=].
3095+
1. If |element|'s [=computed value|computed=] 'border-inline-end-style' is not ''border-style/none'', then return [=inline-end=].
3096+
1. Return [=block-start=].
3097+
</div>
30833098

3084-
Issue: what do we do about 'border-style'? It can't exactly work for every arbitrary shape.
30853099

30863100
<wpt>
30873101
tentative/border-shape/border-shape-clips-background.html

css-shapes-1/Overview.bs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1358,7 +1358,7 @@ Shapes from Box Values</h2>
13581358
Its syntax is:
13591359

13601360
<pre class="prod">
1361-
<dfn><<shape-box>></dfn> = <<visual-box>> | <a data-xref-type="css-value" data-xref-for="<shape-box>">margin-box</a>
1361+
<dfn><<shape-box>></dfn> = <<visual-box>> | <a data-xref-type="css-value" data-xref-for="<shape-box>">margin-box</a> | <a data-xref-type="css-value" data-xref-for="<shape-box>">half-border-box</a>
13621362
</pre>
13631363

13641364
The definitions of the values are:
@@ -1394,6 +1394,9 @@ Shapes from Box Values</h2>
13941394
is the larger of 0
13951395
or <code>border-radius - border-width - padding</code>.
13961396

1397+
The <dfn value for="<shape-box>, shape-outside">half-border-box</dfn> value defines the shape
1398+
enclosed by a box that is in the middle between the ''padding-box'' and the ''border-box''.
1399+
13971400
<div class="example">
13981401

13991402
Given the 100px square below with

0 commit comments

Comments
 (0)