Skip to content

Commit 56ff9bf

Browse files
kalenikaliaksandrawesomekling
authored andcommitted
LibWeb: Support "normal" and "stretch" justify-content in CSS parser
1 parent b395cfc commit 56ff9bf

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ inset-block-end: auto
8787
inset-block-start: auto
8888
inset-inline-end: auto
8989
inset-inline-start: auto
90-
justify-content: flex-start
90+
justify-content: normal
9191
justify-items: legacy
9292
justify-self: auto
9393
left: auto

Userland/Libraries/LibWeb/CSS/Enums.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,14 +206,16 @@
206206
"optimizequality=smooth"
207207
],
208208
"justify-content": [
209+
"normal",
209210
"start",
210211
"end",
211212
"flex-start",
212213
"flex-end",
213214
"center",
214215
"space-between",
215216
"space-around",
216-
"space-evenly"
217+
"space-evenly",
218+
"stretch"
217219
],
218220
"justify-items": [
219221
"baseline",

Userland/Libraries/LibWeb/CSS/Properties.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1264,7 +1264,7 @@
12641264
},
12651265
"justify-content": {
12661266
"inherited": false,
1267-
"initial": "flex-start",
1267+
"initial": "normal",
12681268
"valid-types": [
12691269
"justify-content"
12701270
]

Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,6 +1319,8 @@ void FlexFormattingContext::distribute_any_remaining_free_space()
13191319
if (auto_margins == 0 && number_of_items > 0) {
13201320
switch (flex_container().computed_values().justify_content()) {
13211321
case CSS::JustifyContent::Start:
1322+
case CSS::JustifyContent::Stretch:
1323+
case CSS::JustifyContent::Normal:
13221324
initial_offset = 0;
13231325
break;
13241326
case CSS::JustifyContent::FlexStart:
@@ -1385,11 +1387,13 @@ void FlexFormattingContext::distribute_any_remaining_free_space()
13851387

13861388
if (auto_margins == 0) {
13871389
switch (flex_container().computed_values().justify_content()) {
1390+
case CSS::JustifyContent::Normal:
13881391
case CSS::JustifyContent::FlexStart:
13891392
case CSS::JustifyContent::Center:
13901393
case CSS::JustifyContent::SpaceAround:
13911394
case CSS::JustifyContent::SpaceBetween:
13921395
case CSS::JustifyContent::SpaceEvenly:
1396+
case CSS::JustifyContent::Stretch:
13931397
if (is_direction_reverse()) {
13941398
flex_region_render_cursor = FlexRegionRenderCursor::Right;
13951399
}
@@ -2221,6 +2225,8 @@ CSSPixelPoint FlexFormattingContext::calculate_static_position(Box const& box) c
22212225
CSSPixels main_offset = 0;
22222226
switch (flex_container().computed_values().justify_content()) {
22232227
case CSS::JustifyContent::Start:
2228+
case CSS::JustifyContent::Stretch:
2229+
case CSS::JustifyContent::Normal:
22242230
pack_from_end = false;
22252231
break;
22262232
case CSS::JustifyContent::FlexStart:

0 commit comments

Comments
 (0)