@@ -1792,12 +1792,20 @@ The <dfn export for=CSSNumericValue lt="base type">base types</dfn> are
17921792and "percent".
17931793The ordering of a [=type=] ’s entries always matches this [=base type=] ordering.
17941794The <dfn export for=CSSNumericValue>percent hint</dfn>
1795- is either null or a [=base type=] other than "percent" .
1795+ is either null or a [=base type=] .
17961796
17971797Note: As new unit types are added to CSS,
17981798they'll be added to this list of [=base types=] ,
17991799and to the CSS [=math functions=] .
18001800
1801+ Note: A [=percent hint=] can be "percent",
1802+ indicating the percentage is used as itself
1803+ (or, equivalently, evaluated against a plain number),
1804+ but this is not produced by the Typed OM methods;
1805+ it only occurs when the type machinery
1806+ is used directly by CSS,
1807+ where a value's context is actually known.
1808+
18011809<div algorithm>
18021810 To <dfn export for="CSSNumericValue" lt="create a type|creating a type">create a type</dfn> from a string |unit|,
18031811 follow the appropriate branch of the following:
@@ -1898,13 +1906,17 @@ and to the CSS [=math functions=].
18981906</div>
18991907
19001908<div algorithm>
1901- To <dfn export>apply the percent hint</dfn> |hint| to a |type|,
1909+ To <dfn export>apply the percent hint</dfn> |hint|
1910+ to a |type| without a [=percent hint=] ,
19021911 perform the following steps:
19031912
1904- 1. If |type| doesn't [=map/contain=] |hint|, set |type|[|hint|] to 0.
1905- 2. If |type| [=map/contains=] "percent", add |type|["percent"] to |type|[|hint|] ,
1913+ 1. Set |type|’s [=percent hint=] to |hint|,
1914+ 2. If |type| doesn't [=map/contain=] |hint|, set |type|[|hint|] to 0.
1915+ 3. If |hint| is anything other than "percent",
1916+ and |type| [=map/contains=] "percent",
1917+ add |type|["percent"] to |type|[|hint|] ,
19061918 then set |type|["percent"] to 0.
1907- 4. Set |type|’s [=percent hint=] to |hint |.
1919+ 4. Return |type|.
19081920</div>
19091921
19101922<div algorithm>
@@ -1974,24 +1986,29 @@ and to the CSS [=math functions=].
19741986
19751987 * A [=type=] matches <<percentage>>
19761988 if its only non-zero [=map/entry=] is «[ "percent" → 1 ] »,
1977- and it has a null [=percent hint=] .
1989+ and its [=percent hint=] is either null or "percent".
1990+
19781991 * A [=type=] matches <<length-percentage>>
19791992 if it matches <<length>> or matches <<percentage>> .
19801993 Same for <<angle-percentage>> , <<time-percentage>> , etc.
1994+
19811995 * A [=type=] matches <<number>>
19821996 if it has no non-zero [=map/entries=] .
19831997
19841998 If the context in which the value is used
19851999 allows <<percentage>> values,
1986- and those percentages are resolved against another type,
2000+ and those percentages are resolved against a type other than <<number>> ,
19872001 then for the [=type=] to be considered [=CSSNumericValue/matching=]
1988- it must either have a null [=percent hint=] ,
1989- or the [=percent hint=] must match the other type.
2002+ the [=percent hint=] must either be null
2003+ or match the other type.
2004+
2005+ If the context allows <<percentage>> values,
2006+ but either doesn't resolve them against another type
2007+ or resolves them against a <<number>> ,
2008+ then for the [=type=] to be considered [=CSSNumericValue/matching=]
2009+ the [=percent hint=] must either be null or "percent".
19902010
19912011 If the context does <em> not</em> allow <<percentage>> values,
1992- or allows them but does not resolve them against another type
1993- (or treats them equivalent to a <<number>> ,
1994- such as in 'opacity' ),
19952012 then for the [=type=] to be considered [=CSSNumericValue/matching=]
19962013 the [=percent hint=] must be null.
19972014</div>
0 commit comments