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

LibWeb: Make min-content height equivalent to max-content as appropriate

Per CSS-SIZING-3, the min-content block size should be equivalent to the
max-content block size for some boxes.

Honoring this gives more correct results, and avoids unnecessary work in
many cases since the cached max-content size can be reused.
This commit is contained in:
Andreas Kling 2023-01-23 17:24:56 +01:00
parent aa19c4a340
commit 4e06e86438

View file

@ -1146,8 +1146,13 @@ CSSPixels FormattingContext::calculate_max_content_width(Layout::Box const& box)
return *cache.max_content_width;
}
// https://www.w3.org/TR/css-sizing-3/#min-content-block-size
CSSPixels FormattingContext::calculate_min_content_height(Layout::Box const& box, AvailableSize const& available_width) const
{
// For block containers, tables, and inline boxes, this is equivalent to the max-content block size.
if (box.is_block_container() || box.is_table())
return calculate_max_content_height(box, available_width);
if (box.has_intrinsic_height())
return *box.intrinsic_height();