Bug 1603224 - Guard against division-by-zero in AsyncPanZoomController::ScrollSnapToDestination(). r=tnikkel

Differential Revision: https://phabricator.services.mozilla.com/D57179

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Botond Ballo 2019-12-14 00:24:31 +00:00
parent eb86e49693
commit 19311b0174

View File

@ -5296,10 +5296,10 @@ void AsyncPanZoomController::ScrollSnapToDestination() {
ParentLayerPoint predictedDelta;
// "-velocity / log(1.0 - friction)" is the integral of the deceleration
// curve modeled for flings in the "Axis" class.
if (velocity.x != 0.0f) {
if (velocity.x != 0.0f && friction != 0.0f) {
predictedDelta.x = -velocity.x / log(1.0 - friction);
}
if (velocity.y != 0.0f) {
if (velocity.y != 0.0f && friction != 0.0f) {
predictedDelta.y = -velocity.y / log(1.0 - friction);
}