diff --git a/Tests/LibWeb/Layout/expected/grid/grid-placement-shorthand-single-custom-ident.txt b/Tests/LibWeb/Layout/expected/grid/grid-placement-shorthand-single-custom-ident.txt new file mode 100644 index 00000000000..7d8e0ed3fea --- /dev/null +++ b/Tests/LibWeb/Layout/expected/grid/grid-placement-shorthand-single-custom-ident.txt @@ -0,0 +1,27 @@ +Viewport <#document> at (0,0) content-size 800x600 children: not-inline + BlockContainer at (0,0) content-size 800x133 [BFC] children: not-inline + BlockContainer at (8,8) content-size 784x117 children: not-inline + Box at (8,8) content-size 784x117 [GFC] children: not-inline + BlockContainer <(anonymous)> (not painted) [BFC] children: inline + TextNode <#text> + BlockContainer at (8,8) content-size 100x17 [BFC] children: inline + frag 0 from TextNode start: 0, length: 8, rect: [8,8 65.28125x17] baseline: 13.296875 + "Headline" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) [BFC] children: inline + TextNode <#text> + BlockContainer at (8,25) content-size 400x100 [BFC] children: inline + frag 0 from TextNode start: 0, length: 7, rect: [8,25 62.328125x17] baseline: 13.296875 + "Content" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) [BFC] children: inline + TextNode <#text> + +ViewportPaintable (Viewport<#document>) [0,0 800x600] + PaintableWithLines (BlockContainer) [0,0 800x133] + PaintableWithLines (BlockContainer) [8,8 784x117] + PaintableBox (Box
.grid-container) [8,8 784x117] + PaintableWithLines (BlockContainer
.headline) [8,8 100x17] + TextPaintable (TextNode<#text>) + PaintableWithLines (BlockContainer
.content) [8,25 400x100] + TextPaintable (TextNode<#text>) diff --git a/Tests/LibWeb/Layout/input/grid/grid-placement-shorthand-single-custom-ident.html b/Tests/LibWeb/Layout/input/grid/grid-placement-shorthand-single-custom-ident.html new file mode 100644 index 00000000000..b8555103d98 --- /dev/null +++ b/Tests/LibWeb/Layout/input/grid/grid-placement-shorthand-single-custom-ident.html @@ -0,0 +1,34 @@ + + + +
+
Headline
+
Content
+
\ No newline at end of file diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp index 00d52171c66..01ac4b99748 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -6795,7 +6795,7 @@ RefPtr Parser::parse_grid_auto_track_sizes(TokenStream Parser::parse_grid_track_placement(TokenStream& tokens) +RefPtr Parser::parse_grid_track_placement(TokenStream& tokens) { // FIXME: This shouldn't be needed. Right now, the below code returns a CSSStyleValue even if no tokens are consumed! if (!tokens.has_next_token()) @@ -6924,6 +6924,10 @@ RefPtr Parser::parse_grid_track_placement_shorthand_value(Propert auto parsed_start_value = parse_grid_track_placement(track_start_placement_token_stream); if (parsed_start_value && track_end_placement_tokens.is_empty()) { transaction.commit(); + if (parsed_start_value->grid_track_placement().has_identifier()) { + auto custom_ident = parsed_start_value.release_nonnull(); + return ShorthandStyleValue::create(property_id, { start_property, end_property }, { custom_ident, custom_ident }); + } return ShorthandStyleValue::create(property_id, { start_property, end_property }, { parsed_start_value.release_nonnull(), GridTrackPlacementStyleValue::create(GridTrackPlacement::make_auto()) }); diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.h b/Userland/Libraries/LibWeb/CSS/Parser/Parser.h index 323074160b0..e9a937b9f89 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.h +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.h @@ -322,7 +322,7 @@ private: RefPtr parse_grid_auto_track_sizes(TokenStream&); RefPtr parse_grid_auto_flow_value(TokenStream&); RefPtr parse_grid_track_size_list_shorthand_value(PropertyID, TokenStream&); - RefPtr parse_grid_track_placement(TokenStream&); + RefPtr parse_grid_track_placement(TokenStream&); RefPtr parse_grid_track_placement_shorthand_value(PropertyID, TokenStream&); RefPtr parse_grid_template_areas_value(TokenStream&); RefPtr parse_grid_area_shorthand_value(TokenStream&);