1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:17:35 +00:00

LibWeb: Use IdentifierStyleValue for CSS 'list-style-type'

This commit is contained in:
Andreas Kling 2020-12-15 16:50:39 +01:00
parent c630ae517e
commit 9c76c4f0cf
7 changed files with 52 additions and 1 deletions

View file

@ -43,6 +43,7 @@ public:
static CSS::TextTransform text_transform() { return CSS::TextTransform::None; }
static Color color() { return Color::Black; }
static Color background_color() { return Color::Transparent; }
static CSS::ListStyleType list_style_type() { return CSS::ListStyleType::Disc; }
};
struct BorderData {
@ -81,6 +82,8 @@ public:
Color color() const { return m_color; }
Color background_color() const { return m_background_color; }
CSS::ListStyleType list_style_type() const { return m_list_style_type; }
protected:
CSS::Float m_float { InitialValues::float_() };
CSS::Clear m_clear { InitialValues::clear() };
@ -105,6 +108,7 @@ protected:
BorderData m_border_bottom;
Color m_color { InitialValues::color() };
Color m_background_color { InitialValues::background_color() };
CSS::ListStyleType m_list_style_type { InitialValues::list_style_type() };
};
class ImmutableLayoutStyle final : public LayoutStyle {
@ -131,6 +135,7 @@ public:
void set_offset(const CSS::LengthBox& offset) { m_offset = offset; }
void set_margin(const CSS::LengthBox& margin) { m_margin = margin; }
void set_padding(const CSS::LengthBox& padding) { m_padding = padding; }
void set_list_style_type(CSS::ListStyleType value) { m_list_style_type = value; }
BorderData& border_left() { return m_border_left; }
BorderData& border_top() { return m_border_top; }
BorderData& border_right() { return m_border_right; }

View file

@ -45,7 +45,7 @@ void ListItemBox::layout_marker()
m_marker = nullptr;
}
if (specified_style().string_or_fallback(CSS::PropertyID::ListStyleType, "disc") == "none")
if (style().list_style_type() == CSS::ListStyleType::None)
return;
if (!m_marker) {

View file

@ -247,6 +247,9 @@ void NodeWithStyle::apply_style(const CSS::StyleProperties& specified_style)
if (text_transform.has_value())
style.set_text_transform(text_transform.value());
if (auto list_style_type = specified_style.list_style_type(); list_style_type.has_value())
style.set_list_style_type(list_style_type.value());
style.set_color(specified_style.color_or_fallback(CSS::PropertyID::Color, document(), Color::Transparent));
style.set_background_color(specified_style.color_or_fallback(CSS::PropertyID::BackgroundColor, document(), Color::Transparent));