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

LibWeb: Count flex item's *outer* size towards container intrinsic size

This isn't in the spec, but it's visually obvious that we need to count
item margin boxes towards the main intrinsic size of the flex container.
This commit is contained in:
Andreas Kling 2022-07-21 16:16:12 +02:00
parent b71f747453
commit 3145f92bc0

View file

@ -1425,6 +1425,10 @@ float FlexFormattingContext::calculate_intrinsic_main_size_of_flex_container(Lay
auto result = flex_item->flex_base_size + product;
// FIXME: Clamp result to min/max main size
// NOTE: The spec doesn't mention anything about the *outer* size here, but if we don't add the margin box,
// flex items with non-zero padding/border/margin in the main axis end up overflowing the container.
result = flex_item->add_main_margin_box_sizes(result);
sum += result;
}