LibWeb: Support strings as list-style-types

We've long claimed to support this, but then silently ignored string
values, until 4cb2063577 which would
not-so-silently crash instead. (Oops)

So, actually pass the string value along and use it in the list marker.

As part of this, rename our `list-style-type` enum to
`counter-style-name-keyword`. This is an awkward name, attempting to be
spec-based. (The spec says `<counter-style>`, which is either a
`<counter-style-name>` or a function, and the `<counter-style-name>` is
a `<custom-ident>` that also has a few predefined values. So this is the
best I could come up with.)

Unfortunately only one WPT test for this passes - the others fail
because we produce a different layout when text is in `::before` than
when it's in `::marker`, and similar issues.
This commit is contained in:
Sam Atkins 2025-02-10 12:48:40 +00:00 committed by Andreas Kling
commit 0fd0596dbf
Notes: github-actions[bot] 2025-02-11 09:40:22 +00:00
10 changed files with 201 additions and 132 deletions

View file

@ -1008,7 +1008,9 @@ TextTransform ComputedProperties::text_transform() const
ListStyleType ComputedProperties::list_style_type() const
{
auto const& value = property(PropertyID::ListStyleType);
return keyword_to_list_style_type(value.to_keyword()).release_value();
if (value.is_string())
return value.as_string().string_value().to_string();
return keyword_to_counter_style_name_keyword(value.to_keyword()).release_value();
}
ListStylePosition ComputedProperties::list_style_position() const