From f0269b0a940d2a1824c129718558f82aa2cefee5 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 29 Jan 2024 15:54:33 +0100 Subject: [PATCH] LibWeb: Mark root element height as definite when affected by quirk This will be required for percentages to resolve against it correctly after we make set_content_height() not automatically mark heights as definite sizes. --- Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp index 2f216bdebb..98c6651358 100644 --- a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp @@ -455,6 +455,7 @@ CSSPixels BlockFormattingContext::compute_table_box_width_inside_table_wrapper(B void BlockFormattingContext::compute_height(Box const& box, AvailableSpace const& available_space) { auto const& computed_values = box.computed_values(); + auto& box_used_values = m_state.get_mutable(box); // Then work out what the height is, based on box type and CSS properties. CSSPixels height = 0; @@ -499,9 +500,12 @@ void BlockFormattingContext::compute_height(Box const& box, AvailableSpace const // 3. Return the bigger value of size and the normal border box size the element would have // according to the CSS specification. height = max(size, height); + + // NOTE: The height of the root element when affected by this quirk is considered to be definite. + box_used_values.set_has_definite_height(true); } - m_state.get_mutable(box).set_content_height(height); + box_used_values.set_content_height(height); } void BlockFormattingContext::layout_inline_children(BlockContainer const& block_container, LayoutMode layout_mode, AvailableSpace const& available_space)