From b66f65dc9e44e1a839e4101ea643dab36b5fe118 Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Sun, 27 Aug 2023 16:27:35 +0200 Subject: [PATCH] LibWeb: Define if identifier represent area or line during layout [GFC] This fixes regression introduced in c03e025a324d2c8582d3c675b49c61274b7ff0fb by assuming that it is possible to determine whether identifier stands for line or area during parsing. --- .../grid/placement-using-named-tracks-1.txt | 14 +-- .../grid/placement-using-named-tracks-2.txt | 22 ++-- .../grid/placement-using-named-tracks-3.txt | 30 ++--- .../grid/placement-using-named-tracks-1.html | 2 - .../grid/placement-using-named-tracks-2.html | 2 - .../grid/placement-using-named-tracks-3.html | 2 - .../LibWeb/CSS/GridTrackPlacement.cpp | 16 +-- .../Libraries/LibWeb/CSS/GridTrackPlacement.h | 44 +++---- .../Libraries/LibWeb/CSS/Parser/Parser.cpp | 2 +- .../LibWeb/Layout/GridFormattingContext.cpp | 115 +++++++----------- 10 files changed, 104 insertions(+), 145 deletions(-) diff --git a/Tests/LibWeb/Layout/expected/grid/placement-using-named-tracks-1.txt b/Tests/LibWeb/Layout/expected/grid/placement-using-named-tracks-1.txt index 8efbfbb613..890613e7b0 100644 --- a/Tests/LibWeb/Layout/expected/grid/placement-using-named-tracks-1.txt +++ b/Tests/LibWeb/Layout/expected/grid/placement-using-named-tracks-1.txt @@ -1,23 +1,23 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline BlockContainer at (1,1) content-size 798x600 [BFC] children: not-inline - BlockContainer at (10,10) content-size 780x40.9375 children: not-inline - Box at (11,11) content-size 778x38.9375 [GFC] children: not-inline + BlockContainer at (10,10) content-size 780x21.46875 children: not-inline + Box at (11,11) content-size 778x19.46875 [GFC] children: not-inline BlockContainer at (12,12) content-size 387x17.46875 [BFC] children: inline line 0 width: 6.34375, height: 17.46875, bottom: 17.46875, baseline: 13.53125 frag 0 from TextNode start: 0, length: 1, rect: [12,12 6.34375x17.46875] "1" TextNode <#text> - BlockContainer at (12,31.46875) content-size 387x17.46875 [BFC] children: inline + BlockContainer at (401,12) content-size 387x17.46875 [BFC] children: inline line 0 width: 8.8125, height: 17.46875, bottom: 17.46875, baseline: 13.53125 - frag 0 from TextNode start: 0, length: 1, rect: [12,31.46875 8.8125x17.46875] + frag 0 from TextNode start: 0, length: 1, rect: [401,12 8.8125x17.46875] "2" TextNode <#text> ViewportPaintable (Viewport<#document>) [0,0 800x600] overflow: [0,0 800x602] PaintableWithLines (BlockContainer) [0,0 800x602] - PaintableWithLines (BlockContainer) [9,9 782x42.9375] - PaintableBox (Box
.grid-container) [10,10 780x40.9375] + PaintableWithLines (BlockContainer) [9,9 782x23.46875] + PaintableBox (Box
.grid-container) [10,10 780x21.46875] PaintableWithLines (BlockContainer
.a) [11,11 389x19.46875] TextPaintable (TextNode<#text>) - PaintableWithLines (BlockContainer
.b) [11,30.46875 389x19.46875] + PaintableWithLines (BlockContainer
.b) [400,11 389x19.46875] TextPaintable (TextNode<#text>) diff --git a/Tests/LibWeb/Layout/expected/grid/placement-using-named-tracks-2.txt b/Tests/LibWeb/Layout/expected/grid/placement-using-named-tracks-2.txt index 3a81088f68..9a75f0c4c5 100644 --- a/Tests/LibWeb/Layout/expected/grid/placement-using-named-tracks-2.txt +++ b/Tests/LibWeb/Layout/expected/grid/placement-using-named-tracks-2.txt @@ -2,24 +2,24 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline BlockContainer at (1,1) content-size 798x600 [BFC] children: not-inline BlockContainer at (10,10) content-size 780x77 children: not-inline Box at (11,11) content-size 778x75 [GFC] children: not-inline - BlockContainer at (12,12) content-size 257.328125x23 [BFC] children: inline + BlockContainer at (12,12) content-size 257.328125x73 [BFC] children: inline line 0 width: 6.34375, height: 17.46875, bottom: 17.46875, baseline: 13.53125 frag 0 from TextNode start: 0, length: 1, rect: [12,12 6.34375x17.46875] "1" TextNode <#text> - BlockContainer at (12,12) content-size 257.328125x23 [BFC] children: inline + BlockContainer at (530.65625,12) content-size 257.328125x48 [BFC] children: inline line 0 width: 8.8125, height: 17.46875, bottom: 17.46875, baseline: 13.53125 - frag 0 from TextNode start: 0, length: 1, rect: [12,12 8.8125x17.46875] + frag 0 from TextNode start: 0, length: 1, rect: [530.65625,12 8.8125x17.46875] "2" TextNode <#text> - BlockContainer at (12,12) content-size 257.328125x23 [BFC] children: inline + BlockContainer at (271.328125,12) content-size 257.328125x23 [BFC] children: inline line 0 width: 9.09375, height: 17.46875, bottom: 17.46875, baseline: 13.53125 - frag 0 from TextNode start: 0, length: 1, rect: [12,12 9.09375x17.46875] + frag 0 from TextNode start: 0, length: 1, rect: [271.328125,12 9.09375x17.46875] "3" TextNode <#text> - BlockContainer at (12,12) content-size 257.328125x23 [BFC] children: inline + BlockContainer at (271.328125,62) content-size 516.65625x23 [BFC] children: inline line 0 width: 7.75, height: 17.46875, bottom: 17.46875, baseline: 13.53125 - frag 0 from TextNode start: 0, length: 1, rect: [12,12 7.75x17.46875] + frag 0 from TextNode start: 0, length: 1, rect: [271.328125,62 7.75x17.46875] "4" TextNode <#text> @@ -27,11 +27,11 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600] overflow: [0,0 800x602] PaintableWithLines (BlockContainer) [0,0 800x602] PaintableWithLines (BlockContainer) [9,9 782x79] PaintableBox (Box
.grid-container) [10,10 780x77] - PaintableWithLines (BlockContainer
.grid-item.a) [11,11 259.328125x25] + PaintableWithLines (BlockContainer
.grid-item.a) [11,11 259.328125x75] TextPaintable (TextNode<#text>) - PaintableWithLines (BlockContainer
.grid-item.b) [11,11 259.328125x25] + PaintableWithLines (BlockContainer
.grid-item.b) [529.65625,11 259.328125x50] TextPaintable (TextNode<#text>) - PaintableWithLines (BlockContainer
.grid-item.c) [11,11 259.328125x25] + PaintableWithLines (BlockContainer
.grid-item.c) [270.328125,11 259.328125x25] TextPaintable (TextNode<#text>) - PaintableWithLines (BlockContainer
.grid-item.d) [11,11 259.328125x25] + PaintableWithLines (BlockContainer
.grid-item.d) [270.328125,61 518.65625x25] TextPaintable (TextNode<#text>) diff --git a/Tests/LibWeb/Layout/expected/grid/placement-using-named-tracks-3.txt b/Tests/LibWeb/Layout/expected/grid/placement-using-named-tracks-3.txt index aa35a12ed0..0a2a0c8930 100644 --- a/Tests/LibWeb/Layout/expected/grid/placement-using-named-tracks-3.txt +++ b/Tests/LibWeb/Layout/expected/grid/placement-using-named-tracks-3.txt @@ -1,37 +1,37 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline BlockContainer at (1,1) content-size 798x600 [BFC] children: not-inline - BlockContainer at (10,10) content-size 780x21.46875 children: not-inline - Box at (11,11) content-size 778x19.46875 [GFC] children: not-inline - BlockContainer at (12,12) content-size 48x17.46875 [BFC] children: inline + BlockContainer at (10,10) content-size 780x40.9375 children: not-inline + Box at (11,11) content-size 778x38.9375 [GFC] children: not-inline + BlockContainer at (62,12) content-size 98x17.46875 [BFC] children: inline line 0 width: 6.34375, height: 17.46875, bottom: 17.46875, baseline: 13.53125 - frag 0 from TextNode start: 0, length: 1, rect: [12,12 6.34375x17.46875] + frag 0 from TextNode start: 0, length: 1, rect: [62,12 6.34375x17.46875] "1" TextNode <#text> - BlockContainer
at (62,12) content-size 98x17.46875 [BFC] children: inline + BlockContainer
at (162,12) content-size 48x17.46875 [BFC] children: inline line 0 width: 8.8125, height: 17.46875, bottom: 17.46875, baseline: 13.53125 - frag 0 from TextNode start: 0, length: 1, rect: [62,12 8.8125x17.46875] + frag 0 from TextNode start: 0, length: 1, rect: [162,12 8.8125x17.46875] "2" TextNode <#text> - BlockContainer
at (162,12) content-size 48x17.46875 [BFC] children: inline + BlockContainer
at (212,12) content-size 98x17.46875 [BFC] children: inline line 0 width: 9.09375, height: 17.46875, bottom: 17.46875, baseline: 13.53125 - frag 0 from TextNode start: 0, length: 1, rect: [162,12 9.09375x17.46875] + frag 0 from TextNode start: 0, length: 1, rect: [212,12 9.09375x17.46875] "3" TextNode <#text> - BlockContainer
at (212,12) content-size 98x17.46875 [BFC] children: inline + BlockContainer
at (12,31.46875) content-size 48x17.46875 [BFC] children: inline line 0 width: 7.75, height: 17.46875, bottom: 17.46875, baseline: 13.53125 - frag 0 from TextNode start: 0, length: 1, rect: [212,12 7.75x17.46875] + frag 0 from TextNode start: 0, length: 1, rect: [12,31.46875 7.75x17.46875] "4" TextNode <#text> ViewportPaintable (Viewport<#document>) [0,0 800x600] overflow: [0,0 800x602] PaintableWithLines (BlockContainer) [0,0 800x602] - PaintableWithLines (BlockContainer) [9,9 782x23.46875] - PaintableBox (Box
.grid-container) [10,10 780x21.46875] - PaintableWithLines (BlockContainer
.a) [11,11 50x19.46875] - TextPaintable (TextNode<#text>) - PaintableWithLines (BlockContainer
) [61,11 100x19.46875] + PaintableWithLines (BlockContainer) [9,9 782x42.9375] + PaintableBox (Box
.grid-container) [10,10 780x40.9375] + PaintableWithLines (BlockContainer
.a) [61,11 100x19.46875] TextPaintable (TextNode<#text>) PaintableWithLines (BlockContainer
) [161,11 50x19.46875] TextPaintable (TextNode<#text>) PaintableWithLines (BlockContainer
) [211,11 100x19.46875] TextPaintable (TextNode<#text>) + PaintableWithLines (BlockContainer
) [11,30.46875 50x19.46875] + TextPaintable (TextNode<#text>) diff --git a/Tests/LibWeb/Layout/input/grid/placement-using-named-tracks-1.html b/Tests/LibWeb/Layout/input/grid/placement-using-named-tracks-1.html index f55c3bd18e..253a6f4a3d 100644 --- a/Tests/LibWeb/Layout/input/grid/placement-using-named-tracks-1.html +++ b/Tests/LibWeb/Layout/input/grid/placement-using-named-tracks-1.html @@ -1,6 +1,4 @@