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

LibWeb: Support "normal" and "stretch" justify-content in CSS parser

This commit is contained in:
Aliaksandr Kalenik 2024-01-04 08:16:06 +01:00 committed by Andreas Kling
parent b395cfccb0
commit 56ff9bffae
4 changed files with 11 additions and 3 deletions

View file

@ -87,7 +87,7 @@ inset-block-end: auto
inset-block-start: auto
inset-inline-end: auto
inset-inline-start: auto
justify-content: flex-start
justify-content: normal
justify-items: legacy
justify-self: auto
left: auto

View file

@ -206,6 +206,7 @@
"optimizequality=smooth"
],
"justify-content": [
"normal",
"start",
"end",
"flex-start",
@ -213,7 +214,8 @@
"center",
"space-between",
"space-around",
"space-evenly"
"space-evenly",
"stretch"
],
"justify-items": [
"baseline",

View file

@ -1264,7 +1264,7 @@
},
"justify-content": {
"inherited": false,
"initial": "flex-start",
"initial": "normal",
"valid-types": [
"justify-content"
]

View file

@ -1319,6 +1319,8 @@ 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::FlexStart:
@ -1385,11 +1387,13 @@ void FlexFormattingContext::distribute_any_remaining_free_space()
if (auto_margins == 0) {
switch (flex_container().computed_values().justify_content()) {
case CSS::JustifyContent::Normal:
case CSS::JustifyContent::FlexStart:
case CSS::JustifyContent::Center:
case CSS::JustifyContent::SpaceAround:
case CSS::JustifyContent::SpaceBetween:
case CSS::JustifyContent::SpaceEvenly:
case CSS::JustifyContent::Stretch:
if (is_direction_reverse()) {
flex_region_render_cursor = FlexRegionRenderCursor::Right;
}
@ -2221,6 +2225,8 @@ 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::FlexStart: