1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:17:44 +00:00

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.
This commit is contained in:
Andreas Kling 2022-07-21 00:27:53 +02:00
parent e9e187d15c
commit da0cc9d401

View file

@ -633,7 +633,7 @@ void FlexFormattingContext::determine_flex_base_size_and_hypothetical_main_size(
// The hypothetical main size is the items 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<float>::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