mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:57:35 +00:00
LibWeb: Parse shadow values using TokenStream
This commit is contained in:
parent
3a36b2eea9
commit
4f3136c230
2 changed files with 4 additions and 6 deletions
|
@ -3316,10 +3316,8 @@ RefPtr<StyleValue> Parser::parse_border_radius_shorthand_value(TokenStream<Compo
|
||||||
{ move(top_left_radius), move(top_right_radius), move(bottom_right_radius), move(bottom_left_radius) });
|
{ move(top_left_radius), move(top_right_radius), move(bottom_right_radius), move(bottom_left_radius) });
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<StyleValue> Parser::parse_shadow_value(Vector<ComponentValue> const& component_values, AllowInsetKeyword allow_inset_keyword)
|
RefPtr<StyleValue> Parser::parse_shadow_value(TokenStream<ComponentValue>& tokens, AllowInsetKeyword allow_inset_keyword)
|
||||||
{
|
{
|
||||||
TokenStream tokens { component_values };
|
|
||||||
|
|
||||||
// "none"
|
// "none"
|
||||||
if (contains_single_none_ident(tokens))
|
if (contains_single_none_ident(tokens))
|
||||||
return parse_identifier_value(tokens.next_token());
|
return parse_identifier_value(tokens.next_token());
|
||||||
|
@ -5792,7 +5790,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::BoxShadow:
|
case PropertyID::BoxShadow:
|
||||||
if (auto parsed_value = parse_shadow_value(component_values, AllowInsetKeyword::Yes))
|
if (auto parsed_value = parse_shadow_value(tokens, AllowInsetKeyword::Yes); parsed_value && !tokens.has_next_token())
|
||||||
return parsed_value.release_nonnull();
|
return parsed_value.release_nonnull();
|
||||||
return ParseError::SyntaxError;
|
return ParseError::SyntaxError;
|
||||||
case PropertyID::Content:
|
case PropertyID::Content:
|
||||||
|
@ -5920,7 +5918,7 @@ Parser::ParseErrorOr<NonnullRefPtr<StyleValue>> Parser::parse_css_value(Property
|
||||||
return ParseError::SyntaxError;
|
return ParseError::SyntaxError;
|
||||||
}
|
}
|
||||||
case PropertyID::TextShadow:
|
case PropertyID::TextShadow:
|
||||||
if (auto parsed_value = parse_shadow_value(component_values, AllowInsetKeyword::No))
|
if (auto parsed_value = parse_shadow_value(tokens, AllowInsetKeyword::No); parsed_value && !tokens.has_next_token())
|
||||||
return parsed_value.release_nonnull();
|
return parsed_value.release_nonnull();
|
||||||
return ParseError::SyntaxError;
|
return ParseError::SyntaxError;
|
||||||
case PropertyID::Transform:
|
case PropertyID::Transform:
|
||||||
|
|
|
@ -251,7 +251,7 @@ private:
|
||||||
No,
|
No,
|
||||||
Yes,
|
Yes,
|
||||||
};
|
};
|
||||||
RefPtr<StyleValue> parse_shadow_value(Vector<ComponentValue> const&, 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(Vector<ComponentValue> const&);
|
||||||
RefPtr<StyleValue> parse_text_decoration_line_value(TokenStream<ComponentValue>&);
|
RefPtr<StyleValue> parse_text_decoration_line_value(TokenStream<ComponentValue>&);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue