mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:27:44 +00:00
LibWeb: Use IdentifierStyleValue for CSS 'text-transform'
This commit is contained in:
parent
4d7ce81835
commit
78a51933ad
7 changed files with 59 additions and 3 deletions
|
@ -454,6 +454,16 @@ static Optional<CSS::ValueID> value_id_from_string(const String& string)
|
|||
return CSS::ValueID::LineThrough;
|
||||
if (string.equals_ignoring_case("blink"))
|
||||
return CSS::ValueID::Blink;
|
||||
if (string.equals_ignoring_case("capitalize"))
|
||||
return CSS::ValueID::Capitalize;
|
||||
if (string.equals_ignoring_case("uppercase"))
|
||||
return CSS::ValueID::Uppercase;
|
||||
if (string.equals_ignoring_case("lowercase"))
|
||||
return CSS::ValueID::Lowercase;
|
||||
if (string.equals_ignoring_case("full-width"))
|
||||
return CSS::ValueID::FullWidth;
|
||||
if (string.equals_ignoring_case("full-size-kana"))
|
||||
return CSS::ValueID::FullSizeKana;
|
||||
if (string.starts_with("-libweb-palette-", CaseSensitivity::CaseInsensitive))
|
||||
return value_id_for_palette_string(string.substring_view(16, string.length() - 16));
|
||||
return {};
|
||||
|
|
|
@ -430,4 +430,27 @@ Optional<CSS::TextDecorationLine> StyleProperties::text_decoration_line() const
|
|||
}
|
||||
}
|
||||
|
||||
Optional<CSS::TextTransform> StyleProperties::text_transform() const
|
||||
{
|
||||
auto value = property(CSS::PropertyID::TextTransform);
|
||||
if (!value.has_value())
|
||||
return {};
|
||||
switch (value.value()->to_identifier()) {
|
||||
case CSS::ValueID::None:
|
||||
return CSS::TextTransform::None;
|
||||
case CSS::ValueID::Lowercase:
|
||||
return CSS::TextTransform::Lowercase;
|
||||
case CSS::ValueID::Uppercase:
|
||||
return CSS::TextTransform::Uppercase;
|
||||
case CSS::ValueID::Capitalize:
|
||||
return CSS::TextTransform::Capitalize;
|
||||
case CSS::ValueID::FullWidth:
|
||||
return CSS::TextTransform::FullWidth;
|
||||
case CSS::ValueID::FullSizeKana:
|
||||
return CSS::TextTransform::FullSizeKana;
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -67,6 +67,7 @@ public:
|
|||
Optional<CSS::WhiteSpace> white_space() const;
|
||||
Optional<CSS::LineStyle> line_style(CSS::PropertyID) const;
|
||||
Optional<CSS::TextDecorationLine> text_decoration_line() const;
|
||||
Optional<CSS::TextTransform> text_transform() const;
|
||||
|
||||
const Gfx::Font& font() const
|
||||
{
|
||||
|
|
|
@ -151,6 +151,11 @@ enum class ValueID {
|
|||
Overline,
|
||||
LineThrough,
|
||||
Blink,
|
||||
Capitalize,
|
||||
Uppercase,
|
||||
Lowercase,
|
||||
FullWidth,
|
||||
FullSizeKana,
|
||||
};
|
||||
|
||||
enum class Position {
|
||||
|
@ -177,6 +182,15 @@ enum class TextDecorationLine {
|
|||
Blink,
|
||||
};
|
||||
|
||||
enum class TextTransform {
|
||||
None,
|
||||
Capitalize,
|
||||
Uppercase,
|
||||
Lowercase,
|
||||
FullWidth,
|
||||
FullSizeKana,
|
||||
};
|
||||
|
||||
enum class Display {
|
||||
None,
|
||||
Block,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue