LibWeb: Reject non-exclusive none in text-decoration-line

This updates the `parse_text_decoration_line_value` to reject values
which non-exclusively include `none` e.g. `underline none`.

It also simplifies handling by always producing a Vector (except for
`none`) and adding VERIFY_NOT_REACHED in more places which shouldn't be
reachable.
This commit is contained in:
Callum Law 2025-11-13 17:25:00 +13:00 committed by Jelle Raaijmakers
parent 5c0fdd371a
commit d6bb247bf7
Notes: github-actions[bot] 2025-11-13 09:16:20 +00:00
4 changed files with 20 additions and 13 deletions

View file

@ -4691,7 +4691,7 @@ RefPtr<StyleValue const> Parser::parse_text_decoration_line_value(TokenStream<Co
if (auto maybe_line = keyword_to_text_decoration_line(value->to_keyword()); maybe_line.has_value()) {
if (maybe_line == TextDecorationLine::None) {
if (!style_values.is_empty())
break;
return nullptr;
return value;
}
if (first_is_one_of(*maybe_line, TextDecorationLine::SpellingError, TextDecorationLine::GrammarError)) {
@ -4703,7 +4703,7 @@ RefPtr<StyleValue const> Parser::parse_text_decoration_line_value(TokenStream<Co
continue;
}
break;
VERIFY_NOT_REACHED();
}
if (style_values.is_empty())
@ -4713,9 +4713,6 @@ RefPtr<StyleValue const> Parser::parse_text_decoration_line_value(TokenStream<Co
if (style_values.size() > 1 && includes_spelling_or_grammar_error_value)
return nullptr;
if (style_values.size() == 1)
return *style_values.first();
quick_sort(style_values, [](auto& left, auto& right) {
return *keyword_to_text_decoration_line(left->to_keyword()) < *keyword_to_text_decoration_line(right->to_keyword());
});