@@ -883,11 +883,12 @@ <h3 id="calc-notation">
883883 as component values. The ''calc()'' expression represents the result of the
884884 mathematical calculation it contains, using standard operator precedence
885885 rules. It can be used wherever
886- < code > <length></ code > ,
887- < code > <frequency></ code > ,
888- < code > <angle></ code > ,
889- < code > <time></ code > , or
890- < code > <number></ code >
886+ < var > <length></ var > ,
887+ < var > <frequency></ var > ,
888+ < var > <angle></ var > ,
889+ < var > <time></ var > ,
890+ < var > <number></ var > , or
891+ < var > <integer> </ var >
891892 values are allowed.</ p >
892893
893894 < p >
@@ -1006,18 +1007,24 @@ <h4 id='calc-syntax'>
10061007< h4 id ='calc-type-checking '>
10071008Type Checking</ h4 >
10081009
1009- < p > A math expression has a < dfn > resolved type</ dfn > , which is one of
1010- < var > <length> </ var > , < var > <frequency> </ var > , < var > <angle> </ var > , < var > <time> </ var > , or
1011- < var > <number> </ var > . The < i > resolved type</ i > must be valid for where the
1012- expression is placed; otherwise, the expression is invalid.
1013- The < i > resolved type</ i > of the expression is determined by the
1014- types of the values it contains. < code > NUMBER</ code > tokens
1015- are of type < var > <number> </ var > . A < code > DIMENSION</ code > token's type is given
1016- by its unit (''cm'' is < var > <length> </ var > , ''deg'' is < var > <angle> </ var > , etc.).
1017- If percentages are accepted in the context in which the expression
1018- is placed, a < code > PERCENTAGE</ code > token has the type of the value that
1019- percentages are relative to; otherwise, a math expression containing
1020- percentages is invalid.</ p >
1010+ < p >
1011+ A math expression has a < dfn > resolved type</ dfn > , which is one of
1012+ < var > <length> </ var > ,
1013+ < var > <frequency> </ var > ,
1014+ < var > <angle> </ var > ,
1015+ < var > <time> </ var > ,
1016+ < var > <number> </ var > , or
1017+ < var > <integer> </ var > .
1018+ The < i > resolved type</ i > must be valid for where the expression is placed;
1019+ otherwise, the expression is invalid.
1020+ The < i > resolved type</ i > of the expression is determined by the types of the values it contains.
1021+ < code > NUMBER</ code > tokens are of type < var > <number> </ var > .
1022+ A < code > DIMENSION</ code > token's type is given by its unit
1023+ (''cm'' is < var > <length> </ var > , ''deg'' is < var > <angle> </ var > , etc.).
1024+ If percentages are accepted in the context in which the expression is placed,
1025+ a < code > PERCENTAGE</ code > token has the type of the value that percentages are relative to;
1026+ otherwise,
1027+ a math expression containing percentages is invalid.</ p >
10211028
10221029 < p > Operators form sub-expressions, which gain types based on their arguments.
10231030 To make expressions simpler, operators have restrictions on the
@@ -1043,6 +1050,12 @@ <h4 id='calc-type-checking'>
10431050 (as purely-numeric expressions can be evaluated without any additional
10441051 information at parse time).</ p >
10451052
1053+ < p >
1054+ If the type of the result,
1055+ after resolving all subexpressions,
1056+ is an integral < code > <number> </ code > ,
1057+ the calc()'s resolved type is < code > <integer> </ code > .
1058+
10461059< h4 id ='calc-range '>
10471060Range Checking</ h4 >
10481061
0 commit comments