Bug 1319072 - Don't assert even if coefficient is out of range [0, 1]. r?boris
MozReview-Commit-ID: 6TnuoNnHcSc
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.