Skip to content

Commit c196082

Browse files
committed
[css-values-4] Define snapping negative lengths as line width
1 parent 8102aa6 commit c196082

1 file changed

Lines changed: 18 additions & 19 deletions

File tree

css-values-4/Overview.bs

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1790,19 +1790,17 @@ Distance Units: the <<length>> type</h2>
17901790
(This algorithm is called by individual properties explicitly.)
17911791

17921792
<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>
17941794
given a <<length>> |len|:
17951795

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=],
17991797
do nothing.
18001798

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=].
18031801

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=].
18061804
</div>
18071805

18081806
<h3 id="relative-lengths">
@@ -3344,18 +3342,13 @@ Stepped Value Functions: ''round()'', ''mod()'', and ''rem()''</h3>
33443342
:: Choose whichever of |lower B| and |upper B|
33453343
that has the smallest absolute difference from 0.
33463344
: <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=].
33493347

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'',
33523349
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=].
33593352
</dl>
33603353

33613354
If |lower B| would be zero,
@@ -5671,6 +5664,12 @@ Recent Changes</h3>
56715664

56725665
(This is a subset of [[#additions-L3]].)
56735666

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.
5669+
(<a href="https://github.com/w3c/csswg-drafts/issues/13795">Issue 13795</a>)
5670+
5671+
ISSUE: Finish this list.
5672+
56745673
Substantial changes since <a href="https://www.w3.org/TR/2023/WD-css-values-4-20231218/">18 December 2023 WD</a>:
56755674

56765675
* Added the ''clamp()/none'' values to ''clamp()'',
@@ -5719,7 +5718,7 @@ Recent Changes</h3>
57195718
<ul>
57205719
<li>Added [[#component-functions]] to formally define the way that [=functional notation=] syntaxes are defined.
57215720
(<a href="https://github.com/w3c/csswg-drafts/issues/2921">Issue 2921</a>)
5722-
<li>Added algorithm for [=snap as a border width=],
5721+
<li>Added algorithm for [=snap as a line width=],
57235722
to reflect the interoperable rules for rendering consistent stroke widths.
57245723
(<a href="https://github.com/w3c/csswg-drafts/issues/5210">Issue 5210</a>)
57255724
<li>Clarified grammar and [=computed value=] of ''mix()''.

0 commit comments

Comments
 (0)