From 7d8d45e757ec16a73406746e179ab611a90a32d1 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Fri, 2 Apr 2021 13:32:28 -0400 Subject: [PATCH] LibWeb: Add a line box fragment for
nodes This is required for the block formatting context to know the height of the
element while computing the height of its parent. Specifically, this comes into play when the
element is the first or last child of its parent. In that case, it previously would not have any fragments, so BlockFormattingContext::compute_auto_height_for_block_level_element would infer its top and bottom positions to be 0. --- Userland/Libraries/LibWeb/Layout/BreakNode.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/Layout/BreakNode.cpp b/Userland/Libraries/LibWeb/Layout/BreakNode.cpp index 9951ae4fe0..79bff7cadd 100644 --- a/Userland/Libraries/LibWeb/Layout/BreakNode.cpp +++ b/Userland/Libraries/LibWeb/Layout/BreakNode.cpp @@ -42,7 +42,8 @@ BreakNode::~BreakNode() void BreakNode::split_into_lines(InlineFormattingContext& context, LayoutMode) { - context.containing_block().add_line_box(); + auto& line_box = context.containing_block().add_line_box(); + line_box.add_fragment(*this, 0, 0, 0, context.containing_block().line_height()); } }