mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:07:47 +00:00
LibWeb: Parse grid-area property using TokenStream
This commit is contained in:
parent
a16b35a755
commit
bbbd9c14ac
2 changed files with 5 additions and 4 deletions
|
@ -5563,9 +5563,9 @@ RefPtr<StyleValue> Parser::parse_grid_track_size_list_shorthand_value(PropertyID
|
||||||
{ parsed_template_areas_values.release_nonnull(), parsed_template_rows_values.release_nonnull(), parsed_template_columns_values.release_nonnull() });
|
{ parsed_template_areas_values.release_nonnull(), parsed_template_rows_values.release_nonnull(), parsed_template_columns_values.release_nonnull() });
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<StyleValue> Parser::parse_grid_area_shorthand_value(Vector<ComponentValue> const& component_values)
|
RefPtr<StyleValue> Parser::parse_grid_area_shorthand_value(TokenStream<ComponentValue>& tokens)
|
||||||
{
|
{
|
||||||
auto tokens = TokenStream { component_values };
|
auto transaction = tokens.begin_transaction();
|
||||||
|
|
||||||
auto parse_placement_tokens = [&](Vector<ComponentValue>& placement_tokens, bool check_for_delimiter = true) -> void {
|
auto parse_placement_tokens = [&](Vector<ComponentValue>& placement_tokens, bool check_for_delimiter = true) -> void {
|
||||||
auto current_token = tokens.next_token();
|
auto current_token = tokens.next_token();
|
||||||
|
@ -5635,6 +5635,7 @@ RefPtr<StyleValue> Parser::parse_grid_area_shorthand_value(Vector<ComponentValue
|
||||||
else
|
else
|
||||||
column_end = row_end;
|
column_end = row_end;
|
||||||
|
|
||||||
|
transaction.commit();
|
||||||
return ShorthandStyleValue::create(PropertyID::GridArea,
|
return ShorthandStyleValue::create(PropertyID::GridArea,
|
||||||
{ PropertyID::GridRowStart, PropertyID::GridColumnStart, PropertyID::GridRowEnd, PropertyID::GridColumnEnd },
|
{ PropertyID::GridRowStart, PropertyID::GridColumnStart, PropertyID::GridRowEnd, PropertyID::GridColumnEnd },
|
||||||
{ GridTrackPlacementStyleValue::create(row_start), GridTrackPlacementStyleValue::create(column_start), GridTrackPlacementStyleValue::create(row_end), GridTrackPlacementStyleValue::create(column_end) });
|
{ GridTrackPlacementStyleValue::create(row_start), GridTrackPlacementStyleValue::create(column_start), GridTrackPlacementStyleValue::create(row_end), GridTrackPlacementStyleValue::create(column_end) });
|
||||||
|
@ -5821,7 +5822,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::GridArea:
|
case PropertyID::GridArea:
|
||||||
if (auto parsed_value = parse_grid_area_shorthand_value(component_values))
|
if (auto parsed_value = parse_grid_area_shorthand_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::GridAutoFlow:
|
case PropertyID::GridAutoFlow:
|
||||||
|
|
|
@ -265,7 +265,7 @@ private:
|
||||||
RefPtr<StyleValue> parse_grid_track_placement(Vector<ComponentValue> const&);
|
RefPtr<StyleValue> parse_grid_track_placement(Vector<ComponentValue> const&);
|
||||||
RefPtr<StyleValue> parse_grid_track_placement_shorthand_value(PropertyID, TokenStream<ComponentValue>&);
|
RefPtr<StyleValue> parse_grid_track_placement_shorthand_value(PropertyID, TokenStream<ComponentValue>&);
|
||||||
RefPtr<StyleValue> parse_grid_template_areas_value(Vector<ComponentValue> const&);
|
RefPtr<StyleValue> parse_grid_template_areas_value(Vector<ComponentValue> const&);
|
||||||
RefPtr<StyleValue> parse_grid_area_shorthand_value(Vector<ComponentValue> const&);
|
RefPtr<StyleValue> parse_grid_area_shorthand_value(TokenStream<ComponentValue>&);
|
||||||
RefPtr<StyleValue> parse_grid_shorthand_value(Vector<ComponentValue> const&);
|
RefPtr<StyleValue> parse_grid_shorthand_value(Vector<ComponentValue> const&);
|
||||||
|
|
||||||
OwnPtr<CalculationNode> parse_a_calculation(Vector<ComponentValue> const&);
|
OwnPtr<CalculationNode> parse_a_calculation(Vector<ComponentValue> const&);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue