Skip to content

Commit

Permalink
[css-values-4] Per WG resolution, remove references to calc() resolvi…
Browse files Browse the repository at this point in the history
…ng to <<integer>>, and instead define that a <<number>> will round to the nearest integer. Fixes #2337.
  • Loading branch information
tabatkins committed May 9, 2018
1 parent 97213de commit a80dfaa
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions css-values-4/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1704,8 +1704,14 @@ Type Checking</h4>
<<angle>>,
<<time>>,
<<percentage>>,
<<number>>, or
<<integer>>.
or <<number>>.
It can be used anywhere its [=resolved type=] is allowed.

Additionally, [=math function=] whose [=resolved type=] is <<number>>
can be used in any place that only accepts <<integer>>.
(It gets rounded to the nearest integer,
as specified in [[#calc-range]].)

The <a>resolved type</a> must be valid for where the [=math function=] is placed;
otherwise, the expression is invalid.

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

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

Additionally, if a [=math function=] whose [=resolved type=] is <<number>>
is used somewhere that only accepts <<integer>>,
the [=computed value=] and [=used value=] are rounded to the nearest integer,
in the same manner as clamping, above.
The rounding method must be the same as is used for animations of integer values.

<div class=example>
Since widths smaller than 0px are not allowed,
these three declarations are equivalent:
Expand Down

0 comments on commit a80dfaa

Please sign in to comment.