1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:28:12 +00:00

LibWeb: Forbid usage of indefinite width in calculate_min{max}_height

Changing `calculate_min_content_heigh()` and
`calculate_min_content_heigh()` to accept width as `CSSPixels`, instead
of `AvailableSize` that might be indefinite, makes it more explicit
that width is supposed to be known by the time height is measured.

This change has a bit of collateral damage which is rows height
calculation regression in `table/inline-table-width` that worked before
by accident.
This commit is contained in:
Aliaksandr Kalenik 2023-08-12 15:17:17 +02:00 committed by Andreas Kling
parent 9b61339261
commit e25b1f76e1
8 changed files with 52 additions and 80 deletions

View file

@ -550,16 +550,16 @@ CSSPixels BlockFormattingContext::compute_auto_height_for_block_level_element(Bo
if (display.is_flex_inside()) {
// https://drafts.csswg.org/css-flexbox-1/#algo-main-container
// NOTE: The automatic block size of a block-level flex container is its max-content size.
return calculate_max_content_height(box, available_space.width);
return calculate_max_content_height(box, available_space.width.to_px_or_zero());
}
if (display.is_grid_inside()) {
// https://www.w3.org/TR/css-grid-2/#intrinsic-sizes
// In both inline and block formatting contexts, the grid containers auto block size is its
// max-content size.
return calculate_max_content_height(box, available_space.width);
return calculate_max_content_height(box, available_space.width.to_px_or_zero());
}
if (display.is_table_inside()) {
return calculate_max_content_height(box, available_space.width);
return calculate_max_content_height(box, available_space.width.to_px_or_zero());
}
// https://www.w3.org/TR/CSS22/visudet.html#normal-block