From 3932afdc6abb63ade23b84e54edd3b39397c8d39 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 26 Mar 2023 09:50:24 +0200 Subject: [PATCH] LibWeb: Remove unnecessary repeat of partial flex layout algorithm When calculating one of the intrinsic sizes for a flex container, we already go through the flex layout algorithm. There's no need to perform some of the algorithm steps a second time. This is a relic from an earlier time when we tried to bail early from the layout algorithm in the intrinsic sizing case. Now that we go through the whole thing anyway, this is much simpler. :^) --- .../Libraries/LibWeb/Layout/FlexFormattingContext.cpp | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp index 3ccbd1213f..7333fedcf2 100644 --- a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp @@ -1758,16 +1758,6 @@ CSSPixels FlexFormattingContext::calculate_intrinsic_cross_size_of_flex_containe // NOTE: We fall through to the ad-hoc section below. } - // HACK: We run steps 5, 7, 9 and 11 from the main algorithm. This gives us *some* cross size information to work with. - m_flex_lines.clear(); - collect_flex_items_into_flex_lines(); - - for (auto& item : m_flex_items) { - determine_hypothetical_cross_size_of_item(item, false); - } - calculate_cross_size_of_each_flex_line(); - determine_used_cross_size_of_each_flex_item(); - CSSPixels sum_of_flex_line_cross_sizes = 0; for (auto& flex_line : m_flex_lines) { sum_of_flex_line_cross_sizes += flex_line.cross_size;