From 0d43281fad17955266075cfb78fca86f9ab298ff Mon Sep 17 00:00:00 2001 From: Hiroyuki Ikezoe Date: Tue, 11 Jul 2017 08:42:27 +0900 Subject: [PATCH] Consider f64 epsilon for add_weighted portions. This patch also degrade assert! to debug_assert! since crash reports don't show us useful information so far (no assertion messages at all). --- .../style/properties/helpers/animated_properties.mako.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index 1af4268b32d..6b1c9183348 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -2272,9 +2272,11 @@ impl Animatable for MatrixDecomposed3D { /// https://drafts.csswg.org/css-transforms/#interpolation-of-decomposed-3d-matrix-values fn add_weighted(&self, other: &Self, self_portion: f64, other_portion: f64) -> Result { - assert!(self_portion + other_portion == 1.0f64 || - other_portion == 1.0f64, - "add_weighted should only be used for interpolating or accumulating transforms"); + use std::f64; + + debug_assert!((self_portion + other_portion - 1.0f64).abs() <= f64::EPSILON || + other_portion == 1.0f64, + "add_weighted should only be used for interpolating or accumulating transforms"); let mut sum = *self;