aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHiroyuki Ikezoe <hikezoe@mozilla.com>2017-07-11 08:42:27 +0900
committerHiroyuki Ikezoe <hikezoe@mozilla.com>2017-07-11 08:42:28 +0900
commit0d43281fad17955266075cfb78fca86f9ab298ff (patch)
tree25cbc4f7bbac6acfd552852d0681dcf9106589e2
parent4b91014b140d8a67e7de01489f3c3d52bd311c17 (diff)
downloadservo-0d43281fad17955266075cfb78fca86f9ab298ff.tar.gz
servo-0d43281fad17955266075cfb78fca86f9ab298ff.zip
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).
-rw-r--r--components/style/properties/helpers/animated_properties.mako.rs8
1 files 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<Self, ()> {
- 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;