From 0c6ad0a7405a07f633c5aa7b7b5e3a16ecfb6635 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 21 Apr 2025 15:30:42 +0200 Subject: [PATCH] LibWeb: Remove redundant call to fit-content sizing in flex layout We were calculating the fit-content cross size and then throwing it away and doing it again. You might think this wasn't so bad since fit-content relies on cacheable intrinsic sizes *buuuuut* since we're actually modifying the constraints for the second call, we were indeed doing completely wasted work here. --- Libraries/LibWeb/Layout/FlexFormattingContext.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/LibWeb/Layout/FlexFormattingContext.cpp b/Libraries/LibWeb/Layout/FlexFormattingContext.cpp index 28a72296edd..fc7e4b90537 100644 --- a/Libraries/LibWeb/Layout/FlexFormattingContext.cpp +++ b/Libraries/LibWeb/Layout/FlexFormattingContext.cpp @@ -1130,7 +1130,7 @@ void FlexFormattingContext::determine_hypothetical_cross_size_of_item(FlexItem& } // "... treating auto as fit-content" - auto fit_content_cross_size = calculate_fit_content_cross_size(item); + CSSPixels fit_content_cross_size; if (is_row_layout()) { auto available_width = item.main_size.has_value() ? AvailableSize::make_definite(item.main_size.value()) : AvailableSize::make_indefinite(); auto available_height = AvailableSize::make_indefinite();