@@ -1604,8 +1604,7 @@ Mathematical Expressions: ''calc()'', ''min()'', and ''max()''</h3>
1604
1604
<<angle>> ,
1605
1605
<<time>> ,
1606
1606
<<percentage>> ,
1607
- <<number>> , or
1608
- <<integer>>
1607
+ or <<number>>
1609
1608
values are allowed.
1610
1609
Components of a [=math function=] can be literal values,
1611
1610
other [=math functions=] ,
@@ -1698,42 +1697,24 @@ Syntax</h4>
1698
1697
<h4 id='calc-type-checking'>
1699
1698
Type Checking</h4>
1700
1699
1701
- A [=math function=] has a <dfn>resolved type</dfn> , which is one of
1702
- <<length>> ,
1703
- <<frequency>> ,
1704
- <<angle>> ,
1705
- <<time>> ,
1706
- <<percentage>> ,
1707
- or <<number>> .
1708
- It can be used anywhere its [=resolved type=] is allowed.
1700
+ A [=math function=] can be many possible types,
1701
+ such as <<length>> , <<number>> , etc.,
1702
+ depending on the expression it contains,
1703
+ as defined in [[#type-checking-exprs]] .
1704
+ It can be used anywhere a value of that type is allowed.
1705
+
1706
+ <div class=example>
1707
+ For example, the 'width' property accepts <<length>> values,
1708
+ so a [=math function=] that resolves to a <<length>> ,
1709
+ such as ''calc(5px + 1em)'' ,
1710
+ can be used in 'width' .
1711
+ </div>
1709
1712
1710
- Additionally, [=math function=] whose [=resolved type=] is <<number>>
1713
+ Additionally, [=math function=] that resolve to <<number>>
1711
1714
can be used in any place that only accepts <<integer>> .
1712
1715
(It gets rounded to the nearest integer,
1713
1716
as specified in [[#calc-range]] .)
1714
1717
1715
- The <a>resolved type</a> must be valid for where the [=math function=] is placed;
1716
- otherwise, the expression is invalid.
1717
-
1718
- The <a>resolved type</a> of a [=math function=] is determined by the values and calculations it contains:
1719
-
1720
- * <<number-token>> s are of type <<number>> or <<integer>> .
1721
- * A <<dimension-token>> ’s type is given by its unit
1722
- (''cm'' is <<length>> , ''deg'' is <<angle>> , etc.).
1723
- * Functions’ types are defined by their specification
1724
- (nested ''calc()'' has its type determined by its own contents,
1725
- ''attr()'' ’s type is determined by its <<type-or-unit>> argument,
1726
- etc).
1727
- * Larger calculations’ types are determined by the types of their arguments
1728
- and the rules for their operation,
1729
- as defined below.
1730
-
1731
- A ''calc()'' expression's <a>resolved type</a> is the <a>resolved type</a> of the calculation it contains.
1732
- The <a>resolved type</a> of a ''min()'' or ''max()'' expression
1733
- is the <a>resolved type</a> of any of the calculations it contains.
1734
- If a ''min()'' or ''max()'' expression's arguments have different <a>resolved types</a> ,
1735
- the expression is invalid.
1736
-
1737
1718
Note: Because <<number-token>> s are always interpreted as <<number>> s or <<integer>> s,
1738
1719
"unitless 0" <<length>> s aren't supported in [=math functions=] .
1739
1720
That is, ''width: calc(0 + 5px);'' is invalid,
@@ -1929,7 +1910,7 @@ Range Checking</h4>
1929
1910
Note: This requires all contexts accepting ''calc()''
1930
1911
to define their allowable values as a closed (not open) interval.
1931
1912
1932
- Additionally, if a [=math function=] whose [=resolved type=] is <<number>>
1913
+ Additionally, if a [=math function=] that resolves to <<number>>
1933
1914
is used somewhere that only accepts <<integer>> ,
1934
1915
the [=computed value=] and [=used value=] are rounded to the nearest integer,
1935
1916
in the same manner as clamping, above.
0 commit comments