From 1506934be88a2c2d87b25dd69452a7cd94f6c7ed Mon Sep 17 00:00:00 2001 From: Botond Ballo Date: Thu, 17 Jul 2014 14:45:57 -0400 Subject: [PATCH] Bug 1030803 - Account for floating-point error in Axis::ScaleWillOverscrollAmount(). r=kats --- gfx/layers/apz/src/Axis.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gfx/layers/apz/src/Axis.cpp b/gfx/layers/apz/src/Axis.cpp index 22ae7cb68dd2..87275e788c42 100644 --- a/gfx/layers/apz/src/Axis.cpp +++ b/gfx/layers/apz/src/Axis.cpp @@ -272,8 +272,8 @@ float Axis::ScaleWillOverscrollAmount(float aScale, float aFocus) { float originAfterScale = (GetOrigin() + aFocus) - (aFocus / aScale); bool both = ScaleWillOverscrollBothSides(aScale); - bool minus = originAfterScale < GetPageStart(); - bool plus = (originAfterScale + (GetCompositionLength() / aScale)) > GetPageEnd(); + bool minus = GetPageStart() - originAfterScale > COORDINATE_EPSILON; + bool plus = (originAfterScale + (GetCompositionLength() / aScale)) - GetPageEnd() > COORDINATE_EPSILON; if ((minus && plus) || both) { // If we ever reach here it's a bug in the client code. @@ -330,7 +330,7 @@ bool Axis::ScaleWillOverscrollBothSides(float aScale) { CSSToParentLayerScale scale(metrics.GetZoomToParent().scale * aScale); CSSRect cssCompositionBounds = metrics.mCompositionBounds / scale; - return GetRectLength(metrics.GetExpandedScrollableRect()) < GetRectLength(cssCompositionBounds); + return GetRectLength(cssCompositionBounds) - GetRectLength(metrics.GetExpandedScrollableRect()) > COORDINATE_EPSILON; } const FrameMetrics& Axis::GetFrameMetrics() const {