Bug 1246893 - Fix boundary values of nsSMILKeySpline::GetSplineValue. r?birtles draft
authorHiroyuki Ikezoe <hiikezoe@mozilla-japan.org>
Tue, 09 Feb 2016 19:09:52 +0900
changeset 329776 7166ffbefba6c526a51f2431e9ba08656b488933
parent 329566 815d689a6e1e7187b10238f2f840d49201d67c2b
child 514030 e903ac3223c865fbd10f7b6ef1e00aaf8af2af18
push id10603
push userhiikezoe@mozilla-japan.org
push dateTue, 09 Feb 2016 10:10:09 +0000
reviewersbirtles
bugs1246893
milestone47.0a1
Bug 1246893 - Fix boundary values of nsSMILKeySpline::GetSplineValue. r?birtles
dom/smil/nsSMILKeySpline.cpp
--- a/dom/smil/nsSMILKeySpline.cpp
+++ b/dom/smil/nsSMILKeySpline.cpp
@@ -32,16 +32,22 @@ nsSMILKeySpline::Init(double aX1,
 }
 
 double
 nsSMILKeySpline::GetSplineValue(double aX) const
 {
   if (mX1 == mY1 && mX2 == mY2)
     return aX;
 
+  if (aX == 0.0) {
+    return 0.0;
+  }
+  if (aX == 1.0) {
+    return 1.0;
+  }
   return CalcBezier(GetTForX(aX), mY1, mY2);
 }
 
 void
 nsSMILKeySpline::GetSplineDerivativeValues(double aX, double& aDX, double& aDY) const
 {
   double t = GetTForX(aX);
   aDX = GetSlope(t, mX1, mX2);