mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +00:00
LibWeb: Parse the CSS align-content property
This commit is contained in:
parent
b062a0fb7c
commit
f8a2c0586a
Notes:
sideshowbarker
2024-07-17 05:47:47 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/f8a2c0586a
6 changed files with 30 additions and 0 deletions
|
@ -42,6 +42,7 @@ public:
|
|||
static CSS::FlexWrap flex_wrap() { return CSS::FlexWrap::Nowrap; }
|
||||
static CSS::ImageRendering image_rendering() { return CSS::ImageRendering::Auto; }
|
||||
static CSS::JustifyContent justify_content() { return CSS::JustifyContent::FlexStart; }
|
||||
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; }
|
||||
static CSS::Appearance appearance() { return CSS::Appearance::Auto; }
|
||||
|
@ -163,6 +164,7 @@ public:
|
|||
float flex_grow() const { return m_noninherited.flex_grow; }
|
||||
float flex_shrink() const { return m_noninherited.flex_shrink; }
|
||||
int order() const { return m_noninherited.order; }
|
||||
CSS::AlignContent align_content() const { return m_noninherited.align_content; }
|
||||
CSS::AlignItems align_items() const { return m_noninherited.align_items; }
|
||||
CSS::AlignSelf align_self() const { return m_noninherited.align_self; }
|
||||
CSS::Appearance appearance() const { return m_noninherited.appearance; }
|
||||
|
@ -288,6 +290,7 @@ protected:
|
|||
float flex_grow { InitialValues::flex_grow() };
|
||||
float flex_shrink { InitialValues::flex_shrink() };
|
||||
int order { InitialValues::order() };
|
||||
CSS::AlignContent align_content { InitialValues::align_content() };
|
||||
CSS::AlignItems align_items { InitialValues::align_items() };
|
||||
CSS::AlignSelf align_self { InitialValues::align_self() };
|
||||
CSS::Appearance appearance { InitialValues::appearance() };
|
||||
|
@ -367,6 +370,7 @@ public:
|
|||
void set_flex_grow(float value) { m_noninherited.flex_grow = value; }
|
||||
void set_flex_shrink(float value) { m_noninherited.flex_shrink = value; }
|
||||
void set_order(int value) { m_noninherited.order = value; }
|
||||
void set_align_content(CSS::AlignContent value) { m_noninherited.align_content = value; }
|
||||
void set_align_items(CSS::AlignItems value) { m_noninherited.align_items = value; }
|
||||
void set_align_self(CSS::AlignSelf value) { m_noninherited.align_self = value; }
|
||||
void set_appearance(CSS::Appearance value) { m_noninherited.appearance = value; }
|
||||
|
|
|
@ -1,4 +1,12 @@
|
|||
{
|
||||
"align-content": [
|
||||
"flex-start",
|
||||
"flex-end",
|
||||
"center",
|
||||
"space-between",
|
||||
"space-around",
|
||||
"stretch"
|
||||
],
|
||||
"align-items": [
|
||||
"baseline",
|
||||
"center",
|
||||
|
|
|
@ -1,4 +1,11 @@
|
|||
{
|
||||
"align-content": {
|
||||
"inherited": false,
|
||||
"initial": "stretch",
|
||||
"valid-types": [
|
||||
"align-content"
|
||||
]
|
||||
},
|
||||
"align-items": {
|
||||
"inherited": false,
|
||||
"initial": "stretch",
|
||||
|
|
|
@ -349,6 +349,12 @@ CSS::TransformOrigin StyleProperties::transform_origin() const
|
|||
return { x_value.value(), y_value.value() };
|
||||
}
|
||||
|
||||
Optional<CSS::AlignContent> StyleProperties::align_content() const
|
||||
{
|
||||
auto value = property(CSS::PropertyID::AlignContent);
|
||||
return value_id_to_align_content(value->to_identifier());
|
||||
}
|
||||
|
||||
Optional<CSS::AlignItems> StyleProperties::align_items() const
|
||||
{
|
||||
auto value = property(CSS::PropertyID::AlignItems);
|
||||
|
|
|
@ -68,6 +68,7 @@ public:
|
|||
float flex_grow() const;
|
||||
float flex_shrink() const;
|
||||
int order() const;
|
||||
Optional<CSS::AlignContent> align_content() const;
|
||||
Optional<CSS::AlignItems> align_items() const;
|
||||
Optional<CSS::AlignSelf> align_self() const;
|
||||
Optional<CSS::Appearance> appearance() const;
|
||||
|
|
|
@ -398,6 +398,10 @@ void NodeWithStyle::apply_style(const CSS::StyleProperties& computed_style)
|
|||
if (justify_content.has_value())
|
||||
computed_values.set_justify_content(justify_content.value());
|
||||
|
||||
auto align_content = computed_style.align_content();
|
||||
if (align_content.has_value())
|
||||
computed_values.set_align_content(align_content.value());
|
||||
|
||||
auto align_items = computed_style.align_items();
|
||||
if (align_items.has_value())
|
||||
computed_values.set_align_items(align_items.value());
|
||||
|
|
Loading…
Reference in a new issue