From 8b34af816e83209fd5c8cc3f49a1d1ba3ca2b583 Mon Sep 17 00:00:00 2001 From: Andi Gallo Date: Sun, 25 Jun 2023 03:50:41 +0000 Subject: [PATCH] LibWeb: Report border box width for tables in a block For the containing block, table borders are opaque and have to be accounted when computing the table width since they use available space. --- ...ot-be-affected-by-presentational-hints.txt | 2 +- ...containing-block-has-indefinite-height.txt | 2 +- .../expected/table/align-top-and-bottom.txt | 2 +- ...border-spacing-and-borders-table-width.txt | 2 +- .../expected/table/border-spacing-colspan.txt | 2 +- .../expected/table/border-spacing-rowspan.txt | 2 +- .../Layout/expected/table/border-spacing.txt | 2 +- .../LibWeb/Layout/expected/table/borders.txt | 2 +- .../colspan-weighted-width-distribution.txt | 2 +- .../table/colspan-width-distribution.txt | 2 +- .../table/long-caption-increases-width.txt | 4 +- .../Layout/expected/table/multi-line-cell.txt | 2 +- .../expected/table/nested-table-box-width.txt | 82 +++++++++++++++++++ .../table/row-span-and-nested-tables.txt | 18 ++-- .../table/stretch-to-fixed-height.txt | 2 +- ...e-formation-with-rowspan-in-the-middle.txt | 2 +- .../Layout/expected/table/table-width.txt | 2 +- .../input/table/nested-table-box-width.html | 46 +++++++++++ .../LibWeb/Layout/BlockFormattingContext.cpp | 2 +- 19 files changed, 154 insertions(+), 26 deletions(-) create mode 100644 Tests/LibWeb/Layout/expected/table/nested-table-box-width.txt create mode 100644 Tests/LibWeb/Layout/input/table/nested-table-box-width.html diff --git a/Tests/LibWeb/Layout/expected/css-pseudo-element-should-not-be-affected-by-presentational-hints.txt b/Tests/LibWeb/Layout/expected/css-pseudo-element-should-not-be-affected-by-presentational-hints.txt index cb7fb71935..031731ee8b 100644 --- a/Tests/LibWeb/Layout/expected/css-pseudo-element-should-not-be-affected-by-presentational-hints.txt +++ b/Tests/LibWeb/Layout/expected/css-pseudo-element-should-not-be-affected-by-presentational-hints.txt @@ -1,7 +1,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline BlockContainer at (1,1) content-size 798x124 [BFC] children: not-inline BlockContainer at (10,10) content-size 780x106 children: not-inline - TableWrapper <(anonymous)> at (10,10) content-size 108x106 [BFC] children: not-inline + TableWrapper <(anonymous)> at (10,10) content-size 110x106 [BFC] children: not-inline Box at (11,11) content-size 108x104 table-box [TFC] children: not-inline Box at (11,11) content-size 104x100 table-row-group children: not-inline Box at (13,13) content-size 104x100 table-row children: not-inline diff --git a/Tests/LibWeb/Layout/expected/percentage-max-height-when-containing-block-has-indefinite-height.txt b/Tests/LibWeb/Layout/expected/percentage-max-height-when-containing-block-has-indefinite-height.txt index 8cd87fca7e..16ded62104 100644 --- a/Tests/LibWeb/Layout/expected/percentage-max-height-when-containing-block-has-indefinite-height.txt +++ b/Tests/LibWeb/Layout/expected/percentage-max-height-when-containing-block-has-indefinite-height.txt @@ -33,7 +33,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline TextNode <#text> BlockContainer <(anonymous)> at (10,93.875) content-size 780x0 children: inline TextNode <#text> - TableWrapper <(anonymous)> at (10,93.875) content-size 40.625x21.46875 [BFC] children: not-inline + TableWrapper <(anonymous)> at (10,93.875) content-size 42.625x21.46875 [BFC] children: not-inline Box at (11,94.875) content-size 40.625x19.46875 table-box [TFC] children: not-inline Box <(anonymous)> at (11,94.875) content-size 40.625x19.46875 table-row children: not-inline BlockContainer <(anonymous)> at (11,94.875) content-size 40.625x19.46875 table-cell [BFC] children: not-inline diff --git a/Tests/LibWeb/Layout/expected/table/align-top-and-bottom.txt b/Tests/LibWeb/Layout/expected/table/align-top-and-bottom.txt index b9ac14ae83..08eab9b692 100644 --- a/Tests/LibWeb/Layout/expected/table/align-top-and-bottom.txt +++ b/Tests/LibWeb/Layout/expected/table/align-top-and-bottom.txt @@ -1,7 +1,7 @@ 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 784x100.9375 children: not-inline - TableWrapper <(anonymous)> at (8,8) content-size 198.328125x100.9375 [BFC] children: not-inline + TableWrapper <(anonymous)> at (8,8) content-size 200.328125x100.9375 [BFC] children: not-inline Box
at (9,9) content-size 198.328125x98.9375 table-box [TFC] children: not-inline BlockContainer <(anonymous)> (not painted) children: inline TextNode <#text> diff --git a/Tests/LibWeb/Layout/expected/table/border-spacing-and-borders-table-width.txt b/Tests/LibWeb/Layout/expected/table/border-spacing-and-borders-table-width.txt index b3d1847b0a..8d4f50fa0c 100644 --- a/Tests/LibWeb/Layout/expected/table/border-spacing-and-borders-table-width.txt +++ b/Tests/LibWeb/Layout/expected/table/border-spacing-and-borders-table-width.txt @@ -1,7 +1,7 @@ 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 784x77.46875 children: not-inline - TableWrapper <(anonymous)> at (8,8) content-size 113.609375x77.46875 [BFC] children: not-inline + TableWrapper <(anonymous)> at (8,8) content-size 143.609375x77.46875 [BFC] children: not-inline Box
at (23,13) content-size 113.609375x67.46875 table-box [TFC] children: not-inline BlockContainer <(anonymous)> (not painted) children: inline TextNode <#text> diff --git a/Tests/LibWeb/Layout/expected/table/border-spacing-colspan.txt b/Tests/LibWeb/Layout/expected/table/border-spacing-colspan.txt index ab58de6f56..e9d1f4f930 100644 --- a/Tests/LibWeb/Layout/expected/table/border-spacing-colspan.txt +++ b/Tests/LibWeb/Layout/expected/table/border-spacing-colspan.txt @@ -5,7 +5,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline BlockContainer at (8,8) content-size 784x259.34375 children: not-inline BlockContainer <(anonymous)> at (8,8) content-size 784x0 children: inline TextNode <#text> - TableWrapper <(anonymous)> at (8,8) content-size 241.90625x259.34375 [BFC] children: not-inline + TableWrapper <(anonymous)> at (8,8) content-size 243.90625x259.34375 [BFC] children: not-inline Box
at (9,9) content-size 241.90625x257.34375 table-box [TFC] children: not-inline BlockContainer <(anonymous)> (not painted) children: inline TextNode <#text> diff --git a/Tests/LibWeb/Layout/expected/table/border-spacing-rowspan.txt b/Tests/LibWeb/Layout/expected/table/border-spacing-rowspan.txt index 993843ddb1..e3b7ef29df 100644 --- a/Tests/LibWeb/Layout/expected/table/border-spacing-rowspan.txt +++ b/Tests/LibWeb/Layout/expected/table/border-spacing-rowspan.txt @@ -5,7 +5,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline BlockContainer at (8,8) content-size 784x259.34375 children: not-inline BlockContainer <(anonymous)> at (8,8) content-size 784x0 children: inline TextNode <#text> - TableWrapper <(anonymous)> at (8,8) content-size 241.90625x259.34375 [BFC] children: not-inline + TableWrapper <(anonymous)> at (8,8) content-size 243.90625x259.34375 [BFC] children: not-inline Box
at (9,9) content-size 241.90625x257.34375 table-box [TFC] children: not-inline BlockContainer <(anonymous)> (not painted) children: inline TextNode <#text> diff --git a/Tests/LibWeb/Layout/expected/table/border-spacing.txt b/Tests/LibWeb/Layout/expected/table/border-spacing.txt index c5f36cd8e8..0dbd8f23f0 100644 --- a/Tests/LibWeb/Layout/expected/table/border-spacing.txt +++ b/Tests/LibWeb/Layout/expected/table/border-spacing.txt @@ -5,7 +5,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline BlockContainer at (8,8) content-size 784x259.34375 children: not-inline BlockContainer <(anonymous)> at (8,8) content-size 784x0 children: inline TextNode <#text> - TableWrapper <(anonymous)> at (8,8) content-size 241.90625x259.34375 [BFC] children: not-inline + TableWrapper <(anonymous)> at (8,8) content-size 243.90625x259.34375 [BFC] children: not-inline Box
at (9,9) content-size 241.90625x257.34375 table-box [TFC] children: not-inline BlockContainer <(anonymous)> (not painted) children: inline TextNode <#text> diff --git a/Tests/LibWeb/Layout/expected/table/borders.txt b/Tests/LibWeb/Layout/expected/table/borders.txt index 0b6547c76a..0622e77699 100644 --- a/Tests/LibWeb/Layout/expected/table/borders.txt +++ b/Tests/LibWeb/Layout/expected/table/borders.txt @@ -1,7 +1,7 @@ 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 784x285.625 children: not-inline - TableWrapper <(anonymous)> at (8,8) content-size 172.296875x74.40625 [BFC] children: not-inline + TableWrapper <(anonymous)> at (8,8) content-size 174.296875x74.40625 [BFC] children: not-inline Box at (9,9) content-size 172.296875x72.40625 table-box [TFC] children: not-inline BlockContainer <(anonymous)> (not painted) children: inline TextNode <#text> diff --git a/Tests/LibWeb/Layout/expected/table/colspan-weighted-width-distribution.txt b/Tests/LibWeb/Layout/expected/table/colspan-weighted-width-distribution.txt index dfe1323c77..2fe656fff0 100644 --- a/Tests/LibWeb/Layout/expected/table/colspan-weighted-width-distribution.txt +++ b/Tests/LibWeb/Layout/expected/table/colspan-weighted-width-distribution.txt @@ -1,7 +1,7 @@ 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 208x44.9375 [BFC] children: not-inline + TableWrapper <(anonymous)> at (8,8) content-size 210x44.9375 [BFC] children: not-inline Box
at (9,9) content-size 208x42.9375 table-box [TFC] children: not-inline BlockContainer <(anonymous)> (not painted) children: inline TextNode <#text> diff --git a/Tests/LibWeb/Layout/expected/table/colspan-width-distribution.txt b/Tests/LibWeb/Layout/expected/table/colspan-width-distribution.txt index 859ef37c81..49dd5f0d74 100644 --- a/Tests/LibWeb/Layout/expected/table/colspan-width-distribution.txt +++ b/Tests/LibWeb/Layout/expected/table/colspan-width-distribution.txt @@ -5,7 +5,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline BlockContainer at (8,8) content-size 784x44.9375 children: not-inline BlockContainer <(anonymous)> at (8,8) content-size 784x0 children: inline TextNode <#text> - TableWrapper <(anonymous)> at (8,8) content-size 37.3125x44.9375 [BFC] children: not-inline + TableWrapper <(anonymous)> at (8,8) content-size 39.3125x44.9375 [BFC] children: not-inline Box
at (9,9) content-size 37.3125x42.9375 table-box [TFC] children: not-inline BlockContainer <(anonymous)> (not painted) children: inline TextNode <#text> diff --git a/Tests/LibWeb/Layout/expected/table/long-caption-increases-width.txt b/Tests/LibWeb/Layout/expected/table/long-caption-increases-width.txt index 2c0e1a8cc3..fbdbbc790a 100644 --- a/Tests/LibWeb/Layout/expected/table/long-caption-increases-width.txt +++ b/Tests/LibWeb/Layout/expected/table/long-caption-increases-width.txt @@ -3,13 +3,13 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline BlockContainer <(anonymous)> at (0,0) content-size 800x0 children: inline TextNode <#text> BlockContainer at (8,8) content-size 784x111.8125 children: not-inline - TableWrapper <(anonymous)> at (8,8) content-size 59.046875x111.8125 [BFC] children: not-inline + TableWrapper <(anonymous)> at (8,8) content-size 63.046875x111.8125 [BFC] children: not-inline Box at (10,43.40625) content-size 59.046875x72.40625 table-box [TFC] children: not-inline BlockContainer <(anonymous)> (not painted) children: inline TextNode <#text> BlockContainer
at (8,8) content-size 59.046875x35.40625 [BFC] children: inline line 0 width: 54.03125, height: 17.46875, bottom: 17.46875, baseline: 13.53125 - frag 0 from TextNode start: 1, length: 6, rect: [9,8 54.03125x17.46875] + frag 0 from TextNode start: 1, length: 6, rect: [11,8 54.03125x17.46875] "A long" line 1 width: 59.046875, height: 17.9375, bottom: 35.40625, baseline: 13.53125 frag 0 from TextNode start: 8, length: 7, rect: [8,25 59.046875x17.46875] diff --git a/Tests/LibWeb/Layout/expected/table/multi-line-cell.txt b/Tests/LibWeb/Layout/expected/table/multi-line-cell.txt index 16d28ce3f8..2a4817ec28 100644 --- a/Tests/LibWeb/Layout/expected/table/multi-line-cell.txt +++ b/Tests/LibWeb/Layout/expected/table/multi-line-cell.txt @@ -1,7 +1,7 @@ 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 784x86.8125 children: not-inline - TableWrapper <(anonymous)> at (8,8) content-size 79.4375x86.8125 [BFC] children: not-inline + TableWrapper <(anonymous)> at (8,8) content-size 81.4375x86.8125 [BFC] children: not-inline Box at (9,9) content-size 79.4375x84.8125 table-box [TFC] children: not-inline BlockContainer <(anonymous)> (not painted) children: inline TextNode <#text> diff --git a/Tests/LibWeb/Layout/expected/table/nested-table-box-width.txt b/Tests/LibWeb/Layout/expected/table/nested-table-box-width.txt new file mode 100644 index 0000000000..027e1aa41c --- /dev/null +++ b/Tests/LibWeb/Layout/expected/table/nested-table-box-width.txt @@ -0,0 +1,82 @@ +Viewport <#document> at (0,0) content-size 800x600 children: not-inline + BlockContainer at (0,0) content-size 800x140.9375 [BFC] children: not-inline + BlockContainer <(anonymous)> at (0,0) content-size 800x0 children: inline + TextNode <#text> + BlockContainer at (8,8) content-size 784x124.9375 children: not-inline + BlockContainer <(anonymous)> at (8,8) content-size 784x0 children: inline + TextNode <#text> + TableWrapper <(anonymous)> at (8,8) content-size 115.828125x124.9375 [BFC] children: not-inline + Box
at (13,13) content-size 105.828125x114.9375 table-box [TFC] children: not-inline + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + Box at (13,13) content-size 99.828125x108.9375 table-row-group children: not-inline + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + Box at (15,15) content-size 99.828125x54.46875 table-row children: not-inline + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer
at (25,33.5) content-size 11.5625x17.46875 table-cell [BFC] children: inline + line 0 width: 11.5625, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 1, rect: [25,33.5 11.5625x17.46875] + "X" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer at (58.5625,25) content-size 48.265625x90.9375 table-cell [BFC] children: not-inline + BlockContainer <(anonymous)> at (58.5625,25) content-size 48.265625x0 children: inline + TextNode <#text> + TableWrapper <(anonymous)> at (58.5625,25) content-size 48.265625x90.9375 [BFC] children: not-inline + Box at (63.5625,30) content-size 38.265625x80.9375 table-box [TFC] children: not-inline + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + Box at (63.5625,30) content-size 34.265625x74.9375 table-row-group children: not-inline + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + Box at (65.5625,32) content-size 34.265625x37.46875 table-row children: not-inline + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer at (65.5625,69.46875) content-size 34.265625x37.46875 table-row children: not-inline + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer at (15,69.46875) content-size 99.828125x54.46875 table-row children: not-inline + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer
at (75.5625,42) content-size 14.265625x17.46875 table-cell [BFC] children: inline + line 0 width: 14.265625, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 1, rect: [75.5625,42 14.265625x17.46875] + "A" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + Box
at (75.5625,81.46875) content-size 14.265625x17.46875 table-cell [BFC] children: inline + line 0 width: 9.34375, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 1, rect: [75.5625,81.46875 9.34375x17.46875] + "B" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer <(anonymous)> at (58.5625,115.9375) content-size 48.265625x0 children: inline + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + Box
at (25,89.96875) content-size 11.5625x17.46875 table-cell [BFC] children: inline + line 0 width: 11.09375, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 1, rect: [25,89.96875 11.09375x17.46875] + "Y" + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer <(anonymous)> (not painted) children: inline + TextNode <#text> + BlockContainer <(anonymous)> at (8,132.9375) content-size 784x0 children: inline + TextNode <#text> diff --git a/Tests/LibWeb/Layout/expected/table/row-span-and-nested-tables.txt b/Tests/LibWeb/Layout/expected/table/row-span-and-nested-tables.txt index c509777b91..06503e312a 100644 --- a/Tests/LibWeb/Layout/expected/table/row-span-and-nested-tables.txt +++ b/Tests/LibWeb/Layout/expected/table/row-span-and-nested-tables.txt @@ -5,14 +5,14 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline BlockContainer at (8,8) content-size 784x116.40625 children: not-inline BlockContainer <(anonymous)> at (8,8) content-size 784x0 children: inline TextNode <#text> - TableWrapper <(anonymous)> at (8,8) content-size 71.828125x116.40625 [BFC] children: not-inline - Box at (9,9) content-size 71.828125x114.40625 table-box [TFC] children: not-inline + TableWrapper <(anonymous)> at (8,8) content-size 75.828125x116.40625 [BFC] children: not-inline + Box
at (9,9) content-size 73.828125x114.40625 table-box [TFC] children: not-inline BlockContainer <(anonymous)> (not painted) children: inline TextNode <#text> - Box at (9,9) content-size 65.828125x108.40625 table-row-group children: not-inline + Box at (9,9) content-size 67.828125x108.40625 table-row-group children: not-inline BlockContainer <(anonymous)> (not painted) children: inline TextNode <#text> - Box at (11,11) content-size 65.828125x54.203125 table-row children: not-inline + Box at (11,11) content-size 67.828125x54.203125 table-row children: not-inline BlockContainer <(anonymous)> (not painted) children: inline TextNode <#text> BlockContainer
at (17,29.367187) content-size 11.5625x17.46875 table-cell [BFC] children: inline @@ -22,10 +22,10 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline TextNode <#text> BlockContainer <(anonymous)> (not painted) children: inline TextNode <#text> - BlockContainer at (42.5625,17) content-size 30.265625x98.40625 table-cell [BFC] children: not-inline - BlockContainer <(anonymous)> at (42.5625,17) content-size 30.265625x0 children: inline + BlockContainer at (42.5625,17) content-size 32.265625x98.40625 table-cell [BFC] children: not-inline + BlockContainer <(anonymous)> at (42.5625,17) content-size 32.265625x0 children: inline TextNode <#text> - TableWrapper <(anonymous)> at (42.5625,17) content-size 30.265625x98.40625 [BFC] children: not-inline + TableWrapper <(anonymous)> at (42.5625,17) content-size 32.265625x98.40625 [BFC] children: not-inline Box at (43.5625,18) content-size 30.265625x96.40625 table-box [TFC] children: not-inline BlockContainer <(anonymous)> (not painted) children: inline TextNode <#text> @@ -70,13 +70,13 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline TextNode <#text> BlockContainer <(anonymous)> (not painted) children: inline TextNode <#text> - BlockContainer <(anonymous)> at (42.5625,115.40625) content-size 30.265625x0 children: inline + BlockContainer <(anonymous)> at (42.5625,115.40625) content-size 32.265625x0 children: inline TextNode <#text> BlockContainer <(anonymous)> (not painted) children: inline TextNode <#text> BlockContainer <(anonymous)> (not painted) children: inline TextNode <#text> - Box at (11,65.203125) content-size 65.828125x54.203125 table-row children: not-inline + Box at (11,65.203125) content-size 67.828125x54.203125 table-row children: not-inline BlockContainer <(anonymous)> (not painted) children: inline TextNode <#text> BlockContainer
at (17,85.570312) content-size 11.5625x17.46875 table-cell [BFC] children: inline diff --git a/Tests/LibWeb/Layout/expected/table/stretch-to-fixed-height.txt b/Tests/LibWeb/Layout/expected/table/stretch-to-fixed-height.txt index a847b324a1..f4195c93cb 100644 --- a/Tests/LibWeb/Layout/expected/table/stretch-to-fixed-height.txt +++ b/Tests/LibWeb/Layout/expected/table/stretch-to-fixed-height.txt @@ -1,7 +1,7 @@ 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 784x122 children: not-inline - TableWrapper <(anonymous)> at (8,8) content-size 2x122 [BFC] children: not-inline + TableWrapper <(anonymous)> at (8,8) content-size 24x122 [BFC] children: not-inline Box at (19,19) content-size 2x100 table-box [TFC] children: not-inline BlockContainer <(anonymous)> (not painted) children: inline TextNode <#text> diff --git a/Tests/LibWeb/Layout/expected/table/table-formation-with-rowspan-in-the-middle.txt b/Tests/LibWeb/Layout/expected/table/table-formation-with-rowspan-in-the-middle.txt index b7aa4ef453..1d09c7811f 100644 --- a/Tests/LibWeb/Layout/expected/table/table-formation-with-rowspan-in-the-middle.txt +++ b/Tests/LibWeb/Layout/expected/table/table-formation-with-rowspan-in-the-middle.txt @@ -1,7 +1,7 @@ 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 784x159.875 children: not-inline - TableWrapper <(anonymous)> at (8,8) content-size 101.421875x159.875 [BFC] children: not-inline + TableWrapper <(anonymous)> at (8,8) content-size 103.421875x159.875 [BFC] children: not-inline Box
at (9,9) content-size 101.421875x157.875 table-box [TFC] children: not-inline BlockContainer <(anonymous)> (not painted) children: inline TextNode <#text> diff --git a/Tests/LibWeb/Layout/expected/table/table-width.txt b/Tests/LibWeb/Layout/expected/table/table-width.txt index e27dfd71ff..a718277a71 100644 --- a/Tests/LibWeb/Layout/expected/table/table-width.txt +++ b/Tests/LibWeb/Layout/expected/table/table-width.txt @@ -1,7 +1,7 @@ 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 784x214 children: not-inline - TableWrapper <(anonymous)> at (8,8) content-size 584x214 [BFC] children: not-inline + TableWrapper <(anonymous)> at (8,8) content-size 784x214 [BFC] children: not-inline Box at (108,108) content-size 584x14 table-box [TFC] children: not-inline Box at (108,108) content-size 580x10 table-row-group children: not-inline Box at (110,110) content-size 580x10 table-row children: not-inline diff --git a/Tests/LibWeb/Layout/input/table/nested-table-box-width.html b/Tests/LibWeb/Layout/input/table/nested-table-box-width.html new file mode 100644 index 0000000000..3ae0011159 --- /dev/null +++ b/Tests/LibWeb/Layout/input/table/nested-table-box-width.html @@ -0,0 +1,46 @@ + + + + + + Rowspan interaction with nested tables + + + + + +
+ + + + + + + + + +
X + + + + + + + + + +
A
B
+
Y
+ + + \ No newline at end of file diff --git a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp index 135c78698e..ca9ccd280b 100644 --- a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp @@ -437,7 +437,7 @@ CSSPixels BlockFormattingContext::compute_table_box_width_inside_table_wrapper(B }); VERIFY(table_box.has_value()); - auto table_used_width = throwaway_state.get(*table_box).content_width(); + auto table_used_width = throwaway_state.get(*table_box).border_box_width(); return available_space.width.is_definite() ? min(table_used_width, available_width) : table_used_width; }