Skip to content

Commit 4f3136c

Browse files
committed
LibWeb: Parse shadow values using TokenStream
1 parent 3a36b2e commit 4f3136c

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3316,10 +3316,8 @@ RefPtr<StyleValue> Parser::parse_border_radius_shorthand_value(TokenStream<Compo
33163316
{ move(top_left_radius), move(top_right_radius), move(bottom_right_radius), move(bottom_left_radius) });
33173317
}
33183318

3319-
RefPtr<StyleValue> Parser::parse_shadow_value(Vector<ComponentValue> const& component_values, AllowInsetKeyword allow_inset_keyword)
3319+
RefPtr<StyleValue> Parser::parse_shadow_value(TokenStream<ComponentValue>& tokens, AllowInsetKeyword allow_inset_keyword)
33203320
{
3321-
TokenStream tokens { component_values };
3322-
33233321
// "none"
33243322
if (contains_single_none_ident(tokens))
33253323
return parse_identifier_value(tokens.next_token());
@@ -5792,7 +5790,7 @@ Parser::ParseErrorOr<NonnullRefPtr<StyleValue>> Parser::parse_css_value(Property
57925790
return parsed_value.release_nonnull();
57935791
return ParseError::SyntaxError;
57945792
case PropertyID::BoxShadow:
5795-
if (auto parsed_value = parse_shadow_value(component_values, AllowInsetKeyword::Yes))
5793+
if (auto parsed_value = parse_shadow_value(tokens, AllowInsetKeyword::Yes); parsed_value && !tokens.has_next_token())
57965794
return parsed_value.release_nonnull();
57975795
return ParseError::SyntaxError;
57985796
case PropertyID::Content:
@@ -5920,7 +5918,7 @@ Parser::ParseErrorOr<NonnullRefPtr<StyleValue>> Parser::parse_css_value(Property
59205918
return ParseError::SyntaxError;
59215919
}
59225920
case PropertyID::TextShadow:
5923-
if (auto parsed_value = parse_shadow_value(component_values, AllowInsetKeyword::No))
5921+
if (auto parsed_value = parse_shadow_value(tokens, AllowInsetKeyword::No); parsed_value && !tokens.has_next_token())
59245922
return parsed_value.release_nonnull();
59255923
return ParseError::SyntaxError;
59265924
case PropertyID::Transform:

Userland/Libraries/LibWeb/CSS/Parser/Parser.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ class Parser {
251251
No,
252252
Yes,
253253
};
254-
RefPtr<StyleValue> parse_shadow_value(Vector<ComponentValue> const&, AllowInsetKeyword);
254+
RefPtr<StyleValue> parse_shadow_value(TokenStream<ComponentValue>&, AllowInsetKeyword);
255255
RefPtr<StyleValue> parse_single_shadow_value(TokenStream<ComponentValue>&, AllowInsetKeyword);
256256
RefPtr<StyleValue> parse_text_decoration_value(Vector<ComponentValue> const&);
257257
RefPtr<StyleValue> parse_text_decoration_line_value(TokenStream<ComponentValue>&);

0 commit comments

Comments
 (0)