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

LibWeb: Move should_treat_{width,height}_as_auto() to FormattingContext

These are not specific to BFC, so let's move them up to the super class
so that other layout classes can use them.
This commit is contained in:
Andreas Kling 2022-11-03 18:44:40 +01:00
parent 5fbe245406
commit db318aece0
4 changed files with 15 additions and 15 deletions

View file

@ -1399,4 +1399,16 @@ float FormattingContext::calculate_stretch_fit_height(Box const& box, AvailableS
- box_state.border_bottom;
}
bool FormattingContext::should_treat_width_as_auto(Box const& box, AvailableSpace const& available_space)
{
return box.computed_values().width().is_auto()
|| (box.computed_values().width().contains_percentage() && !available_space.width.is_definite());
}
bool FormattingContext::should_treat_height_as_auto(Box const& box, AvailableSpace const& available_space)
{
return box.computed_values().height().is_auto()
|| (box.computed_values().height().contains_percentage() && !available_space.height.is_definite());
}
}