1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:17:35 +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-block-start: auto
inset-inline-end: auto inset-inline-end: auto
inset-inline-start: auto inset-inline-start: auto
justify-content: flex-start justify-content: normal
justify-items: legacy justify-items: legacy
justify-self: auto justify-self: auto
left: auto left: auto

View file

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

View file

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

View file

@ -1319,6 +1319,8 @@ void FlexFormattingContext::distribute_any_remaining_free_space()
if (auto_margins == 0 && number_of_items > 0) { if (auto_margins == 0 && number_of_items > 0) {
switch (flex_container().computed_values().justify_content()) { switch (flex_container().computed_values().justify_content()) {
case CSS::JustifyContent::Start: case CSS::JustifyContent::Start:
case CSS::JustifyContent::Stretch:
case CSS::JustifyContent::Normal:
initial_offset = 0; initial_offset = 0;
break; break;
case CSS::JustifyContent::FlexStart: case CSS::JustifyContent::FlexStart:
@ -1385,11 +1387,13 @@ void FlexFormattingContext::distribute_any_remaining_free_space()
if (auto_margins == 0) { if (auto_margins == 0) {
switch (flex_container().computed_values().justify_content()) { switch (flex_container().computed_values().justify_content()) {
case CSS::JustifyContent::Normal:
case CSS::JustifyContent::FlexStart: case CSS::JustifyContent::FlexStart:
case CSS::JustifyContent::Center: case CSS::JustifyContent::Center:
case CSS::JustifyContent::SpaceAround: case CSS::JustifyContent::SpaceAround:
case CSS::JustifyContent::SpaceBetween: case CSS::JustifyContent::SpaceBetween:
case CSS::JustifyContent::SpaceEvenly: case CSS::JustifyContent::SpaceEvenly:
case CSS::JustifyContent::Stretch:
if (is_direction_reverse()) { if (is_direction_reverse()) {
flex_region_render_cursor = FlexRegionRenderCursor::Right; flex_region_render_cursor = FlexRegionRenderCursor::Right;
} }
@ -2221,6 +2225,8 @@ CSSPixelPoint FlexFormattingContext::calculate_static_position(Box const& box) c
CSSPixels main_offset = 0; CSSPixels main_offset = 0;
switch (flex_container().computed_values().justify_content()) { switch (flex_container().computed_values().justify_content()) {
case CSS::JustifyContent::Start: case CSS::JustifyContent::Start:
case CSS::JustifyContent::Stretch:
case CSS::JustifyContent::Normal:
pack_from_end = false; pack_from_end = false;
break; break;
case CSS::JustifyContent::FlexStart: case CSS::JustifyContent::FlexStart: