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

LibWeb: Use PercentageOr<T>::contains_percentage() in CSS layout

By asking if the value *contains* a percentage rather than whether it
*is* one, we cover many more cases where e.g `width: calc(100% - 10px)`
should be "treated as auto" etc.
This commit is contained in:
Andreas Kling 2022-09-14 11:34:36 +02:00
parent c4050fe675
commit b8aa6a4453
2 changed files with 14 additions and 14 deletions

View file

@ -818,13 +818,13 @@ float BlockFormattingContext::greatest_child_width(Box const& box)
bool BlockFormattingContext::should_treat_width_as_auto(Box const& box, LayoutState const& state)
{
return box.computed_values().width().is_auto()
|| (box.computed_values().width().is_percentage() && !state.get(*box.containing_block()).has_definite_width());
|| (box.computed_values().width().contains_percentage() && !state.get(*box.containing_block()).has_definite_width());
}
bool BlockFormattingContext::should_treat_height_as_auto(Box const& box, LayoutState const& state)
{
return box.computed_values().height().is_auto()
|| (box.computed_values().height().is_percentage() && !state.get(*box.containing_block()).has_definite_height());
|| (box.computed_values().height().contains_percentage() && !state.get(*box.containing_block()).has_definite_height());
}
}