Skip to content

Commit 808c87a

Browse files
committed
[css-typed-om] Fix the type match algo to refer to the percent hint more abstractly.
1 parent c428893 commit 808c87a

File tree

1 file changed

+26
-24
lines changed

1 file changed

+26
-24
lines changed

css-typed-om/Overview.bs

+26-24
Original file line numberDiff line numberDiff line change
@@ -1896,30 +1896,32 @@ and to the CSS [=math functions=].
18961896
3. Return |result|.
18971897
</div>
18981898

1899-
A [=type=] is said to <dfn export for=CSSNumericValue>match</dfn> a CSS production in some circumstances:
1900-
1901-
* A [=type=] matches <<length>>
1902-
if its only non-zero [=map/entry=] is «[ "length" → 1 ]»
1903-
and its [=percent hint=] is null.
1904-
Similarly for <<angle>>, <<time>>, <<frequency>>, <<resolution>>, and <<flex>>.
1905-
* A [=type=] matches <<percentage>>
1906-
if its only non-zero [=map/entry=] is «[ "percent" → 1 ]».
1907-
* A [=type=] matches <<length-percentage>>
1908-
if its only non-zero [=map/entry=] is either «[ "length" → 1 ]» or «[ "percent" → 1 ]»
1909-
Same for <<angle-percentage>>, <<time-percentage>>, etc.
1910-
* A [=type=] matches <<number>>
1911-
if it has no non-zero [=map/entries=]
1912-
and its [=percent hint=] is null.
1913-
* A [=type=] matches <<number-percentage>>
1914-
if it has no non-zero [=map/entries=],
1915-
or its only non-zero [=map/entry=] is «[ "percent" → 1 ]».
1916-
1917-
Many specifications use ''[ <<length>> | <<percentage>> ]''
1918-
instead of ''<<length-percentage>>'' in their grammar,
1919-
and specify in prose that the <<length>> and <<percentage>> can be combined.
1920-
For the purposes of [=CSSNumericValue/matching=],
1921-
these cases should be treated as <<length-percentage>>.
1922-
Similarly for <<angle-percentage>>, etc.
1899+
<div algorithm>
1900+
A [=type=] is said to <dfn export for=CSSNumericValue>match</dfn> a CSS production in some circumstances:
1901+
1902+
* A [=type=] matches <<length>>
1903+
if its only non-zero [=map/entry=] is «[ "length" → 1 ]».
1904+
Similarly for <<angle>>, <<time>>, <<frequency>>, <<resolution>>, and <<flex>>.
1905+
1906+
If the context in which the value is used
1907+
does not allow <<percentage>> values,
1908+
then the [=type=] must additionally have
1909+
a null [=percent hint=]
1910+
to be considered [=CSSNumericValue/matching=].
1911+
* A [=type=] matches <<percentage>>
1912+
if its only non-zero [=map/entry=] is «[ "percent" → 1 ]».
1913+
* A [=type=] matches <<length-percentage>>
1914+
if its only non-zero [=map/entry=] is either «[ "length" → 1 ]» or «[ "percent" → 1 ]».
1915+
Same for <<angle-percentage>>, <<time-percentage>>, etc.
1916+
* A [=type=] matches <<number>>
1917+
if it has no non-zero [=map/entries=].
1918+
1919+
If the context in which the value is used
1920+
does not allow <<percentage>> values,
1921+
then the [=type=] must additionally have
1922+
a null [=percent hint=]
1923+
to be considered [=CSSNumericValue/matching=].
1924+
</div>
19231925

19241926
Note: [=Types=] form a semi-group under both addition
19251927
and a monoid under multiplication

0 commit comments

Comments
 (0)