Skip to content

Commit a80dfaa

Browse files
committed
[css-values-4] Per WG resolution, remove references to calc() resolving to <<integer>>, and instead define that a <<number>> will round to the nearest integer. Fixes #2337.
1 parent 97213de commit a80dfaa

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

css-values-4/Overview.bs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1704,8 +1704,14 @@ Type Checking</h4>
17041704
<<angle>>,
17051705
<<time>>,
17061706
<<percentage>>,
1707-
<<number>>, or
1708-
<<integer>>.
1707+
or <<number>>.
1708+
It can be used anywhere its [=resolved type=] is allowed.
1709+
1710+
Additionally, [=math function=] whose [=resolved type=] is <<number>>
1711+
can be used in any place that only accepts <<integer>>.
1712+
(It gets rounded to the nearest integer,
1713+
as specified in [[#calc-range]].)
1714+
17091715
The <a>resolved type</a> must be valid for where the [=math function=] is placed;
17101716
otherwise, the expression is invalid.
17111717

@@ -1818,7 +1824,7 @@ Type-Checking Expressions</h5>
18181824
If the result is failure,
18191825
the entire [=math function=] is invalid.
18201826

1821-
A [=math function=] resolves to <<length>>, <<angle>>, <<time>>, <<frequency>>, <<resolution>>, <<flex>>, or <<percentage>>
1827+
A [=math function=] resolves to <<number>>, <<length>>, <<angle>>, <<time>>, <<frequency>>, <<resolution>>, <<flex>>, or <<percentage>>
18221828
according to which of those productions its [=CSSNumericValue/type=] [=CSSNumericValue/matches=].
18231829
(These categories are mutually exclusive.)
18241830
If it can't [=CSSNumericValue/match=] any of these,
@@ -1923,6 +1929,12 @@ Range Checking</h4>
19231929
Note: This requires all contexts accepting ''calc()''
19241930
to define their allowable values as a closed (not open) interval.
19251931

1932+
Additionally, if a [=math function=] whose [=resolved type=] is <<number>>
1933+
is used somewhere that only accepts <<integer>>,
1934+
the [=computed value=] and [=used value=] are rounded to the nearest integer,
1935+
in the same manner as clamping, above.
1936+
The rounding method must be the same as is used for animations of integer values.
1937+
19261938
<div class=example>
19271939
Since widths smaller than 0px are not allowed,
19281940
these three declarations are equivalent:

0 commit comments

Comments
 (0)