diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp index e53ea3efdf..379f40cbd3 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -6005,23 +6005,24 @@ ErrorOr> Parser::parse_text_decoration_value(Vector decoration_style; RefPtr decoration_color; + auto remaining_longhands = Vector { PropertyID::TextDecorationColor, PropertyID::TextDecorationLine, PropertyID::TextDecorationStyle, PropertyID::TextDecorationThickness }; + auto tokens = TokenStream { component_values }; - while (tokens.has_next_token()) { - auto const& part = tokens.next_token(); - auto value = TRY(parse_css_value(part)); - if (!value) + auto property_and_value = TRY(parse_css_value_for_properties(remaining_longhands, tokens)); + if (!property_and_value.style_value) return nullptr; + auto& value = property_and_value.style_value; + remove_property(remaining_longhands, property_and_value.property); - if (property_accepts_value(PropertyID::TextDecorationColor, *value)) { - if (decoration_color) - return nullptr; + switch (property_and_value.property) { + case PropertyID::TextDecorationColor: { + VERIFY(!decoration_color); decoration_color = value.release_nonnull(); continue; } - if (property_accepts_value(PropertyID::TextDecorationLine, *value)) { - if (decoration_line) - return nullptr; + case PropertyID::TextDecorationLine: { + VERIFY(!decoration_line); tokens.reconsume_current_input_token(); auto parsed_decoration_line = TRY(parse_text_decoration_line_value(tokens)); if (!parsed_decoration_line) @@ -6029,20 +6030,19 @@ ErrorOr> Parser::parse_text_decoration_value(Vector