diff options
author | Andreas Kling <kling@serenityos.org> | 2021-01-07 14:41:50 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-01-07 17:33:29 +0100 |
commit | fe9de4b55c1ff3cffd24d81f3f94bd348ee8cd03 (patch) | |
tree | 9dbfa05b186d4f461fd7fda654fa4e0adec4a66d | |
parent | f655a607735bf8a023404d1d48f3bfd41151ddd9 (diff) | |
download | serenity-fe9de4b55c1ff3cffd24d81f3f94bd348ee8cd03.zip |
LibWeb: Add the computed "display" values to CSS::ComputedValues
-rw-r--r-- | Libraries/LibWeb/CSS/ComputedValues.h | 4 | ||||
-rw-r--r-- | Libraries/LibWeb/Forward.h | 1 | ||||
-rw-r--r-- | Libraries/LibWeb/Layout/Node.cpp | 2 |
3 files changed, 7 insertions, 0 deletions
diff --git a/Libraries/LibWeb/CSS/ComputedValues.h b/Libraries/LibWeb/CSS/ComputedValues.h index 588468ced7..57866b07f4 100644 --- a/Libraries/LibWeb/CSS/ComputedValues.h +++ b/Libraries/LibWeb/CSS/ComputedValues.h @@ -41,6 +41,7 @@ public: static CSS::Position position() { return CSS::Position::Static; } static CSS::TextDecorationLine text_decoration_line() { return CSS::TextDecorationLine::None; } static CSS::TextTransform text_transform() { return CSS::TextTransform::None; } + static CSS::Display display() { return CSS::Display::Inline; } static Color color() { return Color::Black; } static Color background_color() { return Color::Transparent; } static CSS::ListStyleType list_style_type() { return CSS::ListStyleType::Disc; } @@ -57,6 +58,7 @@ class ComputedValues { public: CSS::Float float_() const { return m_noninherited.float_; } CSS::Clear clear() const { return m_noninherited.clear; } + CSS::Display display() const { return m_noninherited.display; } Optional<int> z_index() const { return m_noninherited.z_index; } CSS::TextAlign text_align() const { return m_inherited.text_align; } CSS::TextDecorationLine text_decoration_line() const { return m_noninherited.text_decoration_line; } @@ -103,6 +105,7 @@ protected: struct { CSS::Float float_ { InitialValues::float_() }; CSS::Clear clear { InitialValues::clear() }; + CSS::Display display { InitialValues::display() }; Optional<int> z_index; CSS::TextDecorationLine text_decoration_line { InitialValues::text_decoration_line() }; CSS::Position position { InitialValues::position() }; @@ -148,6 +151,7 @@ public: void set_margin(const CSS::LengthBox& margin) { m_noninherited.margin = margin; } void set_padding(const CSS::LengthBox& padding) { m_noninherited.padding = padding; } void set_list_style_type(CSS::ListStyleType value) { m_inherited.list_style_type = value; } + void set_display(CSS::Display value) { m_noninherited.display = value; } BorderData& border_left() { return m_noninherited.border_left; } BorderData& border_top() { return m_noninherited.border_top; } BorderData& border_right() { return m_noninherited.border_right; } diff --git a/Libraries/LibWeb/Forward.h b/Libraries/LibWeb/Forward.h index 7c89218795..445b7222fa 100644 --- a/Libraries/LibWeb/Forward.h +++ b/Libraries/LibWeb/Forward.h @@ -34,6 +34,7 @@ class StyleProperties; class StyleResolver; class StyleRule; class StyleSheet; +enum class Display; } namespace Web::DOM { diff --git a/Libraries/LibWeb/Layout/Node.cpp b/Libraries/LibWeb/Layout/Node.cpp index fc2b83f7b9..7af494a0fb 100644 --- a/Libraries/LibWeb/Layout/Node.cpp +++ b/Libraries/LibWeb/Layout/Node.cpp @@ -237,6 +237,8 @@ void NodeWithStyle::apply_style(const CSS::StyleProperties& specified_style) m_background_image = static_ptr_cast<CSS::ImageStyleValue>(bgimage.value()); } + computed_values.set_display(specified_style.display()); + auto position = specified_style.position(); if (position.has_value()) computed_values.set_position(position.value()); |