@@ -1438,12 +1438,12 @@ Mathematical Expressions: ''calc()''</h3>
1438
1438
<<frequency>> ,
1439
1439
<<angle>> ,
1440
1440
<<time>> ,
1441
+ <<percentage>> ,
1441
1442
<<number>> , or
1442
1443
<<integer>>
1443
1444
values are allowed.
1444
- Components of a ''calc()'' expression can be literal values,
1445
- ''attr()'' or ''calc()'' expressions,
1446
- or <<percentage>> values that resolve to one of the preceding types.
1445
+ Components of a ''calc()'' expression can be literal values or
1446
+ ''attr()'' or ''calc()'' expressions.
1447
1447
1448
1448
<div class="example">
1449
1449
<pre>
@@ -1534,6 +1534,7 @@ Type Checking</h4>
1534
1534
<<frequency>> ,
1535
1535
<<angle>> ,
1536
1536
<<time>> ,
1537
+ <<percentage>> ,
1537
1538
<<number>> , or
1538
1539
<<integer>> .
1539
1540
The <a>resolved type</a> must be valid for where the expression is placed;
@@ -1545,8 +1546,13 @@ Type Checking</h4>
1545
1546
An ''attr()'' expression's type is given by its <<type-or-unit>> argument.
1546
1547
1547
1548
If percentages are accepted in the context in which the expression is placed,
1548
- a <<percentage-token>> has the type of the value that percentages are relative to;
1549
- otherwise, a math expression containing percentages is invalid.
1549
+ a <<percentage-token>> has the type of the value that percentages are relative to.
1550
+ For example, in the 'width' property, percentages have the <<length>> type,
1551
+ and in 'opacity' they have the <<number>> type.
1552
+ A percentage only has the <<percentage>> type if in that context
1553
+ <<percentage>> values are not used-value compatible with any other type.
1554
+ If percentages are not normally allowed in place of the ''calc()'' ,
1555
+ then a ''calc()'' expression containing percentages is invalid in that context.
1550
1556
1551
1557
Operators form sub-expressions, which gain types based on their arguments.
1552
1558
To make expressions simpler,
@@ -2044,6 +2050,9 @@ Changes</h2>
2044
2050
<li> Added definition of <<ident>> notation to definition of <a>identifiers</a> .
2045
2051
<li> Added <<length-percentage>> as a shorthand for <<length>> | <<percentage>> ,
2046
2052
along with equivalent productions for angles, numbers, times, and frequencies.
2053
+ <li> Allowed <<percentage>> s inside ''calc()'' to resolve as their own type,
2054
+ if they occur in some (as yet theoretical) context
2055
+ where they are not compatible with any other type.
2047
2056
<li> Various clarifications and editorial improvements.
2048
2057
</ul>
2049
2058
0 commit comments