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

LibWeb: Fix reverse flex layout with justify-content: normal

Before this change, we used the wrong insertion point for flex items
in reverse layouts with `justify-content: normal`. This caused flex
items to overflow the flex containers "backwards" from the start edge.
This commit is contained in:
Andreas Kling 2024-01-08 11:29:53 +01:00
parent 6480ed20b8
commit aa245f9f18
3 changed files with 42 additions and 4 deletions

View file

@ -1319,10 +1319,10 @@ void FlexFormattingContext::distribute_any_remaining_free_space()
if (auto_margins == 0 && number_of_items > 0) {
switch (flex_container().computed_values().justify_content()) {
case CSS::JustifyContent::Start:
case CSS::JustifyContent::Stretch:
case CSS::JustifyContent::Normal:
initial_offset = 0;
break;
case CSS::JustifyContent::Stretch:
case CSS::JustifyContent::Normal:
case CSS::JustifyContent::FlexStart:
if (is_direction_reverse()) {
initial_offset = inner_main_size(flex_container());
@ -2225,10 +2225,10 @@ CSSPixelPoint FlexFormattingContext::calculate_static_position(Box const& box) c
CSSPixels main_offset = 0;
switch (flex_container().computed_values().justify_content()) {
case CSS::JustifyContent::Start:
case CSS::JustifyContent::Stretch:
case CSS::JustifyContent::Normal:
pack_from_end = false;
break;
case CSS::JustifyContent::Stretch:
case CSS::JustifyContent::Normal:
case CSS::JustifyContent::FlexStart:
case CSS::JustifyContent::SpaceBetween:
pack_from_end = is_direction_reverse();