@@ -2476,9 +2476,9 @@ Optional<Color> Parser::parse_color(StyleComponentValueRule const& component_val
2476
2476
&& g_val.is (Token::Type::Percentage)
2477
2477
&& b_val.is (Token::Type::Percentage)) {
2478
2478
2479
- u8 r = clamp (lroundf (r_val.percentage () * 2.55 ), 0 , 255 );
2480
- u8 g = clamp (lroundf (g_val.percentage () * 2.55 ), 0 , 255 );
2481
- u8 b = clamp (lroundf (b_val.percentage () * 2.55 ), 0 , 255 );
2479
+ u8 r = clamp (lroundf (r_val.percentage () * 2 .55f ), 0 , 255 );
2480
+ u8 g = clamp (lroundf (g_val.percentage () * 2 .55f ), 0 , 255 );
2481
+ u8 b = clamp (lroundf (b_val.percentage () * 2 .55f ), 0 , 255 );
2482
2482
return Color (r, g, b);
2483
2483
}
2484
2484
} else if (function.name ().equals_ignoring_case (" rgba" )) {
@@ -2498,7 +2498,7 @@ Optional<Color> Parser::parse_color(StyleComponentValueRule const& component_val
2498
2498
auto r = r_val.to_integer ();
2499
2499
auto g = g_val.to_integer ();
2500
2500
auto b = b_val.to_integer ();
2501
- auto a = clamp (lroundf (a_val.number_value () * 255.0 ), 0 , 255 );
2501
+ auto a = clamp (lroundf (a_val.number_value () * 255 .0f ), 0 , 255 );
2502
2502
if (AK::is_within_range<u8 >(r) && AK::is_within_range<u8 >(g) && AK::is_within_range<u8 >(b))
2503
2503
return Color (r, g, b, a);
2504
2504
@@ -2512,10 +2512,10 @@ Optional<Color> Parser::parse_color(StyleComponentValueRule const& component_val
2512
2512
auto b = b_val.percentage ();
2513
2513
auto a = a_val.number_value ();
2514
2514
2515
- u8 r_255 = clamp (lroundf (r * 2.55 ), 0 , 255 );
2516
- u8 g_255 = clamp (lroundf (g * 2.55 ), 0 , 255 );
2517
- u8 b_255 = clamp (lroundf (b * 2.55 ), 0 , 255 );
2518
- u8 a_255 = clamp (lroundf (a * 255.0 ), 0 , 255 );
2515
+ u8 r_255 = clamp (lroundf (r * 2 .55f ), 0 , 255 );
2516
+ u8 g_255 = clamp (lroundf (g * 2 .55f ), 0 , 255 );
2517
+ u8 b_255 = clamp (lroundf (b * 2 .55f ), 0 , 255 );
2518
+ u8 a_255 = clamp (lroundf (a * 255 .0f ), 0 , 255 );
2519
2519
return Color (r_255, g_255, b_255, a_255);
2520
2520
}
2521
2521
} else if (function.name ().equals_ignoring_case (" hsl" )) {
@@ -2530,9 +2530,9 @@ Optional<Color> Parser::parse_color(StyleComponentValueRule const& component_val
2530
2530
&& s_val.is (Token::Type::Percentage)
2531
2531
&& l_val.is (Token::Type::Percentage)) {
2532
2532
2533
- auto h = static_cast < float >( h_val.number_value () );
2534
- auto s = static_cast < float >( s_val.percentage () / 100 .0f ) ;
2535
- auto l = static_cast < float >( l_val.percentage () / 100 .0f ) ;
2533
+ auto h = h_val.number_value ();
2534
+ auto s = s_val.percentage () / 100 .0f ;
2535
+ auto l = l_val.percentage () / 100 .0f ;
2536
2536
return Color::from_hsl (h, s, l);
2537
2537
}
2538
2538
} else if (function.name ().equals_ignoring_case (" hsla" )) {
@@ -2549,10 +2549,10 @@ Optional<Color> Parser::parse_color(StyleComponentValueRule const& component_val
2549
2549
&& l_val.is (Token::Type::Percentage)
2550
2550
&& a_val.is (Token::Type::Number)) {
2551
2551
2552
- auto h = static_cast < float >( h_val.number_value () );
2553
- auto s = static_cast < float >( s_val.percentage () / 100 .0f ) ;
2554
- auto l = static_cast < float >( l_val.percentage () / 100 .0f ) ;
2555
- auto a = static_cast < float >( a_val.number_value () );
2552
+ auto h = h_val.number_value ();
2553
+ auto s = s_val.percentage () / 100 .0f ;
2554
+ auto l = l_val.percentage () / 100 .0f ;
2555
+ auto a = a_val.number_value ();
2556
2556
return Color::from_hsla (h, s, l, a);
2557
2557
}
2558
2558
}
0 commit comments