mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-07 00:29:15 +00:00
LibWeb: Support reverse flex layout with space-around/space-between
We were not taking reverse flex directions into account when choosing the initial offset for flex item placement if justify-content were either space-around or space-between.
This commit is contained in:
parent
d15ae9fa93
commit
30feb95d53
Notes:
sideshowbarker
2024-07-17 18:08:55 +09:00
Author: https://github.com/awesomekling
Commit: 30feb95d53
Pull-request: https://github.com/SerenityOS/serenity/pull/19108
3 changed files with 103 additions and 1 deletions
|
@ -1323,11 +1323,20 @@ void FlexFormattingContext::distribute_any_remaining_free_space()
|
|||
}
|
||||
break;
|
||||
case CSS::JustifyContent::SpaceBetween:
|
||||
if (is_direction_reverse()) {
|
||||
initial_offset = inner_main_size(flex_container());
|
||||
} else {
|
||||
initial_offset = 0;
|
||||
}
|
||||
space_between_items = flex_line.remaining_free_space / (number_of_items - 1);
|
||||
break;
|
||||
case CSS::JustifyContent::SpaceAround:
|
||||
space_between_items = flex_line.remaining_free_space / number_of_items;
|
||||
initial_offset = space_between_items / 2.0;
|
||||
if (is_direction_reverse()) {
|
||||
initial_offset = inner_main_size(flex_container()) - space_between_items / 2.0;
|
||||
} else {
|
||||
initial_offset = space_between_items / 2.0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue