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

LibWeb: Fix bogus min/max-height for box-sizing:border-box flex items

When resolving these constraints to CSS pixel sizes, we have to resolve
padding-top and padding-bottom against the flex container's *width*,
not its height.
This commit is contained in:
Andreas Kling 2023-03-10 11:54:52 +01:00
parent 24d5a9d7df
commit 0ef07383e5
3 changed files with 38 additions and 2 deletions

View file

@ -55,10 +55,11 @@ CSSPixels FlexFormattingContext::get_pixel_height(Box const& box, CSS::Size cons
{
auto containing_block_height = CSS::Length::make_px(containing_block_height_for(box));
if (box.computed_values().box_sizing() == CSS::BoxSizing::BorderBox) {
auto containing_block_width = CSS::Length::make_px(containing_block_width_for(box));
auto border_top = box.computed_values().border_top().width;
auto border_bottom = box.computed_values().border_bottom().width;
auto padding_top = box.computed_values().padding().top().resolved(box, containing_block_height).to_px(box);
auto padding_bottom = box.computed_values().padding().bottom().resolved(box, containing_block_height).to_px(box);
auto padding_top = box.computed_values().padding().top().resolved(box, containing_block_width).to_px(box);
auto padding_bottom = box.computed_values().padding().bottom().resolved(box, containing_block_width).to_px(box);
return size.resolved(box, containing_block_height).to_px(box) - border_top - border_bottom - padding_top - padding_bottom;
}