mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 04:47:36 +00:00
LibWeb: Add the computed "display" values to CSS::ComputedValues
This commit is contained in:
parent
f655a60773
commit
fe9de4b55c
3 changed files with 7 additions and 0 deletions
|
@ -41,6 +41,7 @@ public:
|
||||||
static CSS::Position position() { return CSS::Position::Static; }
|
static CSS::Position position() { return CSS::Position::Static; }
|
||||||
static CSS::TextDecorationLine text_decoration_line() { return CSS::TextDecorationLine::None; }
|
static CSS::TextDecorationLine text_decoration_line() { return CSS::TextDecorationLine::None; }
|
||||||
static CSS::TextTransform text_transform() { return CSS::TextTransform::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 color() { return Color::Black; }
|
||||||
static Color background_color() { return Color::Transparent; }
|
static Color background_color() { return Color::Transparent; }
|
||||||
static CSS::ListStyleType list_style_type() { return CSS::ListStyleType::Disc; }
|
static CSS::ListStyleType list_style_type() { return CSS::ListStyleType::Disc; }
|
||||||
|
@ -57,6 +58,7 @@ class ComputedValues {
|
||||||
public:
|
public:
|
||||||
CSS::Float float_() const { return m_noninherited.float_; }
|
CSS::Float float_() const { return m_noninherited.float_; }
|
||||||
CSS::Clear clear() const { return m_noninherited.clear; }
|
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; }
|
Optional<int> z_index() const { return m_noninherited.z_index; }
|
||||||
CSS::TextAlign text_align() const { return m_inherited.text_align; }
|
CSS::TextAlign text_align() const { return m_inherited.text_align; }
|
||||||
CSS::TextDecorationLine text_decoration_line() const { return m_noninherited.text_decoration_line; }
|
CSS::TextDecorationLine text_decoration_line() const { return m_noninherited.text_decoration_line; }
|
||||||
|
@ -103,6 +105,7 @@ protected:
|
||||||
struct {
|
struct {
|
||||||
CSS::Float float_ { InitialValues::float_() };
|
CSS::Float float_ { InitialValues::float_() };
|
||||||
CSS::Clear clear { InitialValues::clear() };
|
CSS::Clear clear { InitialValues::clear() };
|
||||||
|
CSS::Display display { InitialValues::display() };
|
||||||
Optional<int> z_index;
|
Optional<int> z_index;
|
||||||
CSS::TextDecorationLine text_decoration_line { InitialValues::text_decoration_line() };
|
CSS::TextDecorationLine text_decoration_line { InitialValues::text_decoration_line() };
|
||||||
CSS::Position position { InitialValues::position() };
|
CSS::Position position { InitialValues::position() };
|
||||||
|
@ -148,6 +151,7 @@ public:
|
||||||
void set_margin(const CSS::LengthBox& margin) { m_noninherited.margin = margin; }
|
void set_margin(const CSS::LengthBox& margin) { m_noninherited.margin = margin; }
|
||||||
void set_padding(const CSS::LengthBox& padding) { m_noninherited.padding = padding; }
|
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_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_left() { return m_noninherited.border_left; }
|
||||||
BorderData& border_top() { return m_noninherited.border_top; }
|
BorderData& border_top() { return m_noninherited.border_top; }
|
||||||
BorderData& border_right() { return m_noninherited.border_right; }
|
BorderData& border_right() { return m_noninherited.border_right; }
|
||||||
|
|
|
@ -34,6 +34,7 @@ class StyleProperties;
|
||||||
class StyleResolver;
|
class StyleResolver;
|
||||||
class StyleRule;
|
class StyleRule;
|
||||||
class StyleSheet;
|
class StyleSheet;
|
||||||
|
enum class Display;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Web::DOM {
|
namespace Web::DOM {
|
||||||
|
|
|
@ -237,6 +237,8 @@ void NodeWithStyle::apply_style(const CSS::StyleProperties& specified_style)
|
||||||
m_background_image = static_ptr_cast<CSS::ImageStyleValue>(bgimage.value());
|
m_background_image = static_ptr_cast<CSS::ImageStyleValue>(bgimage.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
computed_values.set_display(specified_style.display());
|
||||||
|
|
||||||
auto position = specified_style.position();
|
auto position = specified_style.position();
|
||||||
if (position.has_value())
|
if (position.has_value())
|
||||||
computed_values.set_position(position.value());
|
computed_values.set_position(position.value());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue