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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1740,8 +1740,12 @@ Range Checking
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
21402144
  • 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 discussion)
    2147+
  • Defined that range checking, and any resulting clamping, of ''calc()'' values
  • 2148+
    is performed both at computed time and at used time.
    2149+
    21432150
  • Fixed grammar error that disallowed numeric expressions as denominators in ''calc()''.
  • 21442151
    21452152
  • Defined handling of font-relative units outside the context of an element.
  • css-values-4/Overview.bs

    Lines changed: 5 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -1880,8 +1880,12 @@ Range Checking
    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)