From 7cd41518c9f6233a7558e5bf20b08df0c67fbf14 Mon Sep 17 00:00:00 2001 From: Hiroyuki Ikezoe Date: Wed, 13 Jun 2018 06:42:14 +0900 Subject: [PATCH] Bug 1468294 - Double f64::EPSILON for calculation error. r=birtles It's possible that both this_weight and other_weght have calculation errors which are approximately equal to f64::EPSILON. MozReview-Commit-ID: 8OddG9rI3qd --HG-- extra : rebase_source : 9c22d17dcfb8efea7276864502344dc4981c358a --- dom/animation/test/crashtests/1468294-1.html | 7 +++++++ dom/animation/test/crashtests/crashtests.list | 1 + .../style/properties/helpers/animated_properties.mako.rs | 4 +++- 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 dom/animation/test/crashtests/1468294-1.html diff --git a/dom/animation/test/crashtests/1468294-1.html b/dom/animation/test/crashtests/1468294-1.html new file mode 100644 index 000000000000..e4092046ac2d --- /dev/null +++ b/dom/animation/test/crashtests/1468294-1.html @@ -0,0 +1,7 @@ + diff --git a/dom/animation/test/crashtests/crashtests.list b/dom/animation/test/crashtests/crashtests.list index ec5261c0f22c..11f53bf485b6 100644 --- a/dom/animation/test/crashtests/crashtests.list +++ b/dom/animation/test/crashtests/crashtests.list @@ -40,3 +40,4 @@ pref(dom.animations-api.core.enabled,true) load 1393605-1.html load 1400022-1.html pref(dom.animations-api.core.enabled,true) load 1401809.html pref(dom.animations-api.core.enabled,true) load 1411318-1.html +load 1468294-1.html diff --git a/servo/components/style/properties/helpers/animated_properties.mako.rs b/servo/components/style/properties/helpers/animated_properties.mako.rs index d935726eb486..de0e48c782d6 100644 --- a/servo/components/style/properties/helpers/animated_properties.mako.rs +++ b/servo/components/style/properties/helpers/animated_properties.mako.rs @@ -1739,7 +1739,9 @@ impl Animate for Quaternion { let (this_weight, other_weight) = procedure.weights(); debug_assert!( - (this_weight + other_weight - 1.0f64).abs() <= f64::EPSILON || + // Doule EPSILON since both this_weight and other_weght have calculation errors + // which are approximately equal to EPSILON. + (this_weight + other_weight - 1.0f64).abs() <= f64::EPSILON * 2.0 || other_weight == 1.0f64 || other_weight == 0.0f64, "animate should only be used for interpolating or accumulating transforms" );