diff options
author | Sam Atkins <atkinssj@serenityos.org> | 2022-01-19 16:25:19 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-01-20 00:04:10 +0100 |
commit | 5e9a6302e56201488a04f5251e73baa9e4d6e416 (patch) | |
tree | f2f67c57240af98010b341f1c6758dbc5c9f862f /Userland | |
parent | dc681913e85d6a5fda18197da57e393fffffa2b1 (diff) | |
download | serenity-5e9a6302e56201488a04f5251e73baa9e4d6e416.zip |
LibWeb: Convert opacity property from Length to Percentage
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/StyleProperties.cpp | 7 |
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; } |