Skip to content

Commit 29b1dae

Browse files
committed
[css-values-4][various] Define 'snapped as a border width', and invoke it in several properties to snap computed values. #5210
1 parent 1bd6e25 commit 29b1dae

File tree

5 files changed

+30
-6
lines changed

5 files changed

+30
-6
lines changed

css-backgrounds-3/Overview.bs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1382,7 +1382,7 @@ Initial: medium
13821382
Applies to: all elements except [=ruby base containers=] and [=ruby annotation containers=]
13831383
Inherited: no
13841384
Percentages: N/A
1385-
Computed value: absolute length; zero if the border style is ''border-style/none'' or ''hidden''
1385+
Computed value: absolute length, [=snapped as a border width=]; zero if the border style is ''border-style/none'' or ''hidden''
13861386
Animatable: by computed value
13871387
</pre>
13881388

css-multicol-1/Overview.bs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,7 @@ Stacking Context</h3>
872872
Applies to: multicol containers
873873
Inherited: no
874874
Percentages: N/A
875-
Computed value: absolute length; ''0'' if the column rule style is ''border-style/none'' or ''hidden''
875+
Computed value: absolute length, [=snapped as a border width=]; ''0'' if the column rule style is ''border-style/none'' or ''hidden''
876876
Animation type: by computed value type
877877
</pre>
878878

css-ui-3/Overview.bs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ Initial: medium
322322
Applies to: all elements
323323
Inherited: no
324324
Percentages: N/A
325-
Computed value: absolute length; ''0'' if the outline style is ''border-style/none''.
325+
Computed value: absolute length, [=snapped as a border width=]; ''0'' if the outline style is ''border-style/none''.
326326
Animation type: by computed value
327327
</pre>
328328

css-ui-4/Overview.bs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ Initial: medium
264264
Applies to: all elements
265265
Inherited: no
266266
Percentages: N/A
267-
Computed value: absolute length; ''0'' if the outline style is ''border-style/none''.
267+
Computed value: absolute length, [=snapped as a border width=]; ''0'' if the outline style is ''border-style/none''.
268268
Animation type: by computed value
269269
</pre>
270270

css-values-4/Overview.bs

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ Unprefixed Author-defined Identifiers: the <<custom-ident>> type</h3>
670670
(e.g. ''example'' and ''EXAMPLE'' are two different, unrelated user-defined identifiers).
671671

672672
The <a>CSS-wide keywords</a> are not valid <<custom-ident>>s.
673-
The ''default'' keyword is reserved
673+
The <css>default</css> keyword is reserved
674674
and is also not a valid <<custom-ident>>.
675675
Specifications using <<custom-ident>> must specify clearly
676676
what other keywords are excluded from <<custom-ident>>, if any--
@@ -1661,6 +1661,30 @@ Distance Units: the <<length>> type</h2>
16611661
css/css-shapes/shape-outside/values/shape-outside-polygon-004.html
16621662
</wpt>
16631663

1664+
While the exact supported precision of numeric values,
1665+
and how they are rounded to match that precision,
1666+
is generally intentionally undefined,
1667+
<<length>>s in 'border-width' and a few other properties
1668+
are rounded in a specific fashion
1669+
to ensure reasonable visual display.
1670+
(This algorithm is called by individual properties explicitly.)
1671+
1672+
<div algorithm>
1673+
To <dfn export lt="snap a length as a border width | snap as a border width">snap a length as a border width</dfn>
1674+
given a <<length>> |len|:
1675+
1676+
1. Assert: |len| is non-negative.
1677+
1678+
2. If |len| is an integer number of [=device pixels=],
1679+
do nothing.
1680+
1681+
3. If |len| is greater than zero, but less than 1 [=device pixel=],
1682+
round |len| up to 1 [=device pixel=].
1683+
1684+
4. If |len| is greater than 1 [=device pixel=],
1685+
round it down to the nearest integer number of [=device pixels=].
1686+
</div>
1687+
16641688
<h3 id="relative-lengths">
16651689
Relative Lengths</h3>
16661690

@@ -1827,7 +1851,7 @@ Font-relative Lengths: the ''em'', ''rem'', ''ex'', ''rex'', ''cap'', ''rcap'',
18271851
<dd>
18281852
Equal to the value of the ''cap'' unit on the root element.
18291853

1830-
<dt><dfn id="ch" caniuse="ch">ch</dfn>
1854+
<dt><dfn id="ch" caniuse="ch-unit">ch</dfn>
18311855
<dd>
18321856
Represents the typical <a>advance measure</a> of European alphanumeric characters,
18331857
and measured as the used <a>advance measure</a> of the “0” (ZERO, U+0030) glyph

0 commit comments

Comments
 (0)