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. :^)
This commit is contained in:
Andreas Kling 2023-03-26 09:50:24 +02:00
parent d38392d416
commit 3932afdc6a
Notes: sideshowbarker 2024-07-17 08:59:18 +09:00

View file

@ -1758,16 +1758,6 @@ CSSPixels FlexFormattingContext::calculate_intrinsic_cross_size_of_flex_containe
// NOTE: We fall through to the ad-hoc section below. // 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; CSSPixels sum_of_flex_line_cross_sizes = 0;
for (auto& flex_line : m_flex_lines) { for (auto& flex_line : m_flex_lines) {
sum_of_flex_line_cross_sizes += flex_line.cross_size; sum_of_flex_line_cross_sizes += flex_line.cross_size;