Bug 1030803 - Account for floating-point error in Axis::ScaleWillOverscrollAmount(). r=kats

This commit is contained in:
Botond Ballo 2014-07-17 14:45:57 -04:00
parent 63333d7edb
commit 1506934be8

View File

@ -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 {