Bug 1468294 - Double f64::EPSILON for calculation error. r?birtles draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Wed, 13 Jun 2018 06:42:14 +0900
changeset 806932 98adb4968d4b17a1e5a1e24d39fc3887af9a4494
parent 806509 6ecc243768757b4db83d2467e47078e12bc6c17b
push id112999
push userhikezoe@mozilla.com
push dateTue, 12 Jun 2018 21:49:19 +0000
reviewersbirtles
bugs1468294
milestone62.0a1
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
dom/animation/test/crashtests/1468294-1.html
dom/animation/test/crashtests/crashtests.list
servo/components/style/properties/helpers/animated_properties.mako.rs
new file mode 100644
--- /dev/null
+++ b/dom/animation/test/crashtests/1468294-1.html
@@ -0,0 +1,7 @@
+<script>
+addEventListener("DOMContentLoaded", () => {
+  document.documentElement.animate([{ "transform": "matrix(2,1,1,5,2,8)" }],
+                                    { duration: 1000,
+                                      easing: "cubic-bezier(1,-15,.6,4)" });
+})
+</script>
--- a/dom/animation/test/crashtests/crashtests.list
+++ b/dom/animation/test/crashtests/crashtests.list
@@ -35,8 +35,9 @@ pref(dom.animations-api.core.enabled,tru
 pref(dom.animations-api.core.enabled,true) load 1343589-1.html
 pref(dom.animations-api.core.enabled,true) load 1359658-1.html
 pref(dom.animations-api.core.enabled,true) load 1373712-1.html
 pref(dom.animations-api.core.enabled,true) load 1379606-1.html
 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
--- a/servo/components/style/properties/helpers/animated_properties.mako.rs
+++ b/servo/components/style/properties/helpers/animated_properties.mako.rs
@@ -1733,17 +1733,19 @@ impl Quaternion {
 }
 
 impl Animate for Quaternion {
     fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
         use std::f64;
 
         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"
         );
 
         // We take a specialized code path for accumulation (where other_weight
         // is 1).
         if let Procedure::Accumulate { .. } = procedure {
             debug_assert_eq!(other_weight, 1.0);