From 3922349b71b60d041bf2e4f1cde92568317d3688 Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Sun, 11 Dec 2022 03:18:34 +0300 Subject: [PATCH] LibWeb: Use space_used_by_floats to get x offset of box that creates BFC y of box should be taken in account while calculating space used by floats. --- Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp index c18bbf13ac..0ad28aad66 100644 --- a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp @@ -487,8 +487,10 @@ void BlockFormattingContext::place_block_level_element_in_normal_flow_horizontal if ((!m_left_floats.current_boxes.is_empty() || !m_right_floats.current_boxes.is_empty()) && creates_block_formatting_context(child_box)) { - available_width_within_containing_block -= m_left_floats.current_width + m_right_floats.current_width; - x += m_left_floats.current_width; + auto box_in_root_rect = content_box_rect_in_ancestor_coordinate_space(child_box, root(), m_state); + auto space = space_used_by_floats(box_in_root_rect.y()); + available_width_within_containing_block -= space.left + space.right; + x += space.left; } if (child_box.containing_block()->computed_values().text_align() == CSS::TextAlign::LibwebCenter) {