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

LibWeb: Fix bug where box-sizing: border-box made flex items too small

If a flex item has a preferred cross size of "auto", we should not be
subtracting padding and border in the cross axis when computing the
cross size.
This commit is contained in:
Andreas Kling 2023-04-27 10:21:55 +02:00
parent 824d23570a
commit d053cb6fae
3 changed files with 45 additions and 1 deletions

View file

@ -1099,7 +1099,7 @@ void FlexFormattingContext::determine_hypothetical_cross_size_of_item(FlexItem&
}
auto cross_size = [&]() {
if (item.box->computed_values().box_sizing() == CSS::BoxSizing::BorderBox) {
if (item.box->computed_values().box_sizing() == CSS::BoxSizing::BorderBox && !should_treat_cross_size_as_auto(item.box)) {
return max(CSSPixels(0.0f), resolved_definite_cross_size(item) - item.padding.cross_before - item.padding.cross_after - item.borders.cross_before - item.borders.cross_after);
}