summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp
diff options
context:
space:
mode:
authorsin-ack <sin-ack@users.noreply.github.com>2022-03-12 19:31:32 +0000
committerAndreas Kling <kling@serenityos.org>2022-03-12 21:51:38 +0100
commit0679eadd62c86a1a7de7227054e03398e3a257fa (patch)
tree6b02fa99aa3111a847d4145f3d473cafdeff8ffa /Userland/Libraries/LibWeb/CSS/StyleProperties.cpp
parent7fe3f2d970304207bf22c7ea8db9bfe425281926 (diff)
downloadserenity-0679eadd62c86a1a7de7227054e03398e3a257fa.zip
LibWeb: Add support for the text-justify property
This commit adds the text-justify property as defined in: https://drafts.csswg.org/css-text/#propdef-text-justify
Diffstat (limited to 'Userland/Libraries/LibWeb/CSS/StyleProperties.cpp')
-rw-r--r--Userland/Libraries/LibWeb/CSS/StyleProperties.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp
index 584d775603..18e68eb399 100644
--- a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp
+++ b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp
@@ -438,6 +438,26 @@ Optional<CSS::TextAlign> StyleProperties::text_align() const
}
}
+Optional<CSS::TextJustify> StyleProperties::text_justify() const
+{
+ auto value = property(CSS::PropertyID::TextJustify);
+ if (!value.has_value())
+ return {};
+ switch (value.value()->to_identifier()) {
+ case CSS::ValueID::Auto:
+ return CSS::TextJustify::Auto;
+ case CSS::ValueID::None:
+ return CSS::TextJustify::None;
+ case CSS::ValueID::InterWord:
+ return CSS::TextJustify::InterWord;
+ case CSS::ValueID::Distribute:
+ case CSS::ValueID::InterCharacter:
+ return CSS::TextJustify::InterCharacter;
+ default:
+ return {};
+ }
+}
+
Optional<CSS::PointerEvents> StyleProperties::pointer_events() const
{
auto value = property(CSS::PropertyID::PointerEvents);