Skip to content

Commit

Permalink
[css-values] Clamp calc() values at both computed and used value time…
Browse files Browse the repository at this point in the history
… per WG resolution. #434
  • Loading branch information
fantasai committed Feb 3, 2018
1 parent 5163f0e commit f50df18
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
9 changes: 8 additions & 1 deletion css-values-3/Overview.bs
Expand Up @@ -1740,8 +1740,12 @@ Range Checking</h4>

Parse-time range-checking of values is not performed within ''calc()'',
and therefore out-of-range values do not cause the declaration to become invalid.
However, the used value resulting from an expression
However, the value resulting from an expression
must be clamped to the range allowed in the target context.
Clamping is performed on computed values to the extent possible,
and also on used values
if computation was unable to sufficiently simplify the expression
to allow range-checking.

Note: This requires all contexts accepting ''calc()''
to define their allowable values as a closed (not open) interval.
Expand Down Expand Up @@ -2140,6 +2144,9 @@ Changes</h2>
<li>Reverted previous change to allow zero angles to drop their unit;
this will instead be special-cased where needed for backwards-compatibility.
(See <a href="https://lists.w3.org/Archives/Public/www-style/2017Apr/0027.html">discussion</a>)
<li>Defined that range checking, and any resulting clamping, of ''calc()'' values
is performed both at computed time and at used time.
(<a href="https://github.com/w3c/csswg-drafts/issues/434">Issue #434</a>)
<li>Fixed grammar error that disallowed numeric expressions as denominators in ''calc()''.
(<a href="https://drafts.csswg.org/css-values-3/issues-cr-2016#issue-12">Issue 12</a>)
<li>Defined handling of font-relative units outside the context of an element.
Expand Down
6 changes: 5 additions & 1 deletion css-values-4/Overview.bs
Expand Up @@ -1880,8 +1880,12 @@ Range Checking</h4>

Parse-time range-checking of values is not performed within [=math functions=],
and therefore out-of-range values do not cause the declaration to become invalid.
However, the used value resulting from an expression
However, the value resulting from an expression
must be clamped to the range allowed in the target context.
Clamping is performed on computed values to the extent possible,
and also on used values
if computation was unable to sufficiently simplify the expression
to allow range-checking.

Note: This requires all contexts accepting ''calc()''
to define their allowable values as a closed (not open) interval.
Expand Down

0 comments on commit f50df18

Please sign in to comment.