1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-10 18:10:56 +09:00

LibWeb: Parse grid property using TokenStream

This commit is contained in:
Sam Atkins 2023-12-26 15:16:36 +00:00 committed by Sam Atkins
parent 5f99edad3b
commit 69f88c9a64
Notes: sideshowbarker 2024-07-17 08:34:29 +09:00
2 changed files with 3 additions and 4 deletions

View file

@ -5673,12 +5673,11 @@ RefPtr<StyleValue> Parser::parse_grid_area_shorthand_value(TokenStream<Component
{ GridTrackPlacementStyleValue::create(row_start), GridTrackPlacementStyleValue::create(column_start), GridTrackPlacementStyleValue::create(row_end), GridTrackPlacementStyleValue::create(column_end) });
}
RefPtr<StyleValue> Parser::parse_grid_shorthand_value(Vector<ComponentValue> const& component_value)
RefPtr<StyleValue> Parser::parse_grid_shorthand_value(TokenStream<ComponentValue>& tokens)
{
// <'grid-template'> |
// FIXME: <'grid-template-rows'> / [ auto-flow && dense? ] <'grid-auto-columns'>? |
// FIXME: [ auto-flow && dense? ] <'grid-auto-rows'>? / <'grid-template-columns'>
TokenStream tokens { component_value };
return parse_grid_track_size_list_shorthand_value(PropertyID::Grid, tokens);
}
@ -5895,7 +5894,7 @@ Parser::ParseErrorOr<NonnullRefPtr<StyleValue>> Parser::parse_css_value(Property
return parsed_value.release_nonnull();
return ParseError::SyntaxError;
case PropertyID::Grid:
if (auto parsed_value = parse_grid_shorthand_value(component_values))
if (auto parsed_value = parse_grid_shorthand_value(tokens); parsed_value && !tokens.has_next_token())
return parsed_value.release_nonnull();
return ParseError::SyntaxError;
case PropertyID::GridTemplate:

View file

@ -266,7 +266,7 @@ private:
RefPtr<StyleValue> parse_grid_track_placement_shorthand_value(PropertyID, TokenStream<ComponentValue>&);
RefPtr<StyleValue> parse_grid_template_areas_value(TokenStream<ComponentValue>&);
RefPtr<StyleValue> parse_grid_area_shorthand_value(TokenStream<ComponentValue>&);
RefPtr<StyleValue> parse_grid_shorthand_value(Vector<ComponentValue> const&);
RefPtr<StyleValue> parse_grid_shorthand_value(TokenStream<ComponentValue>&);
OwnPtr<CalculationNode> parse_a_calculation(Vector<ComponentValue> const&);