From bc1845a8f86ed14c8f6bb99e7df752a6894b3f55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Tue, 15 Aug 2023 00:51:30 +0200 Subject: [PATCH] style: Fix hue adjustment to match the spec The value to sum is tau, not pi. This was caught by some tests, see https://drafts.csswg.org/css-color/#shorter Differential Revision: https://phabricator.services.mozilla.com/D147006 --- components/style/values/animated/color.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/style/values/animated/color.rs b/components/style/values/animated/color.rs index d3ee616f765..a7dba508f68 100644 --- a/components/style/values/animated/color.rs +++ b/components/style/values/animated/color.rs @@ -432,9 +432,9 @@ fn adjust_hue(left: &mut f32, right: &mut f32, hue_interpolation: HueInterpolati let delta = *right - *left; if delta > PI { - *left += PI; - } else if delta < -1. * PI { - *right += PI; + *left += TAU; + } else if delta < -PI { + *right += TAU; } }, // https://drafts.csswg.org/css-color/#longer