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
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);