From 967b257518cc4ac165a558862b51a536ac3df4af Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 21 Jun 2022 20:40:26 +0200 Subject: [PATCH] LibWeb: Make FFC prepare replaced child boxes for layout Before we ask a replaced box about its intrinsic dimensions, we have to "prepare" the box, which tells it to go and work out what its intrinsic dimensions are. I've added a FIXME about how this is silly (and clearly bug-prone) but this patch only patches it locally in FFC for now. --- Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp index d0ca777890..b2c0b6f2ce 100644 --- a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include namespace Web::Layout { @@ -70,6 +71,10 @@ void FlexFormattingContext::run(Box const& run_box, LayoutMode layout_mode) // 3. Determine the flex base size and hypothetical main size of each item for (auto& flex_item : m_flex_items) { + if (flex_item.box.is_replaced_box()) { + // FIXME: Get rid of prepare_for_replaced_layout() and make replaced elements figure out their intrinsic size lazily. + static_cast(flex_item.box).prepare_for_replaced_layout(); + } determine_flex_base_size_and_hypothetical_main_size(flex_item); }