Skip to content

Commit f50df18

Browse files
committed
[css-values] Clamp calc() values at both computed and used value time per WG resolution. #434
1 parent 5163f0e commit f50df18

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

css-values-3/Overview.bs

+8-1
Original file line numberDiff line numberDiff line change
@@ -1740,8 +1740,12 @@ Range Checking</h4>
17401740

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

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

css-values-4/Overview.bs

+5-1
Original file line numberDiff line numberDiff line change
@@ -1880,8 +1880,12 @@ Range Checking</h4>
18801880

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

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

0 commit comments

Comments
 (0)