mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:27:45 +00:00
LibWeb: Use new StyleValue parsing for text-decoration
This commit is contained in:
parent
a473f6074d
commit
f759a16087
1 changed files with 18 additions and 18 deletions
|
@ -6005,23 +6005,24 @@ ErrorOr<RefPtr<StyleValue>> Parser::parse_text_decoration_value(Vector<Component
|
||||||
RefPtr<StyleValue> decoration_style;
|
RefPtr<StyleValue> decoration_style;
|
||||||
RefPtr<StyleValue> decoration_color;
|
RefPtr<StyleValue> decoration_color;
|
||||||
|
|
||||||
|
auto remaining_longhands = Vector { PropertyID::TextDecorationColor, PropertyID::TextDecorationLine, PropertyID::TextDecorationStyle, PropertyID::TextDecorationThickness };
|
||||||
|
|
||||||
auto tokens = TokenStream { component_values };
|
auto tokens = TokenStream { component_values };
|
||||||
|
|
||||||
while (tokens.has_next_token()) {
|
while (tokens.has_next_token()) {
|
||||||
auto const& part = tokens.next_token();
|
auto property_and_value = TRY(parse_css_value_for_properties(remaining_longhands, tokens));
|
||||||
auto value = TRY(parse_css_value(part));
|
if (!property_and_value.style_value)
|
||||||
if (!value)
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
auto& value = property_and_value.style_value;
|
||||||
|
remove_property(remaining_longhands, property_and_value.property);
|
||||||
|
|
||||||
if (property_accepts_value(PropertyID::TextDecorationColor, *value)) {
|
switch (property_and_value.property) {
|
||||||
if (decoration_color)
|
case PropertyID::TextDecorationColor: {
|
||||||
return nullptr;
|
VERIFY(!decoration_color);
|
||||||
decoration_color = value.release_nonnull();
|
decoration_color = value.release_nonnull();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (property_accepts_value(PropertyID::TextDecorationLine, *value)) {
|
case PropertyID::TextDecorationLine: {
|
||||||
if (decoration_line)
|
VERIFY(!decoration_line);
|
||||||
return nullptr;
|
|
||||||
tokens.reconsume_current_input_token();
|
tokens.reconsume_current_input_token();
|
||||||
auto parsed_decoration_line = TRY(parse_text_decoration_line_value(tokens));
|
auto parsed_decoration_line = TRY(parse_text_decoration_line_value(tokens));
|
||||||
if (!parsed_decoration_line)
|
if (!parsed_decoration_line)
|
||||||
|
@ -6029,20 +6030,19 @@ ErrorOr<RefPtr<StyleValue>> Parser::parse_text_decoration_value(Vector<Component
|
||||||
decoration_line = parsed_decoration_line.release_nonnull();
|
decoration_line = parsed_decoration_line.release_nonnull();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (property_accepts_value(PropertyID::TextDecorationThickness, *value)) {
|
case PropertyID::TextDecorationThickness: {
|
||||||
if (decoration_thickness)
|
VERIFY(!decoration_thickness);
|
||||||
return nullptr;
|
|
||||||
decoration_thickness = value.release_nonnull();
|
decoration_thickness = value.release_nonnull();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (property_accepts_value(PropertyID::TextDecorationStyle, *value)) {
|
case PropertyID::TextDecorationStyle: {
|
||||||
if (decoration_style)
|
VERIFY(!decoration_style);
|
||||||
return nullptr;
|
|
||||||
decoration_style = value.release_nonnull();
|
decoration_style = value.release_nonnull();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
return nullptr;
|
VERIFY_NOT_REACHED();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!decoration_line)
|
if (!decoration_line)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue