From dcc2568439c2f7086acf57fad2c6796e9bd599ce Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 15 Feb 2022 01:54:48 +0100 Subject: [PATCH] LibWeb: Make IFC register absolutely positioned descendants with BFC This allows BFC to position all absolutely positioned descendants in the same pass. --- Userland/Libraries/LibWeb/Layout/BlockFormattingContext.h | 2 ++ Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.h b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.h index fffb595003..b2d28c37b3 100644 --- a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.h +++ b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.h @@ -37,6 +37,8 @@ public: static void compute_height(Box&); + void add_absolutely_positioned_box(Box& box) { m_absolutely_positioned_boxes.append(box); } + protected: void compute_position(Box&); diff --git a/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp index 1fec64cbf1..8b65caf3cd 100644 --- a/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp @@ -78,7 +78,7 @@ void InlineFormattingContext::run(Box&, LayoutMode layout_mode) containing_block().for_each_child([&](auto& child) { VERIFY(child.is_inline()); if (is(child) && child.is_absolutely_positioned()) { - layout_absolutely_positioned_element(verify_cast(child)); + parent().add_absolutely_positioned_box(static_cast(child)); return; } });