LibWeb: Allow flex-basis: {min,max,fit}-content

This commit is contained in:
Andreas Kling 2024-06-23 15:36:51 +02:00 committed by Andreas Kling
commit 9c02ace897
Notes: sideshowbarker 2024-07-16 20:12:13 +09:00
4 changed files with 61 additions and 1 deletions

View file

@ -603,6 +603,15 @@ void FlexFormattingContext::determine_flex_base_size_and_hypothetical_main_size(
// in this calculation use fit-content as the flex items cross size.
// The flex base size is the items resulting main size.
if (auto* size = item.used_flex_basis->get_pointer<CSS::Size>()) {
if (size->is_fit_content())
return calculate_fit_content_main_size(item);
if (size->is_max_content())
return calculate_max_content_main_size(item);
if (size->is_min_content())
return calculate_min_content_main_size(item);
}
// NOTE: If the flex item has a definite main size, just use that as the flex base size.
if (has_definite_main_size(item))
return inner_main_size(item);