You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: css-values-4/Overview.bs
+18-19Lines changed: 18 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -1790,19 +1790,17 @@ Distance Units: the <<length>> type</h2>
1790
1790
(This algorithm is called by individual properties explicitly.)
1791
1791
1792
1792
<div algorithm>
1793
-
To <dfn export lt="snap a length as a border width | snap as a border width">snap a length as a border width</dfn>
1793
+
To <dfn export lt="snap as a line width | snap a length as a line width | snap a length as a border width | snap as a border width">snap a length as a line width</dfn>
1794
1794
given a <<length>> |len|:
1795
1795
1796
-
1. Assert: |len| is non-negative.
1797
-
1798
-
2. If |len| is an integer number of [=device pixels=],
1796
+
1. If |len| is an integer number of [=device pixels=],
1799
1797
do nothing.
1800
1798
1801
-
3. If |len| is greater than zero, but less than 1 [=device pixel=],
1802
-
round |len| up to 1 [=device pixel=].
1799
+
2. If the absolute value of |len| is greater than zero, but less than 1 [=device pixel=],
1800
+
round it away from zero to 1 [=device pixel=].
1803
1801
1804
-
4. If |len| is greater than 1 [=device pixel=],
1805
-
round it down to the nearest integer number of [=device pixels=].
1802
+
4. If the absolute value of |len| is greater than 1 [=device pixel=],
1803
+
round it towards zero to the nearest integer number of [=device pixels=].
1806
1804
</div>
1807
1805
1808
1806
<h3 id="relative-lengths">
@@ -3344,18 +3342,13 @@ Stepped Value Functions: ''round()'', ''mod()'', and ''rem()''</h3>
3344
3342
:: Choose whichever of |lower B| and |upper B|
3345
3343
that has the smallest absolute difference from 0.
3346
3344
: <dfn>line-width</dfn>
3347
-
:: If A is non-negative and B is omitted,
3348
-
A is [=snapped as a border width=].
3345
+
:: If B is omitted,
3346
+
A is [=snapped as a line width=].
3349
3347
3350
-
Otherwise, if A is non-negative and B is specified,
3351
-
identical to ''<rounding-strategy>/nearest'',
3348
+
Otherwise round as for ''<rounding-strategy>/nearest'',
3352
3349
except that if one of |lower B| or |upper B| is zero,
3353
-
always choose the non-zero one.
3354
-
Then [=snap as a border width=].
3355
-
3356
-
Otherwise (A is negative),
3357
-
identical to ''<rounding-strategy>/nearest''.
3358
-
(No snapping occurs.)
3350
+
the non-zero one is chosen,
3351
+
and the final result is [=snapped as a line width=].
3359
3352
</dl>
3360
3353
3361
3354
If |lower B| would be zero,
@@ -5671,6 +5664,12 @@ Recent Changes</h3>
5671
5664
5672
5665
(This is a subset of [[#additions-L3]].)
5673
5666
5667
+
Substantial changes since <a href="https://www.w3.org/TR/2024/WD-css-values-4-20240312/">12 March 2024 Working Draft</a>:
5668
+
* Adapt the [=snap as a line width=] algorithm to handle negative numbers.
0 commit comments