1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:57:44 +00:00

LibWeb: Support "start" and "end" values for justify-content

This commit is contained in:
implicitfield 2022-12-20 21:16:29 +02:00 committed by Andreas Kling
parent 4819ebe831
commit e75eb21a54
3 changed files with 20 additions and 0 deletions

View file

@ -142,6 +142,8 @@
"optimizequality=smooth" "optimizequality=smooth"
], ],
"justify-content": [ "justify-content": [
"start",
"end",
"flex-start", "flex-start",
"flex-end", "flex-end",
"center", "center",

View file

@ -109,6 +109,7 @@
"double", "double",
"e-resize", "e-resize",
"enabled", "enabled",
"end",
"ew-resize", "ew-resize",
"fantasy", "fantasy",
"fast", "fast",
@ -249,6 +250,7 @@
"srgb", "srgb",
"standalone", "standalone",
"standard", "standard",
"start",
"static", "static",
"sticky", "sticky",
"stretch", "stretch",

View file

@ -1231,6 +1231,7 @@ void FlexFormattingContext::distribute_any_remaining_free_space()
bool justification_is_centered = false; bool justification_is_centered = false;
switch (flex_container().computed_values().justify_content()) { switch (flex_container().computed_values().justify_content()) {
case CSS::JustifyContent::Start:
case CSS::JustifyContent::FlexStart: case CSS::JustifyContent::FlexStart:
if (is_direction_reverse()) { if (is_direction_reverse()) {
flex_region_render_cursor = FlexRegionRenderCursor::Right; flex_region_render_cursor = FlexRegionRenderCursor::Right;
@ -1239,6 +1240,7 @@ void FlexFormattingContext::distribute_any_remaining_free_space()
initial_offset = 0; initial_offset = 0;
} }
break; break;
case CSS::JustifyContent::End:
case CSS::JustifyContent::FlexEnd: case CSS::JustifyContent::FlexEnd:
if (is_direction_reverse()) { if (is_direction_reverse()) {
initial_offset = 0; initial_offset = 0;
@ -2002,6 +2004,20 @@ Gfx::FloatPoint FlexFormattingContext::calculate_static_position(Box const& box)
bool pack_from_end = true; bool pack_from_end = true;
float main_offset = 0; float main_offset = 0;
switch (flex_container().computed_values().justify_content()) { switch (flex_container().computed_values().justify_content()) {
case CSS::JustifyContent::Start:
if (is_direction_reverse()) {
main_offset = specified_main_size(flex_container());
} else {
main_offset = 0;
}
break;
case CSS::JustifyContent::End:
if (is_direction_reverse()) {
main_offset = 0;
} else {
main_offset = specified_main_size(flex_container());
}
break;
case CSS::JustifyContent::FlexStart: case CSS::JustifyContent::FlexStart:
if (is_direction_reverse()) { if (is_direction_reverse()) {
pack_from_end = false; pack_from_end = false;