1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 07:37:35 +00:00

LibWeb: Fix a case of incorrect flex container max-content main size

We were incorrectly returning a "specified size suggestion" for flex
items with a definite main size where that main size was also automatic.

This led to us incorrectly choosing 0 as the automatic minimum size for
that flex item, instead of its min-content size.
This commit is contained in:
Andreas Kling 2023-06-08 11:09:35 +02:00
parent cb912f0e1a
commit a5f8f8238f
3 changed files with 23 additions and 1 deletions

View file

@ -750,7 +750,7 @@ Optional<CSSPixels> FlexFormattingContext::specified_size_suggestion(FlexItem co
{
// If the items preferred main size is definite and not automatic,
// then the specified size suggestion is that size. It is otherwise undefined.
if (has_definite_main_size(item.box)) {
if (has_definite_main_size(item.box) && !should_treat_main_size_as_auto(item.box)) {
// NOTE: We use get_pixel_{width,height} to ensure that CSS box-sizing is respected.
return is_row_layout() ? get_pixel_width(item.box, computed_main_size(item.box)) : get_pixel_height(item.box, computed_main_size(item.box));
}