Skip to content

Commit d384226

Browse files
committed
[css-typed-om] Tweak the validity of matching when you have a percent hint to be more correct. w3c/csswg-drafts#10763
1 parent 368daf9 commit d384226

File tree

1 file changed

+29
-11
lines changed

1 file changed

+29
-11
lines changed

css-typed-om/Overview.bs

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1959,26 +1959,44 @@ and to the CSS [=math functions=].
19591959
Similarly for <<angle>>, <<time>>, <<frequency>>, <<resolution>>, and <<flex>>.
19601960

19611961
If the context in which the value is used
1962-
does not allow <<percentage>> values,
1963-
then the [=type=] must additionally have
1964-
a null [=percent hint=]
1965-
to be considered [=CSSNumericValue/matching=].
1962+
allows <<percentage>> values,
1963+
and those percentages are resolved against another type,
1964+
then for the [=type=] to be considered [=CSSNumericValue/matching=]
1965+
it must either have a null [=percent hint=],
1966+
or the [=percent hint=] must match the other type.
1967+
1968+
If the context does <em>not</em> allow <<percentage>> values
1969+
to be mixed with <<length>>/etc values
1970+
(or doesn't allow <<percentage>> values at all,
1971+
such as 'border-width'),
1972+
then for the [=type=] to be considered [=CSSNumericValue/matching=]
1973+
the [=percent hint=] must be null.
1974+
19661975
* A [=type=] matches <<percentage>>
1967-
if its only non-zero [=map/entry=] is «[ "percent" → 1 ]».
1976+
if its only non-zero [=map/entry=] is «[ "percent" → 1 ]»,
1977+
and it has a null [=percent hint=].
19681978
* A [=type=] matches <<length-percentage>>
1969-
if its only non-zero [=map/entry=] is either «[ "length" → 1 ]» or «[ "percent" → 1 ]».
1979+
if it matches <<length>> or matches <<percentage>>.
19701980
Same for <<angle-percentage>>, <<time-percentage>>, etc.
19711981
* A [=type=] matches <<number>>
19721982
if it has no non-zero [=map/entries=].
19731983

19741984
If the context in which the value is used
1975-
does not allow <<percentage>> values,
1976-
then the [=type=] must additionally have
1977-
a null [=percent hint=]
1978-
to be considered [=CSSNumericValue/matching=].
1985+
allows <<percentage>> values,
1986+
and those percentages are resolved against another type,
1987+
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.
1990+
1991+
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'),
1995+
then for the [=type=] to be considered [=CSSNumericValue/matching=]
1996+
the [=percent hint=] must be null.
19791997
</div>
19801998

1981-
Note: [=Types=] form a semi-group under both addition
1999+
Note: [=Types=] form a semi-group under addition,
19822000
and a monoid under multiplication
19832001
(with the multiplicative identity being «[ ]» with a null [=percent hint=]),
19842002
meaning that they're associative and commutative.

0 commit comments

Comments
 (0)