mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:38:10 +00:00
LibWeb: Handle auto margins with flex and justify-content
Auto margins used together with justify-content would previously result in children being positioned outside their parent. This was solved by letting auto margins take precedence when they are used, which was already implemented to some extent before, but not fully.
This commit is contained in:
parent
a26f2f0aab
commit
6de701b5c3
4 changed files with 385 additions and 34 deletions
|
@ -1367,26 +1367,28 @@ void FlexFormattingContext::distribute_any_remaining_free_space()
|
|||
};
|
||||
auto flex_region_render_cursor = FlexRegionRenderCursor::Left;
|
||||
|
||||
switch (flex_container().computed_values().justify_content()) {
|
||||
case CSS::JustifyContent::FlexStart:
|
||||
case CSS::JustifyContent::Center:
|
||||
case CSS::JustifyContent::SpaceAround:
|
||||
case CSS::JustifyContent::SpaceBetween:
|
||||
case CSS::JustifyContent::SpaceEvenly:
|
||||
if (is_direction_reverse()) {
|
||||
if (auto_margins == 0) {
|
||||
switch (flex_container().computed_values().justify_content()) {
|
||||
case CSS::JustifyContent::FlexStart:
|
||||
case CSS::JustifyContent::Center:
|
||||
case CSS::JustifyContent::SpaceAround:
|
||||
case CSS::JustifyContent::SpaceBetween:
|
||||
case CSS::JustifyContent::SpaceEvenly:
|
||||
if (is_direction_reverse()) {
|
||||
flex_region_render_cursor = FlexRegionRenderCursor::Right;
|
||||
}
|
||||
break;
|
||||
case CSS::JustifyContent::End:
|
||||
flex_region_render_cursor = FlexRegionRenderCursor::Right;
|
||||
break;
|
||||
case CSS::JustifyContent::FlexEnd:
|
||||
if (!is_direction_reverse()) {
|
||||
flex_region_render_cursor = FlexRegionRenderCursor::Right;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case CSS::JustifyContent::End:
|
||||
flex_region_render_cursor = FlexRegionRenderCursor::Right;
|
||||
break;
|
||||
case CSS::JustifyContent::FlexEnd:
|
||||
if (!is_direction_reverse()) {
|
||||
flex_region_render_cursor = FlexRegionRenderCursor::Right;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
CSSPixels cursor_offset = initial_offset;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue