Skip to content

Commit 1511bc3

Browse files
committed
[css-values] Move the calc()-unwrapping to computed value, not serialization, so it doesn't happen when serializing specified values.
1 parent fe834be commit 1511bc3

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

css-values/Overview.bs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,6 +1506,13 @@ Computed Value</h4>
15061506
as either a number
15071507
or a tuple of a dimension and a percentage.
15081508

1509+
If this resolution process results in only a single value
1510+
(one <<number>>, one <<dimension>>, or one <<percentage>>),
1511+
the computed value is just that value,
1512+
not a ''calc()'' containing that value.
1513+
If this value is outside the allowed range for the context,
1514+
it must be clamped to the nearest allowed value.
1515+
15091516
<div class='example'>
15101517
For example, 'background-position' has special behavior for percentage values, different from lengths:
15111518

@@ -1583,12 +1590,7 @@ Serialization</h4>
15831590
The result must be a summation of unique incompatible units.
15841591
(Terms with a value of zero <strong>must</strong> be preserved in this summation.)
15851592

1586-
2. If the result is a single value,
1587-
clamp the value to the range allowed in the target context,
1588-
then serialize as that value,
1589-
discarding the ''calc()'' wrapper.
1590-
1591-
3. Otherwise, serialize as a ''calc()'' containing the summation,
1593+
2. Serialize as a ''calc()'' containing the summation,
15921594
with the units ordered <a>ASCII case-insensitive</a> alphabetically,
15931595
numbers coming before all units,
15941596
and percentages coming after all units.

css-values/issues-cr-2015.bsi

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,11 @@ Comment: https://lists.w3.org/Archives/Public/www-style/2016Feb/0184.html
145145
Comment: https://lists.w3.org/Archives/Public/www-style/2016Mar/0178.html
146146
Response:
147147
Open:
148+
----
149+
Issue 18.
150+
Summary: Implementations only drop calc() from "simple values" at computed-value time
151+
From: David Baron
152+
Comment: https://lists.w3.org/Archives/Public/www-style/2016Feb/0184.html
153+
Response: https://lists.w3.org/Archives/Public/www-style/2016Mar/0178.html
154+
Closed: Accepted
155+
Resolved:

0 commit comments

Comments
 (0)