summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2022-01-19 16:25:19 +0000
committerAndreas Kling <kling@serenityos.org>2022-01-20 00:04:10 +0100
commit5e9a6302e56201488a04f5251e73baa9e4d6e416 (patch)
treef2f67c57240af98010b341f1c6758dbc5c9f862f /Userland
parentdc681913e85d6a5fda18197da57e393fffffa2b1 (diff)
downloadserenity-5e9a6302e56201488a04f5251e73baa9e4d6e416.zip
LibWeb: Convert opacity property from Length to Percentage
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibWeb/CSS/StyleProperties.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp
index 11a31740dd..b243510459 100644
--- a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp
+++ b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp
@@ -174,11 +174,8 @@ float StyleProperties::opacity() const
if (value->has_number())
return clamp(value->to_number(), 0.0f, 1.0f);
- if (value->has_length()) {
- auto length = value->to_length();
- if (length.is_percentage())
- return clamp(length.raw_value() / 100.0f, 0.0f, 1.0f);
- }
+ if (value->is_percentage())
+ return clamp(value->as_percentage().percentage().as_fraction(), 0.0f, 1.0f);
return 1.0f;
}