diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/StackScroller.java b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/StackScroller.java index 293268cba14f..aae8235bc614 100644 --- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/StackScroller.java +++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/StackScroller.java @@ -261,14 +261,9 @@ public class StackScroller { if (mFlywheel && !isFinished()) { float oldVelocityX = mScrollerX.mCurrVelocity; float oldVelocityY = mScrollerY.mCurrVelocity; - boolean sameXDirection = (velocityX == 0) || (oldVelocityX == 0) || - ((velocityX < 0) == (oldVelocityX < 0)); - boolean sameYDirection = (velocityY == 0) || (oldVelocityY == 0) || - ((velocityY < 0) == (oldVelocityY < 0)); - if (sameXDirection) { + if (Math.signum(velocityX) == Math.signum(oldVelocityX) + && Math.signum(velocityY) == Math.signum(oldVelocityY)) { velocityX += oldVelocityX; - } - if (sameYDirection) { velocityY += oldVelocityY; } }