1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 07:17:35 +00:00

LibWeb: Use new StyleValue parsing for text-decoration-line

This commit is contained in:
Sam Atkins 2023-05-24 17:24:51 +01:00 committed by Andreas Kling
parent a7a61c4cd9
commit a473f6074d

View file

@ -6062,32 +6062,23 @@ ErrorOr<RefPtr<StyleValue>> Parser::parse_text_decoration_line_value(TokenStream
StyleValueVector style_values; StyleValueVector style_values;
while (tokens.has_next_token()) { while (tokens.has_next_token()) {
auto const& token = tokens.next_token(); auto maybe_value = TRY(parse_css_value_for_property(PropertyID::TextDecorationLine, tokens));
auto maybe_value = TRY(parse_css_value(token)); if (!maybe_value)
if (!maybe_value || !property_accepts_value(PropertyID::TextDecorationLine, *maybe_value)) {
tokens.reconsume_current_input_token();
break; break;
}
auto value = maybe_value.release_nonnull(); auto value = maybe_value.release_nonnull();
if (auto maybe_line = value_id_to_text_decoration_line(value->to_identifier()); maybe_line.has_value()) { if (auto maybe_line = value_id_to_text_decoration_line(value->to_identifier()); maybe_line.has_value()) {
auto line = maybe_line.release_value(); if (maybe_line == TextDecorationLine::None) {
if (line == TextDecorationLine::None) { if (!style_values.is_empty())
if (!style_values.is_empty()) {
tokens.reconsume_current_input_token();
break; break;
}
return value; return value;
} }
if (style_values.contains_slow(value)) { if (style_values.contains_slow(value))
tokens.reconsume_current_input_token();
break; break;
} TRY(style_values.try_append(move(value)));
style_values.append(move(value));
continue; continue;
} }
tokens.reconsume_current_input_token();
break; break;
} }