summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp
diff options
context:
space:
mode:
authorTobias Christiansen <tobi@tobyase.de>2021-07-23 21:22:31 +0200
committerAndreas Kling <kling@serenityos.org>2021-07-24 22:16:48 +0200
commitf1bdaafcf6554ade403552da9e7ec3f832248d52 (patch)
treeeea7f1650860a3914178e7da8effa313bdbafffb /Userland/Libraries/LibWeb/CSS/StyleProperties.cpp
parent36e6f559c5098918b83f421fb3228971fc2a227a (diff)
downloadserenity-f1bdaafcf6554ade403552da9e7ec3f832248d52.zip
LibWeb: Make box-shadow known throughout the CSS subsystem
This patch spreads box-shadows around: - The Values important to box-shadows are stored in a BoxShadowData struct - StyleProperties knows how to construct such a struct from a BoxShadowStyleValue and a Node knows how to ask for it - CalculatedValues contain BoxShadowData and expose them
Diffstat (limited to 'Userland/Libraries/LibWeb/CSS/StyleProperties.cpp')
-rw-r--r--Userland/Libraries/LibWeb/CSS/StyleProperties.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp
index 0adb41aad6..84ea18d5d7 100644
--- a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp
+++ b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp
@@ -764,4 +764,18 @@ Optional<CSS::Repeat> StyleProperties::background_repeat_y() const
return {};
}
}
+
+Optional<CSS::BoxShadowData> StyleProperties::box_shadow() const
+{
+ auto value_or_error = property(CSS::PropertyID::BoxShadow);
+ if (!value_or_error.has_value())
+ return {};
+
+ auto value = value_or_error.value();
+ if (!value->is_box_shadow())
+ return {};
+
+ auto box = verify_cast<CSS::BoxShadowStyleValue>(value.ptr());
+ return { { box->offset_x(), box->offset_y(), box->blur_radius(), box->color() } };
+}
}