summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2022-03-21 17:13:52 +0000
committerAndreas Kling <kling@serenityos.org>2022-03-22 15:47:36 +0100
commit404a7cb63a66171d06b1672c8de60b7844485394 (patch)
tree26d7ff509ea77bf5dd065cd3a2b9eccffe67e7cc /Userland/Libraries/LibWeb
parent75ec960495637d7f866e58be4208509729369431 (diff)
downloadserenity-404a7cb63a66171d06b1672c8de60b7844485394.zip
LibGfx+LibWeb: Use floats not doubles to create HSL colors
There's really no reason to use doubles here, except at the time I wanted to use doubles everywhere in CSS. I now realize that is excessive, so everything can be floats instead.
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r--Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
index 880ee41a22..39eb93b009 100644
--- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
+++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
@@ -2530,9 +2530,9 @@ Optional<Color> Parser::parse_color(StyleComponentValueRule const& component_val
&& s_val.is(Token::Type::Percentage)
&& l_val.is(Token::Type::Percentage)) {
- auto h = h_val.number_value();
- auto s = s_val.percentage() / 100.0;
- auto l = l_val.percentage() / 100.0;
+ auto h = static_cast<float>(h_val.number_value());
+ auto s = static_cast<float>(s_val.percentage() / 100.0f);
+ auto l = static_cast<float>(l_val.percentage() / 100.0f);
return Color::from_hsl(h, s, l);
}
} else if (function.name().equals_ignoring_case("hsla")) {
@@ -2549,10 +2549,10 @@ Optional<Color> Parser::parse_color(StyleComponentValueRule const& component_val
&& l_val.is(Token::Type::Percentage)
&& a_val.is(Token::Type::Number)) {
- auto h = h_val.number_value();
- auto s = s_val.percentage() / 100.0;
- auto l = l_val.percentage() / 100.0;
- auto a = a_val.number_value();
+ auto h = static_cast<float>(h_val.number_value());
+ auto s = static_cast<float>(s_val.percentage() / 100.0f);
+ auto l = static_cast<float>(l_val.percentage() / 100.0f);
+ auto a = static_cast<float>(a_val.number_value());
return Color::from_hsla(h, s, l, a);
}
}