LibWeb/CSS: Take custom-ident blacklist as a Span

Using std::initializer_list here was a bit of a hack, and makes it
awkward to pass those blacklists around.
This commit is contained in:
Sam Atkins 2025-02-25 11:46:52 +00:00
parent 9585c6c0c7
commit c6c607884b
Notes: github-actions[bot] 2025-02-26 11:24:19 +00:00
3 changed files with 7 additions and 7 deletions

View file

@ -1796,7 +1796,7 @@ RefPtr<CSSStyleValue> Parser::parse_counter_value(TokenStream<ComponentValue>& t
auto transaction = tokens.begin_transaction();
tokens.discard_whitespace();
auto counter_name = parse_custom_ident_value(tokens, { "none"sv });
auto counter_name = parse_custom_ident_value(tokens, { { "none"sv } });
if (!counter_name)
return {};
@ -1817,7 +1817,7 @@ RefPtr<CSSStyleValue> Parser::parse_counter_value(TokenStream<ComponentValue>& t
auto transaction = tokens.begin_transaction();
tokens.discard_whitespace();
auto counter_style_name = parse_custom_ident_value(tokens, { "none"sv });
auto counter_style_name = parse_custom_ident_value(tokens, { { "none"sv } });
if (!counter_style_name)
return {};
@ -2812,7 +2812,7 @@ RefPtr<CSSStyleValue> Parser::parse_builtin_value(TokenStream<ComponentValue>& t
}
// https://www.w3.org/TR/css-values-4/#custom-idents
RefPtr<CustomIdentStyleValue> Parser::parse_custom_ident_value(TokenStream<ComponentValue>& tokens, std::initializer_list<StringView> blacklist)
RefPtr<CustomIdentStyleValue> Parser::parse_custom_ident_value(TokenStream<ComponentValue>& tokens, ReadonlySpan<StringView> blacklist)
{
auto transaction = tokens.begin_transaction();
tokens.discard_whitespace();
@ -3096,7 +3096,7 @@ RefPtr<GridTrackPlacementStyleValue> Parser::parse_grid_track_placement(TokenStr
};
auto parse_custom_ident = [this](auto& tokens) {
// The <custom-ident> additionally excludes the keywords span and auto.
return parse_custom_ident_value(tokens, { "span"sv, "auto"sv });
return parse_custom_ident_value(tokens, { { "span"sv, "auto"sv } });
};
auto transaction = tokens.begin_transaction();