LibWeb: Take margin box into account when justifying flex items

Before this patch, we were justifying based on the content box only,
which led to misalignments along the main axis when items had non-zero
padding, borders or margins.
This commit is contained in:
Andreas Kling 2022-07-12 00:17:13 +02:00
parent 96c9ca502b
commit 6ecf7db87b
Notes: sideshowbarker 2024-07-18 04:38:32 +09:00

View File

@ -1105,6 +1105,10 @@ void FlexFormattingContext::distribute_any_remaining_free_space()
if (is_main_axis_margin_second_auto(flex_item->box))
++auto_margins;
used_main_space += flex_item->margins.main_before + flex_item->margins.main_after
+ flex_item->borders.main_before + flex_item->borders.main_after
+ flex_item->padding.main_before + flex_item->padding.main_after;
}
if (flex_line.remaining_free_space > 0) {