LibWeb/CSS: Use double in CSSHWB::to_color()

See previous the commit description for more details about the floating
points operations.

The hwb test cases in `css-color-functions` are now rendered identically
to what firefox does (I haven't checked the others tests, but they
aren't affected by this commit).
This commit is contained in:
Lucas CHOLLET 2024-11-18 00:04:51 -05:00 committed by Sam Atkins
commit a1687854ab
Notes: github-actions[bot] 2024-11-21 12:00:42 +00:00
5 changed files with 29 additions and 6 deletions

View file

@ -25,8 +25,8 @@ Color CSSHWB::to_color(Optional<Layout::NodeWithStyle const&>) const
return Color(gray, gray, gray, to_byte(alpha_val));
}
float value = 1 - b_val;
float saturation = 1 - (w_val / value);
auto value = 1 - b_val;
auto saturation = 1 - (w_val / value);
return Color::from_hsv(h_val, saturation, value).with_opacity(alpha_val);
}