mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 09:18:11 +00:00
LibWeb: Use IdentifierStyleValue for CSS 'list-style-type'
This commit is contained in:
parent
c630ae517e
commit
9c76c4f0cf
7 changed files with 52 additions and 1 deletions
|
@ -464,6 +464,14 @@ static Optional<CSS::ValueID> value_id_from_string(const String& string)
|
|||
return CSS::ValueID::FullWidth;
|
||||
if (string.equals_ignoring_case("full-size-kana"))
|
||||
return CSS::ValueID::FullSizeKana;
|
||||
if (string.equals_ignoring_case("disc"))
|
||||
return CSS::ValueID::Disc;
|
||||
if (string.equals_ignoring_case("circle"))
|
||||
return CSS::ValueID::Circle;
|
||||
if (string.equals_ignoring_case("square"))
|
||||
return CSS::ValueID::Square;
|
||||
if (string.equals_ignoring_case("decimal"))
|
||||
return CSS::ValueID::Decimal;
|
||||
if (string.starts_with("-libweb-palette-", CaseSensitivity::CaseInsensitive))
|
||||
return value_id_for_palette_string(string.substring_view(16, string.length() - 16));
|
||||
return {};
|
||||
|
|
|
@ -453,4 +453,26 @@ Optional<CSS::TextTransform> StyleProperties::text_transform() const
|
|||
}
|
||||
}
|
||||
|
||||
Optional<CSS::ListStyleType> StyleProperties::list_style_type() const
|
||||
{
|
||||
auto value = property(CSS::PropertyID::ListStyleType);
|
||||
if (!value.has_value())
|
||||
return {};
|
||||
|
||||
switch (value.value()->to_identifier()) {
|
||||
case CSS::ValueID::None:
|
||||
return CSS::ListStyleType::None;
|
||||
case CSS::ValueID::Disc:
|
||||
return CSS::ListStyleType::Disc;
|
||||
case CSS::ValueID::Circle:
|
||||
return CSS::ListStyleType::Circle;
|
||||
case CSS::ValueID::Square:
|
||||
return CSS::ListStyleType::Square;
|
||||
case CSS::ValueID::Decimal:
|
||||
return CSS::ListStyleType::Decimal;
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -68,6 +68,7 @@ public:
|
|||
Optional<CSS::LineStyle> line_style(CSS::PropertyID) const;
|
||||
Optional<CSS::TextDecorationLine> text_decoration_line() const;
|
||||
Optional<CSS::TextTransform> text_transform() const;
|
||||
Optional<CSS::ListStyleType> list_style_type() const;
|
||||
|
||||
const Gfx::Font& font() const
|
||||
{
|
||||
|
|
|
@ -156,6 +156,10 @@ enum class ValueID {
|
|||
Lowercase,
|
||||
FullWidth,
|
||||
FullSizeKana,
|
||||
Disc,
|
||||
Circle,
|
||||
Square,
|
||||
Decimal,
|
||||
};
|
||||
|
||||
enum class Position {
|
||||
|
@ -239,6 +243,14 @@ enum class LineStyle {
|
|||
Outset,
|
||||
};
|
||||
|
||||
enum class ListStyleType {
|
||||
None,
|
||||
Disc,
|
||||
Circle,
|
||||
Square,
|
||||
Decimal,
|
||||
};
|
||||
|
||||
class StyleValue : public RefCounted<StyleValue> {
|
||||
public:
|
||||
virtual ~StyleValue();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue