From da0cc9d40174835b1d0c58fead911593180a3bce Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 21 Jul 2022 00:27:53 +0200 Subject: [PATCH] LibWeb: Floor hypothetical main size at 0 The spec asks us to do this. It doesn't become relevant until we implement box-sizing, but might as well do it anyway. --- Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp index d0f478eb35..cd37937fda 100644 --- a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp @@ -633,7 +633,7 @@ void FlexFormattingContext::determine_flex_base_size_and_hypothetical_main_size( // The hypothetical main size is the item’s flex base size clamped according to its used min and max main sizes (and flooring the content box size at zero). auto clamp_min = has_main_min_size(child_box) ? specified_main_min_size(child_box) : automatic_minimum_size(flex_item); auto clamp_max = has_main_max_size(child_box) ? specified_main_max_size(child_box) : NumericLimits::max(); - flex_item.hypothetical_main_size = css_clamp(flex_item.flex_base_size, clamp_min, clamp_max); + flex_item.hypothetical_main_size = max(0, css_clamp(flex_item.flex_base_size, clamp_min, clamp_max)); } // https://drafts.csswg.org/css-flexbox-1/#min-size-auto