Bug 1319072 - Don't assert even if coefficient is out of range [0, 1]. r?boris draft
authorHiroyuki Ikezoe <hiikezoe@mozilla-japan.org>
Tue, 22 Nov 2016 08:11:42 +0900
changeset 442178 c33118565d80a1c2b661583d9fd712dfb95e3567
parent 442068 0534254e9a40b4bade2577c631fe4cfa0b5db41d
child 537725 c83c5bd78e3fdc57bf5cd2618f5e24ef2dcc6276
push id36614
push userhiikezoe@mozilla-japan.org
push dateMon, 21 Nov 2016 23:20:49 +0000
reviewersboris
bugs1319072
milestone53.0a1
Bug 1319072 - Don't assert even if coefficient is out of range [0, 1]. r?boris MozReview-Commit-ID: 6TnuoNnHcSc
layout/style/crashtests/1319072-1.html
layout/style/crashtests/crashtests.list
layout/style/nsStyleTransformMatrix.cpp
new file mode 100644
--- /dev/null
+++ b/layout/style/crashtests/1319072-1.html
@@ -0,0 +1,20 @@
+<!doctype html>
+<html class="reftest-wait">
+<title>Interpolation of decomposed matrices</title>
+<style>
+#target {
+  width: 100px; height: 100px;
+  background: blue;
+  animation: anim 0.1s cubic-bezier(0,1.5,1,1.5);
+}
+@keyframes anim {
+  from { transform: matrix(1, 0, 0, 1, 100, 200); }
+  to { transform: matrix(1, 0, 0, 1, 200, 100); }
+}
+</style>
+<div id="target"></div>
+<script>
+document.getElementById("target").addEventListener("animationend", () => {
+  document.documentElement.classList.remove("reftest-wait");
+}, false);
+</script>
--- a/layout/style/crashtests/crashtests.list
+++ b/layout/style/crashtests/crashtests.list
@@ -157,8 +157,9 @@ load 1282076-1.html
 pref(dom.animations-api.core.enabled,true) load 1282076-2.html
 pref(dom.animations-api.core.enabled,true) load 1290994-1.html
 pref(dom.animations-api.core.enabled,true) load 1290994-2.html
 pref(dom.animations-api.core.enabled,true) load 1290994-3.html
 load 1290994-4.html
 load 1314531.html
 load 1315889-1.html
 load 1315894-1.html
+load 1319072-1.html
--- a/layout/style/nsStyleTransformMatrix.cpp
+++ b/layout/style/nsStyleTransformMatrix.cpp
@@ -314,45 +314,37 @@ public:
   }
 };
 
 class Interpolate {
 public:
   template<typename T>
   static T operate(const T& aOne, const T& aTwo, double aCoeff)
   {
-    MOZ_ASSERT(aCoeff >= 0.0 && aCoeff <= 1.0,
-               "Coefficient should be in the range [0.0, 1.0]");
     return aOne + (aTwo - aOne) * aCoeff;
   }
 
   static Point4D operateForPerspective(const Point4D& aOne,
                                        const Point4D& aTwo,
                                        double aCoeff)
   {
-    MOZ_ASSERT(aCoeff >= 0.0 && aCoeff <= 1.0,
-               "Coefficient should be in the range [0.0, 1.0]");
     return aOne + (aTwo - aOne) * aCoeff;
   }
 
   static Point3D operateForScale(const Point3D& aOne,
                                  const Point3D& aTwo,
                                  double aCoeff)
   {
-    MOZ_ASSERT(aCoeff >= 0.0 && aCoeff <= 1.0,
-               "Coefficient should be in the range [0.0, 1.0]");
     return aOne + (aTwo - aOne) * aCoeff;
   }
 
   static Matrix4x4 operateForRotate(const gfxQuaternion& aOne,
                                     const gfxQuaternion& aTwo,
                                     double aCoeff)
   {
-    MOZ_ASSERT(aCoeff >= 0.0 && aCoeff <= 1.0,
-               "Coefficient should be in the range [0.0, 1.0]");
     return aOne.Slerp(aTwo, aCoeff).ToMatrix();
   }
 };
 
 /**
  * Calculate 2 matrices by decomposing them with Operator.
  *
  * @param aMatrix1   First matrix, using CSS pixel units.