From f43f4feb1e8dd0289f74120bda79baa6c8d4e695 Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Sun, 29 Jan 2023 15:47:37 +0300 Subject: [PATCH] LibWeb: Table wrappers should not be ignored in auto height calculation Though table wrappers are anonymous block containers (because TableWrapper is inherited from BlockContainer) with no lines they should not be skipped in block auto height calculation. --- .../Layout/expected/table-auto-height.txt | 23 +++++++++++++++++++ .../Layout/input/table-auto-height.html | 11 +++++++++ .../LibWeb/Layout/BlockFormattingContext.cpp | 2 +- 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 Tests/LibWeb/Layout/expected/table-auto-height.txt create mode 100644 Tests/LibWeb/Layout/input/table-auto-height.html diff --git a/Tests/LibWeb/Layout/expected/table-auto-height.txt b/Tests/LibWeb/Layout/expected/table-auto-height.txt new file mode 100644 index 0000000000..b18390a120 --- /dev/null +++ b/Tests/LibWeb/Layout/expected/table-auto-height.txt @@ -0,0 +1,23 @@ +InitialContainingBlock <#document> at (0,0) content-size 800x600 children: not-inline + BlockContainer at (1,1) content-size 798x60.9375 children: not-inline + BlockContainer at (10,10) content-size 780x42.9375 children: not-inline + BlockContainer
at (11,11) content-size 778x19.46875 children: not-inline + TableWrapper <(anonymous)> at (11,11) content-size 29.15625x19.46875 children: not-inline + TableBox <(anonymous)> at (11,11) content-size 29.15625x19.46875 children: not-inline + TableRowBox <(anonymous)> at (11,11) content-size 29.15625x19.46875 children: not-inline + TableCellBox at (12,12) content-size 27.15625x17.46875 children: inline + line 0 width: 27.15625, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 3, rect: [12,12 27.15625x17.46875] + "foo" + TextNode <#text> + BlockContainer
at (11,32.46875) content-size 778x19.46875 children: not-inline + TableWrapper <(anonymous)> at (11,32.46875) content-size 29.640625x19.46875 children: not-inline + TableBox <(anonymous)> at (11,32.46875) content-size 29.640625x19.46875 children: not-inline + TableRowBox <(anonymous)> at (11,32.46875) content-size 29.640625x19.46875 children: not-inline + TableCellBox at (12,33.46875) content-size 27.640625x17.46875 children: inline + line 0 width: 27.640625, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 3, rect: [12,33.46875 27.640625x17.46875] + "bar" + TextNode <#text> + BlockContainer <(anonymous)> at (10,52.9375) content-size 780x0 children: inline + TextNode <#text> diff --git a/Tests/LibWeb/Layout/input/table-auto-height.html b/Tests/LibWeb/Layout/input/table-auto-height.html new file mode 100644 index 0000000000..545deaf580 --- /dev/null +++ b/Tests/LibWeb/Layout/input/table-auto-height.html @@ -0,0 +1,11 @@ +
foo
bar
diff --git a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp index e7b1940bd0..9a9f6abc66 100644 --- a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp @@ -433,7 +433,7 @@ CSSPixels BlockFormattingContext::compute_auto_height_for_block_level_element(Bo auto const& child_box_state = m_state.get(*child_box); // Ignore anonymous block containers with no lines. These don't count as in-flow block boxes. - if (child_box->is_anonymous() && child_box->is_block_container() && child_box_state.line_boxes.is_empty()) + if (!child_box->is_table_wrapper() && child_box->is_anonymous() && child_box->is_block_container() && child_box_state.line_boxes.is_empty()) continue; auto margin_bottom = m_margin_state.current_collapsed_margin();