From 0fd51ae8118931d1f735589525deffbd26a74f84 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 29 Mar 2022 22:27:53 +0200 Subject: [PATCH] LibWeb: Ignore empty anonymous block children in height:auto calculation This fixes a regression on GitHub from 5da7ebb806cd3be5b126ec22bfda926c7319e4f7. Thanks to Simon for reporting it! :^) --- Userland/Libraries/LibWeb/Layout/FormattingContext.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp index e7759e33d7..fe2f1a82aa 100644 --- a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp @@ -226,8 +226,13 @@ float FormattingContext::compute_auto_height_for_block_level_element(FormattingS if (child_box->is_list_item_marker_box()) continue; - // FIXME: Handle margin collapsing. auto const& child_box_state = 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()) + continue; + + // FIXME: Handle margin collapsing. return max(0, child_box_state.offset.y() + child_box_state.content_height + child_box_state.margin_box_bottom()); } }