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

LibWeb: Return CSSPixels from calculate_inner_height()

Similar to calculate_inner_width(), let's make the caller responsible
for handling "auto" instead of returning the input height as is when
when it cannot be resolved.
This commit is contained in:
Aliaksandr Kalenik 2024-01-07 05:46:36 +01:00 committed by Andreas Kling
parent 05a1dbeb91
commit 39abd9095e
6 changed files with 22 additions and 20 deletions

View file

@ -464,17 +464,18 @@ void BlockFormattingContext::compute_height(Box const& box, AvailableSpace const
if (should_treat_height_as_auto(box, available_space)) {
height = compute_auto_height_for_block_level_element(box, m_state.get(box).available_inner_space_or_constraints_from(available_space));
} else {
height = calculate_inner_height(box, available_space.height, computed_values.height()).to_px(box);
height = calculate_inner_height(box, available_space.height, computed_values.height());
}
}
if (!should_treat_max_height_as_none(box, available_space.height)) {
auto max_height = calculate_inner_height(box, available_space.height, computed_values.max_height());
if (!max_height.is_auto())
height = min(height, max_height.to_px(box));
if (!computed_values.max_height().is_auto()) {
auto max_height = calculate_inner_height(box, available_space.height, computed_values.max_height());
height = min(height, max_height);
}
}
if (!computed_values.min_height().is_auto()) {
height = max(height, calculate_inner_height(box, available_space.height, computed_values.min_height()).to_px(box));
height = max(height, calculate_inner_height(box, available_space.height, computed_values.min_height()));
}
if (box.document().in_quirks_mode()