1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:38:11 +00:00

LibWeb: Account for box-sizing:border-box in layout-less definite sizes

When we determine that a size is definite because it can be resolved now
without performing layout, we also need to account for the box-sizing
property.

This lets us remove a hack from flex layout where box-sizing:border-box
was manually undone at one point in the layout algorithm.
This commit is contained in:
Andreas Kling 2023-05-02 06:51:32 +02:00
parent deea7cbc11
commit 00e3e82bbd
4 changed files with 53 additions and 13 deletions

View file

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