summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorimplicitfield <114500360+implicitfield@users.noreply.github.com>2022-12-20 21:16:29 +0200
committerAndreas Kling <kling@serenityos.org>2023-01-04 11:50:03 +0100
commite75eb21a54d41a1f77abe6f7ca0f158eca987baa (patch)
tree2d9e1d5d1ed38ce9a2e5befdfecd39be8b4a59e4 /Userland
parent4819ebe831f092a1ed9f63a888e55be83c99fdfa (diff)
downloadserenity-e75eb21a54d41a1f77abe6f7ca0f158eca987baa.zip
LibWeb: Support "start" and "end" values for justify-content
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibWeb/CSS/Enums.json2
-rw-r--r--Userland/Libraries/LibWeb/CSS/Identifiers.json2
-rw-r--r--Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp16
3 files changed, 20 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Enums.json b/Userland/Libraries/LibWeb/CSS/Enums.json
index 9c306150b9..34cdc7fb46 100644
--- a/Userland/Libraries/LibWeb/CSS/Enums.json
+++ b/Userland/Libraries/LibWeb/CSS/Enums.json
@@ -142,6 +142,8 @@
"optimizequality=smooth"
],
"justify-content": [
+ "start",
+ "end",
"flex-start",
"flex-end",
"center",
diff --git a/Userland/Libraries/LibWeb/CSS/Identifiers.json b/Userland/Libraries/LibWeb/CSS/Identifiers.json
index 24c25a7f94..a4b4628b62 100644
--- a/Userland/Libraries/LibWeb/CSS/Identifiers.json
+++ b/Userland/Libraries/LibWeb/CSS/Identifiers.json
@@ -109,6 +109,7 @@
"double",
"e-resize",
"enabled",
+ "end",
"ew-resize",
"fantasy",
"fast",
@@ -249,6 +250,7 @@
"srgb",
"standalone",
"standard",
+ "start",
"static",
"sticky",
"stretch",
diff --git a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
index c730e67b69..1d7b6aaa9f 100644
--- a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
@@ -1231,6 +1231,7 @@ void FlexFormattingContext::distribute_any_remaining_free_space()
bool justification_is_centered = false;
switch (flex_container().computed_values().justify_content()) {
+ case CSS::JustifyContent::Start:
case CSS::JustifyContent::FlexStart:
if (is_direction_reverse()) {
flex_region_render_cursor = FlexRegionRenderCursor::Right;
@@ -1239,6 +1240,7 @@ void FlexFormattingContext::distribute_any_remaining_free_space()
initial_offset = 0;
}
break;
+ case CSS::JustifyContent::End:
case CSS::JustifyContent::FlexEnd:
if (is_direction_reverse()) {
initial_offset = 0;
@@ -2002,6 +2004,20 @@ Gfx::FloatPoint FlexFormattingContext::calculate_static_position(Box const& box)
bool pack_from_end = true;
float main_offset = 0;
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:
if (is_direction_reverse()) {
pack_from_end = false;