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.
This commit is contained in:
Aliaksandr Kalenik 2022-12-11 03:18:34 +03:00 committed by Andreas Kling
parent daece542f5
commit 3922349b71
Notes: sideshowbarker 2024-07-17 08:59:18 +09:00

View file

@ -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) {