From 5b1aa2d55ea7b3b993948f69bf5b8840b6625944 Mon Sep 17 00:00:00 2001 From: Karol Kosek Date: Tue, 11 Jul 2023 12:56:26 +0200 Subject: [PATCH] LibWeb: Don't collapse boxes with CSS clear property set I'm not sure if this is exactly correct, the link to CSS2 spec above says something that clearance cannot separate boxes, but I'm not sure if I understood it correctly or if I've done it in the right place. However, this change fixes our block-and-inline/clearfix.html test again (was regressed in previous commit). --- Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp index 8c896a5f87..e484e2e8e0 100644 --- a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp @@ -57,6 +57,10 @@ static bool margins_collapse_through(Box const& box, LayoutState& state) // FIXME: For the purpose of margin collapsing (CSS 2 ยง8.3.1 Collapsing margins), if the block axis is the // ratio-dependent axis, it is not considered to have a computed block-size of auto. // https://www.w3.org/TR/css-sizing-4/#aspect-ratio-margin-collapse + + if (box.computed_values().clear() != CSS::Clear::None) + return false; + return state.get(box).border_box_height() == 0; }