diff --git a/Userland/Libraries/LibWeb/CSS/ComputedValues.h b/Userland/Libraries/LibWeb/CSS/ComputedValues.h index 2d22d5ec62..4bb0bdd27d 100644 --- a/Userland/Libraries/LibWeb/CSS/ComputedValues.h +++ b/Userland/Libraries/LibWeb/CSS/ComputedValues.h @@ -66,6 +66,7 @@ public: static CSS::FlexBasis flex_basis() { return CSS::Size::make_auto(); } static CSS::ImageRendering image_rendering() { return CSS::ImageRendering::Auto; } static CSS::JustifyContent justify_content() { return CSS::JustifyContent::FlexStart; } + static CSS::JustifySelf justify_self() { return CSS::JustifySelf::Auto; } static CSS::AlignContent align_content() { return CSS::AlignContent::Stretch; } static CSS::AlignItems align_items() { return CSS::AlignItems::Stretch; } static CSS::AlignSelf align_self() { return CSS::AlignSelf::Auto; } @@ -253,6 +254,7 @@ public: CSS::Visibility visibility() const { return m_inherited.visibility; } CSS::ImageRendering image_rendering() const { return m_inherited.image_rendering; } CSS::JustifyContent justify_content() const { return m_noninherited.justify_content; } + CSS::JustifySelf justify_self() const { return m_noninherited.justify_self; } CSS::BackdropFilter const& backdrop_filter() const { return m_noninherited.backdrop_filter; } Vector const& box_shadow() const { return m_noninherited.box_shadow; } CSS::BoxSizing box_sizing() const { return m_noninherited.box_sizing; } @@ -401,6 +403,7 @@ protected: CSS::AlignSelf align_self { InitialValues::align_self() }; CSS::Appearance appearance { InitialValues::appearance() }; CSS::JustifyContent justify_content { InitialValues::justify_content() }; + CSS::JustifySelf justify_self { InitialValues::justify_self() }; CSS::Overflow overflow_x { InitialValues::overflow() }; CSS::Overflow overflow_y { InitialValues::overflow() }; float opacity { InitialValues::opacity() }; @@ -502,6 +505,7 @@ public: void set_appearance(CSS::Appearance value) { m_noninherited.appearance = value; } void set_opacity(float value) { m_noninherited.opacity = value; } void set_justify_content(CSS::JustifyContent value) { m_noninherited.justify_content = value; } + void set_justify_self(CSS::JustifySelf value) { m_noninherited.justify_self = value; } void set_box_shadow(Vector&& value) { m_noninherited.box_shadow = move(value); } void set_transformations(Vector value) { m_noninherited.transformations = move(value); } void set_transform_origin(CSS::TransformOrigin value) { m_noninherited.transform_origin = value; } diff --git a/Userland/Libraries/LibWeb/CSS/Enums.json b/Userland/Libraries/LibWeb/CSS/Enums.json index a6a3ab4a28..0b68187988 100644 --- a/Userland/Libraries/LibWeb/CSS/Enums.json +++ b/Userland/Libraries/LibWeb/CSS/Enums.json @@ -176,6 +176,21 @@ "space-around", "space-evenly" ], + "justify-self": [ + "auto", + "baseline", + "center", + "end", + "flex-end", + "flex-start", + "normal", + "safe", + "self-end", + "self-start", + "start", + "stretch", + "unsafe" + ], "line-style": [ "none", "hidden", diff --git a/Userland/Libraries/LibWeb/CSS/Properties.json b/Userland/Libraries/LibWeb/CSS/Properties.json index 9f3b381e33..0704f7a7cb 100644 --- a/Userland/Libraries/LibWeb/CSS/Properties.json +++ b/Userland/Libraries/LibWeb/CSS/Properties.json @@ -1260,6 +1260,13 @@ "justify-content" ] }, + "justify-self": { + "inherited": false, + "initial": "auto", + "valid-types": [ + "justify-self" + ] + }, "left": { "inherited": false, "initial": "auto", diff --git a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp index e43da914b9..9b6120c638 100644 --- a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp +++ b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp @@ -691,6 +691,8 @@ ErrorOr> ResolvedCSSStyleDeclaration::style_value_for_p return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().image_rendering())); case PropertyID::JustifyContent: return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().justify_content())); + case PropertyID::JustifySelf: + return TRY(IdentifierStyleValue::create(to_value_id(layout_node.computed_values().justify_self()))); case PropertyID::Left: return style_value_for_length_percentage(layout_node.computed_values().inset().left()); case PropertyID::LineHeight: diff --git a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp index 5ebf433559..76d6bce17f 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp @@ -405,6 +405,12 @@ Optional StyleProperties::justify_content() const return value_id_to_justify_content(value->to_identifier()); } +Optional StyleProperties::justify_self() const +{ + auto value = property(CSS::PropertyID::JustifySelf); + return value_id_to_justify_self(value->to_identifier()); +} + Vector StyleProperties::transformations() const { auto value = property(CSS::PropertyID::Transform); diff --git a/Userland/Libraries/LibWeb/CSS/StyleProperties.h b/Userland/Libraries/LibWeb/CSS/StyleProperties.h index 56758da90e..995506f5c5 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleProperties.h +++ b/Userland/Libraries/LibWeb/CSS/StyleProperties.h @@ -83,6 +83,7 @@ public: Optional visibility() const; Optional image_rendering() const; Optional justify_content() const; + Optional justify_self() const; Optional overflow_x() const; Optional overflow_y() const; Vector box_shadow(Layout::Node const&) const; diff --git a/Userland/Libraries/LibWeb/Layout/Node.cpp b/Userland/Libraries/LibWeb/Layout/Node.cpp index 5cdc175233..cde45f07c9 100644 --- a/Userland/Libraries/LibWeb/Layout/Node.cpp +++ b/Userland/Libraries/LibWeb/Layout/Node.cpp @@ -491,6 +491,10 @@ void NodeWithStyle::apply_style(const CSS::StyleProperties& computed_style) if (justify_content.has_value()) computed_values.set_justify_content(justify_content.value()); + auto justify_self = computed_style.justify_self(); + if (justify_self.has_value()) + computed_values.set_justify_self(justify_self.value()); + auto accent_color = computed_style.accent_color(*this); if (accent_color.has_value()) computed_values.set_accent_color(accent_color.value());