From 0f12d129930c914b5b9cd56132499373b45295e6 Mon Sep 17 00:00:00 2001 From: Botond Ballo Date: Fri, 20 Oct 2017 19:16:44 -0400 Subject: [PATCH] Bug 951793 - Obey overscroll-behavior for immediate scroll handoff. r=kats MozReview-Commit-ID: JPJOK8A1PQ --- gfx/layers/apz/src/AsyncPanZoomController.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp index e797ca91b57c..cc20cf1f2798 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.cpp +++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp @@ -2893,8 +2893,25 @@ void AsyncPanZoomController::CallDispatchScroll(ParentLayerPoint& aStartPoint, if (!treeManagerLocal) { return; } + + // Obey overscroll-behavior. + ParentLayerPoint endPoint = aEndPoint; + if (aOverscrollHandoffState.mChainIndex > 0) { + RecursiveMutexAutoLock lock(mRecursiveMutex); + if (!mX.OverscrollBehaviorAllowsHandoff()) { + endPoint.x = aStartPoint.x; + } + if (!mY.OverscrollBehaviorAllowsHandoff()) { + endPoint.y = aStartPoint.y; + } + if (aStartPoint == endPoint) { + // Handoff not allowed in either direction - don't even bother. + return; + } + } + treeManagerLocal->DispatchScroll(this, - aStartPoint, aEndPoint, + aStartPoint, endPoint, aOverscrollHandoffState); }