LibWeb/CSS: Un-template parse_comma_separated_value_list()

This doesn't need to be a template. Changing it means we can use it from
any FooParsing.cpp file, and also move it ValueParsing.cpp where it
belongs.
This commit is contained in:
Sam Atkins 2025-04-02 16:32:49 +01:00
parent fd4f4f425d
commit 79093291b5
Notes: github-actions[bot] 2025-04-04 09:42:24 +00:00
3 changed files with 25 additions and 25 deletions

View file

@ -80,30 +80,6 @@ RefPtr<CSSStyleValue> Parser::parse_all_as_single_keyword_value(TokenStream<Comp
return keyword_value;
}
template<typename ParseFunction>
RefPtr<CSSStyleValue> Parser::parse_comma_separated_value_list(TokenStream<ComponentValue>& tokens, ParseFunction parse_one_value)
{
auto first = parse_one_value(tokens);
if (!first || !tokens.has_next_token())
return first;
StyleValueVector values;
values.append(first.release_nonnull());
while (tokens.has_next_token()) {
if (!tokens.consume_a_token().is(Token::Type::Comma))
return nullptr;
if (auto maybe_value = parse_one_value(tokens)) {
values.append(maybe_value.release_nonnull());
continue;
}
return nullptr;
}
return StyleValueList::create(move(values), StyleValueList::Separator::Comma);
}
RefPtr<CSSStyleValue> Parser::parse_simple_comma_separated_value_list(PropertyID property_id, TokenStream<ComponentValue>& tokens)
{
return parse_comma_separated_value_list(tokens, [this, property_id](auto& tokens) -> RefPtr<CSSStyleValue> {