From 7dc0edcb8625deae09317a1861d3c8d6ad9bca61 Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Mon, 16 Jan 2023 02:47:29 +0100 Subject: [PATCH] LibWeb: Prevent floats from being placed higher than preceding blocks CSS 2.2 section 9.5.1: The outer top of a floating box may not be higher than the outer top of any _block_ or floated box generated by an element earlier in the source document. Where block is `BlockContainer` in LibWeb type system. Which means `current_boxes` need to be cleared before leaving block container. ```html
``` --- Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp index cdd95cf793..59d11806cb 100644 --- a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp @@ -554,6 +554,8 @@ void BlockFormattingContext::layout_block_level_children(BlockContainer const& b }); m_margin_state.block_container_y_position_update_callback = {}; + m_left_floats.clear(); + m_right_floats.clear(); if (layout_mode == LayoutMode::IntrinsicSizing) { auto& block_container_state = m_state.get_mutable(block_container);