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

LibWeb: Stop changing width of block-level flex containers during layout

If the parent BFC can come up with a nice stretch-fit width for the flex
container, it will have already done so *before* even entering flex
layout. There's no need to do it again, midway through the flex layout
algorithm.

This wasn't just unnecessary, but we were also doing it incorrectly and
not taking margins into account when calculating the amount of available
space for stretch-fit. This led to oversized flex containers in the
presence of negative margins.

Fixes #18614
This commit is contained in:
Andreas Kling 2023-05-08 14:48:03 +02:00
parent 771208d2e2
commit 1ebae7a779
5 changed files with 24 additions and 4 deletions

View file

@ -1056,9 +1056,10 @@ CSSPixels BlockFormattingContext::greatest_child_width(Box const& box) const
return max_width;
}
void BlockFormattingContext::determine_width_of_child(Box const& box, AvailableSpace const& available_space)
void BlockFormattingContext::determine_width_of_child(Box const&, AvailableSpace const&)
{
compute_width(box, available_space);
// NOTE: We don't do anything here, since we'll have already determined the width of the child
// before recursing into nested layout within the child.
}
void BlockFormattingContext::determine_height_of_child(Box const& box, AvailableSpace const& available_space)