mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 03:37:43 +00:00
LibWeb: Parse text-decoration property using TokenStream
This commit is contained in:
parent
513dee04d4
commit
ed77dee405
2 changed files with 5 additions and 4 deletions
|
@ -4617,7 +4617,7 @@ RefPtr<StyleValue> Parser::parse_quotes_value(TokenStream<ComponentValue>& token
|
||||||
return StyleValueList::create(move(string_values), StyleValueList::Separator::Space);
|
return StyleValueList::create(move(string_values), StyleValueList::Separator::Space);
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<StyleValue> Parser::parse_text_decoration_value(Vector<ComponentValue> const& component_values)
|
RefPtr<StyleValue> Parser::parse_text_decoration_value(TokenStream<ComponentValue>& tokens)
|
||||||
{
|
{
|
||||||
RefPtr<StyleValue> decoration_line;
|
RefPtr<StyleValue> decoration_line;
|
||||||
RefPtr<StyleValue> decoration_thickness;
|
RefPtr<StyleValue> decoration_thickness;
|
||||||
|
@ -4626,7 +4626,7 @@ RefPtr<StyleValue> Parser::parse_text_decoration_value(Vector<ComponentValue> co
|
||||||
|
|
||||||
auto remaining_longhands = Vector { PropertyID::TextDecorationColor, PropertyID::TextDecorationLine, PropertyID::TextDecorationStyle, PropertyID::TextDecorationThickness };
|
auto remaining_longhands = Vector { PropertyID::TextDecorationColor, PropertyID::TextDecorationLine, PropertyID::TextDecorationStyle, PropertyID::TextDecorationThickness };
|
||||||
|
|
||||||
auto tokens = TokenStream { component_values };
|
auto transaction = tokens.begin_transaction();
|
||||||
while (tokens.has_next_token()) {
|
while (tokens.has_next_token()) {
|
||||||
auto property_and_value = parse_css_value_for_properties(remaining_longhands, tokens);
|
auto property_and_value = parse_css_value_for_properties(remaining_longhands, tokens);
|
||||||
if (!property_and_value.has_value())
|
if (!property_and_value.has_value())
|
||||||
|
@ -4673,6 +4673,7 @@ RefPtr<StyleValue> Parser::parse_text_decoration_value(Vector<ComponentValue> co
|
||||||
if (!decoration_color)
|
if (!decoration_color)
|
||||||
decoration_color = property_initial_value(m_context.realm(), PropertyID::TextDecorationColor);
|
decoration_color = property_initial_value(m_context.realm(), PropertyID::TextDecorationColor);
|
||||||
|
|
||||||
|
transaction.commit();
|
||||||
return ShorthandStyleValue::create(PropertyID::TextDecoration,
|
return ShorthandStyleValue::create(PropertyID::TextDecoration,
|
||||||
{ PropertyID::TextDecorationLine, PropertyID::TextDecorationThickness, PropertyID::TextDecorationStyle, PropertyID::TextDecorationColor },
|
{ PropertyID::TextDecorationLine, PropertyID::TextDecorationThickness, PropertyID::TextDecorationStyle, PropertyID::TextDecorationColor },
|
||||||
{ decoration_line.release_nonnull(), decoration_thickness.release_nonnull(), decoration_style.release_nonnull(), decoration_color.release_nonnull() });
|
{ decoration_line.release_nonnull(), decoration_thickness.release_nonnull(), decoration_style.release_nonnull(), decoration_color.release_nonnull() });
|
||||||
|
@ -5931,7 +5932,7 @@ Parser::ParseErrorOr<NonnullRefPtr<StyleValue>> Parser::parse_css_value(Property
|
||||||
return parsed_value.release_nonnull();
|
return parsed_value.release_nonnull();
|
||||||
return ParseError::SyntaxError;
|
return ParseError::SyntaxError;
|
||||||
case PropertyID::TextDecoration:
|
case PropertyID::TextDecoration:
|
||||||
if (auto parsed_value = parse_text_decoration_value(component_values))
|
if (auto parsed_value = parse_text_decoration_value(tokens); parsed_value && !tokens.has_next_token())
|
||||||
return parsed_value.release_nonnull();
|
return parsed_value.release_nonnull();
|
||||||
return ParseError::SyntaxError;
|
return ParseError::SyntaxError;
|
||||||
case PropertyID::TextDecorationLine: {
|
case PropertyID::TextDecorationLine: {
|
||||||
|
|
|
@ -253,7 +253,7 @@ private:
|
||||||
};
|
};
|
||||||
RefPtr<StyleValue> parse_shadow_value(TokenStream<ComponentValue>&, AllowInsetKeyword);
|
RefPtr<StyleValue> parse_shadow_value(TokenStream<ComponentValue>&, AllowInsetKeyword);
|
||||||
RefPtr<StyleValue> parse_single_shadow_value(TokenStream<ComponentValue>&, AllowInsetKeyword);
|
RefPtr<StyleValue> parse_single_shadow_value(TokenStream<ComponentValue>&, AllowInsetKeyword);
|
||||||
RefPtr<StyleValue> parse_text_decoration_value(Vector<ComponentValue> const&);
|
RefPtr<StyleValue> parse_text_decoration_value(TokenStream<ComponentValue>&);
|
||||||
RefPtr<StyleValue> parse_text_decoration_line_value(TokenStream<ComponentValue>&);
|
RefPtr<StyleValue> parse_text_decoration_line_value(TokenStream<ComponentValue>&);
|
||||||
RefPtr<StyleValue> parse_easing_value(TokenStream<ComponentValue>&);
|
RefPtr<StyleValue> parse_easing_value(TokenStream<ComponentValue>&);
|
||||||
RefPtr<StyleValue> parse_transform_value(Vector<ComponentValue> const&);
|
RefPtr<StyleValue> parse_transform_value(Vector<ComponentValue> const&);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue