diff --git a/Tests/LibWeb/Layout/expected/table/fixed-layout-percentage-width-all-columns.txt b/Tests/LibWeb/Layout/expected/table/fixed-layout-percentage-width-all-columns.txt new file mode 100644 index 00000000000..a74f5f4cc8c --- /dev/null +++ b/Tests/LibWeb/Layout/expected/table/fixed-layout-percentage-width-all-columns.txt @@ -0,0 +1,99 @@ +Viewport <#document> at (0,0) content-size 800x600 children: not-inline + BlockContainer at (0,0) content-size 800x600 [BFC] children: not-inline + BlockContainer at (8,8) content-size 784x44.9375 children: not-inline + TableWrapper <(anonymous)> at (8,8) content-size 600x44.9375 [BFC] children: not-inline + Box at (9,9) content-size 598x42.9375 table-box [TFC] children: not-inline + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + Box at (9,9) content-size 598x42.9375 table-row-group children: not-inline + Box at (9,9) content-size 598x21.46875 table-row children: not-inline + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer at (9,30.46875) content-size 598x21.46875 table-row children: not-inline + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer
at (11,11) content-size 62.4375x17.46875 table-cell [BFC] children: inline + line 0 width: 26.078125, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 4, rect: [11,11 26.078125x17.46875] + "cell" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer at (77.4375,11) content-size 62.4375x17.46875 table-cell [BFC] children: inline + line 0 width: 26.078125, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 4, rect: [77.4375,11 26.078125x17.46875] + "cell" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer at (143.875,11) content-size 128.890625x17.46875 table-cell [BFC] children: inline + line 0 width: 94.96875, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 12, rect: [143.875,11 94.96875x17.46875] + "A table cell" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer at (276.765625,11) content-size 328.234375x17.46875 table-cell [BFC] children: inline + line 0 width: 94.96875, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 12, rect: [276.765625,11 94.96875x17.46875] + "A table cell" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + Box
at (11,32.46875) content-size 62.4375x17.46875 table-cell [BFC] children: inline + line 0 width: 26.078125, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 4, rect: [11,32.46875 26.078125x17.46875] + "cell" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer at (77.4375,32.46875) content-size 62.4375x17.46875 table-cell [BFC] children: inline + line 0 width: 26.078125, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 4, rect: [77.4375,32.46875 26.078125x17.46875] + "cell" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer at (143.875,32.46875) content-size 128.890625x17.46875 table-cell [BFC] children: inline + line 0 width: 94.96875, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 12, rect: [143.875,32.46875 94.96875x17.46875] + "A table cell" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer at (276.765625,32.46875) content-size 328.234375x17.46875 table-cell [BFC] children: inline + line 0 width: 94.96875, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 12, rect: [276.765625,32.46875 94.96875x17.46875] + "A table cell" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + +PaintableWithLines (Viewport<#document>) [0,0 800x600] + PaintableWithLines (BlockContainer) [0,0 800x600] + PaintableWithLines (BlockContainer) [8,8 784x44.9375] + PaintableWithLines (TableWrapper(anonymous)) [8,8 600x44.9375] + PaintableBox (Box) [8,8 600x44.9375] + PaintableBox (Box) [9,9 598x42.9375] + PaintableBox (Box) [9,9 598x21.46875] + PaintableWithLines (BlockContainer) [9,30.46875 598x21.46875] + PaintableWithLines (BlockContainer
) [9,9 66.4375x21.46875] + TextPaintable (TextNode<#text>) + PaintableWithLines (BlockContainer) [75.4375,9 66.4375x21.46875] + TextPaintable (TextNode<#text>) + PaintableWithLines (BlockContainer) [141.875,9 132.890625x21.46875] + TextPaintable (TextNode<#text>) + PaintableWithLines (BlockContainer) [274.765625,9 332.234375x21.46875] + TextPaintable (TextNode<#text>) + PaintableBox (Box
) [9,30.46875 66.4375x21.46875] + TextPaintable (TextNode<#text>) + PaintableWithLines (BlockContainer) [75.4375,30.46875 66.4375x21.46875] + TextPaintable (TextNode<#text>) + PaintableWithLines (BlockContainer) [141.875,30.46875 132.890625x21.46875] + TextPaintable (TextNode<#text>) + PaintableWithLines (BlockContainer) [274.765625,30.46875 332.234375x21.46875] + TextPaintable (TextNode<#text>) diff --git a/Tests/LibWeb/Layout/expected/table/fixed-layout-percentage-width.txt b/Tests/LibWeb/Layout/expected/table/fixed-layout-percentage-width.txt new file mode 100644 index 00000000000..49c3e1ec631 --- /dev/null +++ b/Tests/LibWeb/Layout/expected/table/fixed-layout-percentage-width.txt @@ -0,0 +1,99 @@ +Viewport <#document> at (0,0) content-size 800x600 children: not-inline + BlockContainer at (0,0) content-size 800x600 [BFC] children: not-inline + BlockContainer at (8,8) content-size 784x44.9375 children: not-inline + TableWrapper <(anonymous)> at (8,8) content-size 600x44.9375 [BFC] children: not-inline + Box at (9,9) content-size 598x42.9375 table-box [TFC] children: not-inline + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + Box at (9,9) content-size 597.96875x42.9375 table-row-group children: not-inline + Box at (9,9) content-size 597.96875x21.46875 table-row children: not-inline + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer at (9,30.46875) content-size 597.96875x21.46875 table-row children: not-inline + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer
at (11,11) content-size 95.65625x17.46875 table-cell [BFC] children: inline + line 0 width: 26.078125, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 4, rect: [11,11 26.078125x17.46875] + "cell" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer at (110.65625,11) content-size 95.65625x17.46875 table-cell [BFC] children: inline + line 0 width: 26.078125, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 4, rect: [110.65625,11 26.078125x17.46875] + "cell" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer at (210.3125,11) content-size 95.65625x17.46875 table-cell [BFC] children: inline + line 0 width: 94.96875, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 12, rect: [210.3125,11 94.96875x17.46875] + "A table cell" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer at (309.96875,11) content-size 295x17.46875 table-cell [BFC] children: inline + line 0 width: 94.96875, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 12, rect: [309.96875,11 94.96875x17.46875] + "A table cell" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + Box
at (11,32.46875) content-size 95.65625x17.46875 table-cell [BFC] children: inline + line 0 width: 26.078125, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 4, rect: [11,32.46875 26.078125x17.46875] + "cell" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer at (110.65625,32.46875) content-size 95.65625x17.46875 table-cell [BFC] children: inline + line 0 width: 26.078125, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 4, rect: [110.65625,32.46875 26.078125x17.46875] + "cell" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer at (210.3125,32.46875) content-size 95.65625x17.46875 table-cell [BFC] children: inline + line 0 width: 94.96875, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 12, rect: [210.3125,32.46875 94.96875x17.46875] + "A table cell" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer at (309.96875,32.46875) content-size 295x17.46875 table-cell [BFC] children: inline + line 0 width: 94.96875, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 12, rect: [309.96875,32.46875 94.96875x17.46875] + "A table cell" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + +PaintableWithLines (Viewport<#document>) [0,0 800x600] + PaintableWithLines (BlockContainer) [0,0 800x600] + PaintableWithLines (BlockContainer) [8,8 784x44.9375] + PaintableWithLines (TableWrapper(anonymous)) [8,8 600x44.9375] + PaintableBox (Box) [8,8 600x44.9375] + PaintableBox (Box) [9,9 597.96875x42.9375] + PaintableBox (Box) [9,9 597.96875x21.46875] + PaintableWithLines (BlockContainer) [9,30.46875 597.96875x21.46875] + PaintableWithLines (BlockContainer
) [9,9 99.65625x21.46875] + TextPaintable (TextNode<#text>) + PaintableWithLines (BlockContainer) [108.65625,9 99.65625x21.46875] + TextPaintable (TextNode<#text>) + PaintableWithLines (BlockContainer) [208.3125,9 99.65625x21.46875] + TextPaintable (TextNode<#text>) + PaintableWithLines (BlockContainer) [307.96875,9 299x21.46875] + TextPaintable (TextNode<#text>) + PaintableBox (Box
) [9,30.46875 99.65625x21.46875] + TextPaintable (TextNode<#text>) + PaintableWithLines (BlockContainer) [108.65625,30.46875 99.65625x21.46875] + TextPaintable (TextNode<#text>) + PaintableWithLines (BlockContainer) [208.3125,30.46875 99.65625x21.46875] + TextPaintable (TextNode<#text>) + PaintableWithLines (BlockContainer) [307.96875,30.46875 299x21.46875] + TextPaintable (TextNode<#text>) diff --git a/Tests/LibWeb/Layout/expected/table/fixed-layout-pixel-width-all-columns.txt b/Tests/LibWeb/Layout/expected/table/fixed-layout-pixel-width-all-columns.txt new file mode 100644 index 00000000000..f29993a60d1 --- /dev/null +++ b/Tests/LibWeb/Layout/expected/table/fixed-layout-pixel-width-all-columns.txt @@ -0,0 +1,99 @@ +Viewport <#document> at (0,0) content-size 800x600 children: not-inline + BlockContainer at (0,0) content-size 800x600 [BFC] children: not-inline + BlockContainer at (8,8) content-size 784x44.9375 children: not-inline + TableWrapper <(anonymous)> at (8,8) content-size 600x44.9375 [BFC] children: not-inline + Box at (9,9) content-size 598x42.9375 table-box [TFC] children: not-inline + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + Box at (9,9) content-size 598x42.9375 table-row-group children: not-inline + Box at (9,9) content-size 598x21.46875 table-row children: not-inline + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer at (9,30.46875) content-size 598x21.46875 table-row children: not-inline + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer
at (11,11) content-size 58.578125x17.46875 table-cell [BFC] children: inline + line 0 width: 26.078125, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 4, rect: [11,11 26.078125x17.46875] + "cell" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer at (73.578125,11) content-size 58.578125x17.46875 table-cell [BFC] children: inline + line 0 width: 26.078125, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 4, rect: [73.578125,11 26.078125x17.46875] + "cell" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer at (136.15625,11) content-size 116.53125x17.46875 table-cell [BFC] children: inline + line 0 width: 94.96875, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 12, rect: [136.15625,11 94.96875x17.46875] + "A table cell" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer at (256.6875,11) content-size 348.3125x17.46875 table-cell [BFC] children: inline + line 0 width: 94.96875, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 12, rect: [256.6875,11 94.96875x17.46875] + "A table cell" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + Box
at (11,32.46875) content-size 58.578125x17.46875 table-cell [BFC] children: inline + line 0 width: 26.078125, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 4, rect: [11,32.46875 26.078125x17.46875] + "cell" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer at (73.578125,32.46875) content-size 58.578125x17.46875 table-cell [BFC] children: inline + line 0 width: 26.078125, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 4, rect: [73.578125,32.46875 26.078125x17.46875] + "cell" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer at (136.15625,32.46875) content-size 116.53125x17.46875 table-cell [BFC] children: inline + line 0 width: 94.96875, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 12, rect: [136.15625,32.46875 94.96875x17.46875] + "A table cell" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer at (256.6875,32.46875) content-size 348.3125x17.46875 table-cell [BFC] children: inline + line 0 width: 94.96875, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 12, rect: [256.6875,32.46875 94.96875x17.46875] + "A table cell" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + +PaintableWithLines (Viewport<#document>) [0,0 800x600] + PaintableWithLines (BlockContainer) [0,0 800x600] + PaintableWithLines (BlockContainer) [8,8 784x44.9375] + PaintableWithLines (TableWrapper(anonymous)) [8,8 600x44.9375] + PaintableBox (Box) [8,8 600x44.9375] + PaintableBox (Box) [9,9 598x42.9375] + PaintableBox (Box) [9,9 598x21.46875] + PaintableWithLines (BlockContainer) [9,30.46875 598x21.46875] + PaintableWithLines (BlockContainer
) [9,9 62.578125x21.46875] + TextPaintable (TextNode<#text>) + PaintableWithLines (BlockContainer) [71.578125,9 62.578125x21.46875] + TextPaintable (TextNode<#text>) + PaintableWithLines (BlockContainer) [134.15625,9 120.53125x21.46875] + TextPaintable (TextNode<#text>) + PaintableWithLines (BlockContainer) [254.6875,9 352.3125x21.46875] + TextPaintable (TextNode<#text>) + PaintableBox (Box
) [9,30.46875 62.578125x21.46875] + TextPaintable (TextNode<#text>) + PaintableWithLines (BlockContainer) [71.578125,30.46875 62.578125x21.46875] + TextPaintable (TextNode<#text>) + PaintableWithLines (BlockContainer) [134.15625,30.46875 120.53125x21.46875] + TextPaintable (TextNode<#text>) + PaintableWithLines (BlockContainer) [254.6875,30.46875 352.3125x21.46875] + TextPaintable (TextNode<#text>) diff --git a/Tests/LibWeb/Layout/expected/table/fixed-layout-pixel-width.txt b/Tests/LibWeb/Layout/expected/table/fixed-layout-pixel-width.txt new file mode 100644 index 00000000000..6867e962f6e --- /dev/null +++ b/Tests/LibWeb/Layout/expected/table/fixed-layout-pixel-width.txt @@ -0,0 +1,105 @@ +Viewport <#document> at (0,0) content-size 800x600 children: not-inline + BlockContainer at (0,0) content-size 800x600 [BFC] children: not-inline + BlockContainer at (8,8) content-size 784x80.8125 children: not-inline + TableWrapper <(anonymous)> at (8,8) content-size 600x80.8125 [BFC] children: not-inline + Box at (9,9) content-size 598x78.8125 table-box [TFC] children: not-inline + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + Box at (9,9) content-size 598x78.8125 table-row-group children: not-inline + Box at (9,9) content-size 598x39.40625 table-row children: not-inline + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer at (9,48.40625) content-size 598x39.40625 table-row children: not-inline + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer
at (11,19.96875) content-size 94x17.46875 table-cell [BFC] children: inline + line 0 width: 26.078125, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 4, rect: [11,19.96875 26.078125x17.46875] + "cell" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer at (109,19.96875) content-size 94x17.46875 table-cell [BFC] children: inline + line 0 width: 26.078125, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 4, rect: [109,19.96875 26.078125x17.46875] + "cell" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer at (207,11) content-size 94x35.40625 table-cell [BFC] children: inline + line 0 width: 60.890625, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 7, rect: [207,11 60.890625x17.46875] + "A table" + line 1 width: 26.078125, height: 17.9375, bottom: 35.40625, baseline: 13.53125 + frag 0 from TextNode start: 8, length: 4, rect: [207,28 26.078125x17.46875] + "cell" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer at (305,19.96875) content-size 300x17.46875 table-cell [BFC] children: inline + line 0 width: 94.96875, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 12, rect: [305,19.96875 94.96875x17.46875] + "A table cell" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + Box
at (11,59.375) content-size 94x17.46875 table-cell [BFC] children: inline + line 0 width: 26.078125, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 4, rect: [11,59.375 26.078125x17.46875] + "cell" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer at (109,59.375) content-size 94x17.46875 table-cell [BFC] children: inline + line 0 width: 26.078125, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 4, rect: [109,59.375 26.078125x17.46875] + "cell" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer at (207,50.40625) content-size 94x35.40625 table-cell [BFC] children: inline + line 0 width: 60.890625, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 7, rect: [207,50.40625 60.890625x17.46875] + "A table" + line 1 width: 26.078125, height: 17.9375, bottom: 35.40625, baseline: 13.53125 + frag 0 from TextNode start: 8, length: 4, rect: [207,67.40625 26.078125x17.46875] + "cell" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer at (305,59.375) content-size 300x17.46875 table-cell [BFC] children: inline + line 0 width: 94.96875, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 12, rect: [305,59.375 94.96875x17.46875] + "A table cell" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + +PaintableWithLines (Viewport<#document>) [0,0 800x600] + PaintableWithLines (BlockContainer) [0,0 800x600] + PaintableWithLines (BlockContainer) [8,8 784x80.8125] + PaintableWithLines (TableWrapper(anonymous)) [8,8 600x80.8125] + PaintableBox (Box) [8,8 600x80.8125] + PaintableBox (Box) [9,9 598x78.8125] + PaintableBox (Box) [9,9 598x39.40625] + PaintableWithLines (BlockContainer) [9,48.40625 598x39.40625] + PaintableWithLines (BlockContainer
) [9,9 98x39.40625] + TextPaintable (TextNode<#text>) + PaintableWithLines (BlockContainer) [107,9 98x39.40625] + TextPaintable (TextNode<#text>) + PaintableWithLines (BlockContainer) [205,9 98x39.40625] + TextPaintable (TextNode<#text>) + PaintableWithLines (BlockContainer) [303,9 304x39.40625] + TextPaintable (TextNode<#text>) + PaintableBox (Box
) [9,48.40625 98x39.40625] + TextPaintable (TextNode<#text>) + PaintableWithLines (BlockContainer) [107,48.40625 98x39.40625] + TextPaintable (TextNode<#text>) + PaintableWithLines (BlockContainer) [205,48.40625 98x39.40625] + TextPaintable (TextNode<#text>) + PaintableWithLines (BlockContainer) [303,48.40625 304x39.40625] + TextPaintable (TextNode<#text>) diff --git a/Tests/LibWeb/Layout/expected/table/fixed-layout.txt b/Tests/LibWeb/Layout/expected/table/fixed-layout.txt new file mode 100644 index 00000000000..30375dfdb6a --- /dev/null +++ b/Tests/LibWeb/Layout/expected/table/fixed-layout.txt @@ -0,0 +1,99 @@ +Viewport <#document> at (0,0) content-size 800x600 children: not-inline + BlockContainer at (0,0) content-size 800x600 [BFC] children: not-inline + BlockContainer at (8,8) content-size 784x44.9375 children: not-inline + TableWrapper <(anonymous)> at (8,8) content-size 600x44.9375 [BFC] children: not-inline + Box at (9,9) content-size 598x42.9375 table-box [TFC] children: not-inline + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + Box at (9,9) content-size 598x42.9375 table-row-group children: not-inline + Box at (9,9) content-size 598x21.46875 table-row children: not-inline + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer at (9,30.46875) content-size 598x21.46875 table-row children: not-inline + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer
at (11,11) content-size 145.5x17.46875 table-cell [BFC] children: inline + line 0 width: 26.078125, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 4, rect: [11,11 26.078125x17.46875] + "cell" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer at (160.5,11) content-size 145.5x17.46875 table-cell [BFC] children: inline + line 0 width: 26.078125, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 4, rect: [160.5,11 26.078125x17.46875] + "cell" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer at (310,11) content-size 145.5x17.46875 table-cell [BFC] children: inline + line 0 width: 94.96875, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 12, rect: [310,11 94.96875x17.46875] + "A table cell" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer at (459.5,11) content-size 145.5x17.46875 table-cell [BFC] children: inline + line 0 width: 94.96875, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 12, rect: [459.5,11 94.96875x17.46875] + "A table cell" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + Box
at (11,32.46875) content-size 145.5x17.46875 table-cell [BFC] children: inline + line 0 width: 26.078125, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 4, rect: [11,32.46875 26.078125x17.46875] + "cell" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer at (160.5,32.46875) content-size 145.5x17.46875 table-cell [BFC] children: inline + line 0 width: 26.078125, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 4, rect: [160.5,32.46875 26.078125x17.46875] + "cell" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer at (310,32.46875) content-size 145.5x17.46875 table-cell [BFC] children: inline + line 0 width: 94.96875, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 12, rect: [310,32.46875 94.96875x17.46875] + "A table cell" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer at (459.5,32.46875) content-size 145.5x17.46875 table-cell [BFC] children: inline + line 0 width: 94.96875, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 12, rect: [459.5,32.46875 94.96875x17.46875] + "A table cell" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + +PaintableWithLines (Viewport<#document>) [0,0 800x600] + PaintableWithLines (BlockContainer) [0,0 800x600] + PaintableWithLines (BlockContainer) [8,8 784x44.9375] + PaintableWithLines (TableWrapper(anonymous)) [8,8 600x44.9375] + PaintableBox (Box) [8,8 600x44.9375] + PaintableBox (Box) [9,9 598x42.9375] + PaintableBox (Box) [9,9 598x21.46875] + PaintableWithLines (BlockContainer) [9,30.46875 598x21.46875] + PaintableWithLines (BlockContainer
) [9,9 149.5x21.46875] + TextPaintable (TextNode<#text>) + PaintableWithLines (BlockContainer) [158.5,9 149.5x21.46875] + TextPaintable (TextNode<#text>) + PaintableWithLines (BlockContainer) [308,9 149.5x21.46875] + TextPaintable (TextNode<#text>) + PaintableWithLines (BlockContainer) [457.5,9 149.5x21.46875] + TextPaintable (TextNode<#text>) + PaintableBox (Box
) [9,30.46875 149.5x21.46875] + TextPaintable (TextNode<#text>) + PaintableWithLines (BlockContainer) [158.5,30.46875 149.5x21.46875] + TextPaintable (TextNode<#text>) + PaintableWithLines (BlockContainer) [308,30.46875 149.5x21.46875] + TextPaintable (TextNode<#text>) + PaintableWithLines (BlockContainer) [457.5,30.46875 149.5x21.46875] + TextPaintable (TextNode<#text>) diff --git a/Tests/LibWeb/Layout/expected/table/size.txt b/Tests/LibWeb/Layout/expected/table/size.txt index b2dece90c44..834533313ac 100644 --- a/Tests/LibWeb/Layout/expected/table/size.txt +++ b/Tests/LibWeb/Layout/expected/table/size.txt @@ -3,16 +3,16 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline BlockContainer at (8,8) content-size 784x17.46875 children: not-inline TableWrapper <(anonymous)> at (350,8) content-size 100x17.46875 [BFC] children: not-inline Box
at (350,8) content-size 100x17.46875 table-box [TFC] children: not-inline - Box <(anonymous)> at (350,8) content-size 2000x17.46875 table-row children: not-inline - BlockContainer <(anonymous)> at (350,8) content-size 2000x17.46875 table-cell [BFC] children: not-inline - BlockContainer <(anonymous)> at (350,8) content-size 2000x0 children: inline + Box <(anonymous)> at (350,8) content-size 100x17.46875 table-row children: not-inline + BlockContainer <(anonymous)> at (350,8) content-size 100x17.46875 table-cell [BFC] children: not-inline + BlockContainer <(anonymous)> at (350,8) content-size 100x0 children: inline TextNode <#text> BlockContainer
at (350,8) content-size 2000x17.46875 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: [350,8 6.34375x17.46875] "1" TextNode <#text> - BlockContainer <(anonymous)> at (350,25.46875) content-size 2000x0 children: inline + BlockContainer <(anonymous)> at (350,25.46875) content-size 100x0 children: inline TextNode <#text> PaintableWithLines (Viewport<#document>) [0,0 800x600] overflow: [0,0 2350x600] @@ -20,9 +20,9 @@ PaintableWithLines (Viewport<#document>) [0,0 800x600] overflow: [0,0 2350x600] PaintableWithLines (BlockContainer) [8,8 784x17.46875] overflow: [8,8 2342x17.46875] PaintableWithLines (TableWrapper(anonymous)) [350,8 100x17.46875] overflow: [350,8 2000x17.46875] PaintableBox (Box
) [350,8 100x17.46875] overflow: [350,8 2000x17.46875] - PaintableBox (Box(anonymous)) [350,8 2000x17.46875] - PaintableWithLines (BlockContainer(anonymous)) [350,8 2000x17.46875] - PaintableWithLines (BlockContainer(anonymous)) [350,8 2000x0] + PaintableBox (Box(anonymous)) [350,8 100x17.46875] overflow: [350,8 2000x17.46875] + PaintableWithLines (BlockContainer(anonymous)) [350,8 100x17.46875] overflow: [350,8 2000x17.46875] + PaintableWithLines (BlockContainer(anonymous)) [350,8 100x0] PaintableWithLines (BlockContainer
) [350,8 2000x17.46875] TextPaintable (TextNode<#text>) - PaintableWithLines (BlockContainer(anonymous)) [350,25.46875 2000x0] + PaintableWithLines (BlockContainer(anonymous)) [350,25.46875 100x0] diff --git a/Tests/LibWeb/Layout/input/table/fixed-layout-percentage-width-all-columns.html b/Tests/LibWeb/Layout/input/table/fixed-layout-percentage-width-all-columns.html new file mode 100644 index 00000000000..68667add750 --- /dev/null +++ b/Tests/LibWeb/Layout/input/table/fixed-layout-percentage-width-all-columns.html @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + +
cellcellA table cellA table cell
cellcellA table cellA table cell
\ No newline at end of file diff --git a/Tests/LibWeb/Layout/input/table/fixed-layout-percentage-width.html b/Tests/LibWeb/Layout/input/table/fixed-layout-percentage-width.html new file mode 100644 index 00000000000..871c54294b9 --- /dev/null +++ b/Tests/LibWeb/Layout/input/table/fixed-layout-percentage-width.html @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + +
cellcellA table cellA table cell
cellcellA table cellA table cell
\ No newline at end of file diff --git a/Tests/LibWeb/Layout/input/table/fixed-layout-pixel-width-all-columns.html b/Tests/LibWeb/Layout/input/table/fixed-layout-pixel-width-all-columns.html new file mode 100644 index 00000000000..07be764f944 --- /dev/null +++ b/Tests/LibWeb/Layout/input/table/fixed-layout-pixel-width-all-columns.html @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + +
cellcellA table cellA table cell
cellcellA table cellA table cell
\ No newline at end of file diff --git a/Tests/LibWeb/Layout/input/table/fixed-layout-pixel-width.html b/Tests/LibWeb/Layout/input/table/fixed-layout-pixel-width.html new file mode 100644 index 00000000000..1373f777491 --- /dev/null +++ b/Tests/LibWeb/Layout/input/table/fixed-layout-pixel-width.html @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + +
cellcellA table cellA table cell
cellcellA table cellA table cell
\ No newline at end of file diff --git a/Tests/LibWeb/Layout/input/table/fixed-layout.html b/Tests/LibWeb/Layout/input/table/fixed-layout.html new file mode 100644 index 00000000000..0763d07a89e --- /dev/null +++ b/Tests/LibWeb/Layout/input/table/fixed-layout.html @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + +
cellcellA table cellA table cell
cellcellA table cellA table cell
\ No newline at end of file diff --git a/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp index 39ec7d44bbe..d26e57b3e65 100644 --- a/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp @@ -253,7 +253,13 @@ void TableFormattingContext::compute_cell_measures(AvailableSpace const& availab // The outer min-content width of a table-cell is max(min-width, min-content width) adjusted by the cell intrinsic offsets. auto min_width = computed_values.min_width().to_px(cell.box, containing_block.content_width()); auto cell_intrinsic_width_offsets = padding_left + padding_right + border_left + border_right; - cell.outer_min_width = max(min_width, min_content_width) + cell_intrinsic_width_offsets; + // For fixed mode, according to https://www.w3.org/TR/css-tables-3/#computing-column-measures: + // The min-content and max-content width of cells is considered zero unless they are directly specified as a length-percentage, + // in which case they are resolved based on the table width (if it is definite, otherwise use 0). + auto width_is_specified_length_or_percentage = computed_values.width().is_length() || computed_values.width().is_percentage(); + if (!use_fixed_mode_layout() || width_is_specified_length_or_percentage) { + cell.outer_min_width = max(min_width, min_content_width) + cell_intrinsic_width_offsets; + } // The tables specification isn't explicit on how to use the height and max-height CSS properties in the outer max-content formulas. // However, during this early phase we don't have enough information to resolve percentage sizes yet and the formulas for outer sizes @@ -274,6 +280,9 @@ void TableFormattingContext::compute_cell_measures(AvailableSpace const& availab // See the explanation for height and max_height above. auto width = computed_values.width().is_length() ? computed_values.width().to_px(cell.box, containing_block.content_width()) : 0; auto max_width = computed_values.max_width().is_length() ? computed_values.max_width().to_px(cell.box, containing_block.content_width()) : INFINITY; + if (use_fixed_mode_layout() && !width_is_specified_length_or_percentage) { + continue; + } if (m_columns[cell.column_index].is_constrained) { // The outer max-content width of a table-cell in a constrained column is // max(min-width, width, min-content width, min(max-width, width)) adjusted by the cell intrinsic offsets. @@ -342,8 +351,11 @@ void TableFormattingContext::initialize_table_measures void TableFormattingContext::initialize_table_measures() { + // Implement the following parts of the specification, accounting for fixed layout mode: + // https://www.w3.org/TR/css-tables-3/#min-content-width-of-a-column-based-on-cells-of-span-up-to-1 + // https://www.w3.org/TR/css-tables-3/#max-content-width-of-a-column-based-on-cells-of-span-up-to-1 for (auto& cell : m_cells) { - if (cell.column_span == 1) { + if (cell.column_span == 1 && (cell.row_index == 0 || !use_fixed_mode_layout())) { m_columns[cell.column_index].min_size = max(m_columns[cell.column_index].min_size, cell.outer_min_width); m_columns[cell.column_index].max_size = max(m_columns[cell.column_index].max_size, cell.outer_max_width); } @@ -656,24 +668,24 @@ void TableFormattingContext::assign_columns_width_linear_combination(Vector -bool TableFormattingContext::distribute_excess_width_proportionally_to_max_width(CSSPixels excess_width, ColumnFilter column_filter) +template +bool TableFormattingContext::distribute_excess_width_proportionally_to_base_width(CSSPixels excess_width, ColumnFilter column_filter, BaseWidthGetter base_width_getter) { bool found_matching_columns = false; - CSSPixels total_max_width = 0; + CSSPixels total_base_width = 0; for (auto const& column : m_columns) { if (column_filter(column)) { - total_max_width += column.max_size; + total_base_width += base_width_getter(column); found_matching_columns = true; } } if (!found_matching_columns) { return false; } - VERIFY(total_max_width > 0); + VERIFY(total_base_width > 0); for (auto& column : m_columns) { if (column_filter(column)) { - column.used_width += excess_width * column.max_size / static_cast(total_max_width); + column.used_width += excess_width * base_width_getter(column) / static_cast(total_base_width); } } return true; @@ -740,6 +752,11 @@ void TableFormattingContext::distribute_width_to_columns() // 1. The min-content sizing-guess is the set of column width assignments where each column is assigned its min-content width. for (size_t i = 0; i < m_columns.size(); ++i) { auto& column = m_columns[i]; + // In fixed mode, the min-content width of percent-columns and auto-columns is considered to be zero: + // https://www.w3.org/TR/css-tables-3/#width-distribution-in-fixed-mode + if (use_fixed_mode_layout() && !column.is_constrained) { + continue; + } column.used_width = column.min_size; candidate_widths[i] = column.min_size; } @@ -821,14 +838,20 @@ void TableFormattingContext::distribute_excess_width_to_columns(CSSPixels availa return; } + if (use_fixed_mode_layout()) { + distribute_excess_width_to_columns_fixed_mode(excess_width); + return; + } + // 1. If there are non-constrained columns that have originating cells with intrinsic percentage width of 0% and with nonzero // max-content width (aka the columns allowed to grow by this rule), the distributed widths of the columns allowed to grow // by this rule are increased in proportion to max-content width so the total increase adds to the excess width. - if (distribute_excess_width_proportionally_to_max_width( + if (distribute_excess_width_proportionally_to_base_width( excess_width, [](auto const& column) { return !column.is_constrained && column.has_originating_cells && column.intrinsic_percentage == 0 && column.max_size > 0; - })) { + }, + [](auto const& column) { return column.max_size; })) { excess_width = available_width - compute_columns_total_used_width(); } if (excess_width == 0) { @@ -849,11 +872,12 @@ void TableFormattingContext::distribute_excess_width_to_columns(CSSPixels availa // 3. Otherwise, if there are constrained columns with intrinsic percentage width of 0% and with nonzero max-content width // (aka the columns allowed to grow by this rule, which, due to other rules, must have originating cells), the distributed widths of the // columns allowed to grow by this rule are increased in proportion to max-content width so the total increase adds to the excess width. - if (distribute_excess_width_proportionally_to_max_width( + if (distribute_excess_width_proportionally_to_base_width( excess_width, [](auto const& column) { return column.is_constrained && column.intrinsic_percentage == 0 && column.max_size > 0; - })) { + }, + [](auto const& column) { return column.max_size; })) { excess_width = available_width - compute_columns_total_used_width(); } if (excess_width == 0) { @@ -884,6 +908,27 @@ void TableFormattingContext::distribute_excess_width_to_columns(CSSPixels availa distribute_excess_width_equally(excess_width, [](auto const&) { return true; }); } +void TableFormattingContext::distribute_excess_width_to_columns_fixed_mode(CSSPixels excess_width) +{ + // Implements the fixed mode for https://www.w3.org/TR/css-tables-3/#distributing-width-to-columns. + + // If there are any columns with no width specified, the excess width is distributed in equally to such columns + if (distribute_excess_width_equally(excess_width, [](auto const& column) { return !column.is_constrained && !column.has_intrinsic_percentage; })) { + return; + } + // otherwise, if there are columns with non-zero length widths from the base assignment, the excess width is distributed proportionally to width among those columns + if (distribute_excess_width_proportionally_to_base_width( + excess_width, [](auto const& column) { return column.used_width > 0; }, [](auto const& column) { return column.used_width; })) { + return; + } + // otherwise, if there are columns with non-zero percentage widths from the base assignment, the excess width is distributed proportionally to percentage width among those columns + if (distribute_excess_width_by_intrinsic_percentage(excess_width, [](auto const& column) { return column.intrinsic_percentage > 0; })) { + return; + } + // otherwise, the excess width is distributed equally to the zero-sized columns + distribute_excess_width_equally(excess_width, [](auto const& column) { return column.used_width == 0; }); +} + void TableFormattingContext::compute_table_height(LayoutMode layout_mode) { // First pass of row height calculation: @@ -1184,6 +1229,16 @@ void TableFormattingContext::position_cell_boxes() } } +bool TableFormattingContext::use_fixed_mode_layout() const +{ + // Implements https://www.w3.org/TR/css-tables-3/#in-fixed-mode. + // A table-root is said to be laid out in fixed mode whenever the computed value of the table-layout property is equal to fixed, and the + // specified width of the table root is either a , min-content or fit-content. When the specified width is not one of + // those values, or if the computed value of the table-layout property is auto, then the table-root is said to be laid out in auto mode. + auto const& width = table_box().computed_values().width(); + return table_box().computed_values().table_layout() == CSS::TableLayout::Fixed && (width.is_length() || width.is_percentage() || width.is_min_content() || width.is_fit_content()); +} + bool TableFormattingContext::border_is_less_specific(const CSS::BorderData& a, const CSS::BorderData& b) { // Implements criteria for steps 1, 2 and 3 of border conflict resolution algorithm, as described in diff --git a/Userland/Libraries/LibWeb/Layout/TableFormattingContext.h b/Userland/Libraries/LibWeb/Layout/TableFormattingContext.h index 3f6ec414b08..060a4b1405f 100644 --- a/Userland/Libraries/LibWeb/Layout/TableFormattingContext.h +++ b/Userland/Libraries/LibWeb/Layout/TableFormattingContext.h @@ -50,6 +50,7 @@ private: void compute_table_width(); void distribute_width_to_columns(); void distribute_excess_width_to_columns(CSSPixels available_width); + void distribute_excess_width_to_columns_fixed_mode(CSSPixels excess_width); void compute_table_height(LayoutMode layout_mode); void distribute_height_to_rows(); void position_row_boxes(); @@ -62,13 +63,15 @@ private: void commit_candidate_column_widths(Vector const& candidate_widths); void assign_columns_width_linear_combination(Vector const& candidate_widths, CSSPixels available_width); - template - bool distribute_excess_width_proportionally_to_max_width(CSSPixels excess_width, ColumnFilter column_filter); + template + bool distribute_excess_width_proportionally_to_base_width(CSSPixels excess_width, ColumnFilter column_filter, BaseWidthGetter base_width_getter); template bool distribute_excess_width_equally(CSSPixels excess_width, ColumnFilter column_filter); template bool distribute_excess_width_by_intrinsic_percentage(CSSPixels excess_width, ColumnFilter column_filter); + bool use_fixed_mode_layout() const; + CSSPixels m_table_height { 0 }; CSSPixels m_automatic_content_height { 0 };