mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 05:09:12 +00:00
LibWeb: Implement justify-*: left/right
This commit is contained in:
parent
80e37db280
commit
4a3a9e6ec4
Notes:
github-actions[bot]
2024-09-10 09:41:09 +00:00
Author: https://github.com/Gingeh
Commit: 4a3a9e6ec4
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1338
Reviewed-by: https://github.com/AtkinsSJ ✅
3 changed files with 41 additions and 4 deletions
|
@ -1262,6 +1262,7 @@ 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::Left:
|
||||
initial_offset = 0;
|
||||
break;
|
||||
case CSS::JustifyContent::Stretch:
|
||||
|
@ -1276,6 +1277,13 @@ void FlexFormattingContext::distribute_any_remaining_free_space()
|
|||
case CSS::JustifyContent::End:
|
||||
initial_offset = inner_main_size(m_flex_container_state);
|
||||
break;
|
||||
case CSS::JustifyContent::Right:
|
||||
if (is_row_layout()) {
|
||||
initial_offset = inner_main_size(m_flex_container_state);
|
||||
} else {
|
||||
initial_offset = 0;
|
||||
}
|
||||
break;
|
||||
case CSS::JustifyContent::FlexEnd:
|
||||
if (is_direction_reverse()) {
|
||||
initial_offset = 0;
|
||||
|
@ -1330,6 +1338,10 @@ void FlexFormattingContext::distribute_any_remaining_free_space()
|
|||
|
||||
if (auto_margins == 0) {
|
||||
switch (flex_container().computed_values().justify_content()) {
|
||||
case CSS::JustifyContent::Start:
|
||||
case CSS::JustifyContent::Left:
|
||||
flex_region_render_cursor = FlexRegionRenderCursor::Left;
|
||||
break;
|
||||
case CSS::JustifyContent::Normal:
|
||||
case CSS::JustifyContent::FlexStart:
|
||||
case CSS::JustifyContent::Center:
|
||||
|
@ -1344,6 +1356,13 @@ void FlexFormattingContext::distribute_any_remaining_free_space()
|
|||
case CSS::JustifyContent::End:
|
||||
flex_region_render_cursor = FlexRegionRenderCursor::Right;
|
||||
break;
|
||||
case CSS::JustifyContent::Right:
|
||||
if (is_row_layout()) {
|
||||
flex_region_render_cursor = FlexRegionRenderCursor::Right;
|
||||
} else {
|
||||
flex_region_render_cursor = FlexRegionRenderCursor::Left;
|
||||
}
|
||||
break;
|
||||
case CSS::JustifyContent::FlexEnd:
|
||||
if (!is_direction_reverse()) {
|
||||
flex_region_render_cursor = FlexRegionRenderCursor::Right;
|
||||
|
@ -2172,6 +2191,7 @@ 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::Left:
|
||||
pack_from_end = false;
|
||||
break;
|
||||
case CSS::JustifyContent::Stretch:
|
||||
|
@ -2183,6 +2203,9 @@ CSSPixelPoint FlexFormattingContext::calculate_static_position(Box const& box) c
|
|||
case CSS::JustifyContent::End:
|
||||
pack_from_end = true;
|
||||
break;
|
||||
case CSS::JustifyContent::Right:
|
||||
pack_from_end = is_row_layout();
|
||||
break;
|
||||
case CSS::JustifyContent::FlexEnd:
|
||||
pack_from_end = !is_direction_reverse();
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue