From 990f2c6bb9ec1513df25511505c81d0456d56960 Mon Sep 17 00:00:00 2001 From: Brian Birtles Date: Wed, 24 Oct 2018 07:06:43 +0000 Subject: [PATCH] style: Compare absolute dot-product to 1.0 when interpolating quaternions. See the extended commit message for the following spec change: https://github.com/w3c/csswg-drafts/commit/6b36d41ebc2e790c86cc768a6ea1dcfa81fffe75 Basically, by failing to take the absolute value, for certain content we can end up doing division by zero which will mean that the test included in this patch will cause an assertion to fail in debug builds and return "matrix(NaN, NaN....)" in release builds. Differential Revision: https://phabricator.services.mozilla.com/D9618 --- components/style/properties/helpers/animated_properties.mako.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index 11ae9115fe8d..b079f30b1a89 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -1829,7 +1829,7 @@ impl Animate for Quaternion { self.3 * other.3) .min(1.0).max(-1.0); - if dot == 1.0 { + if dot.abs() == 1.0 { return Ok(*self); }