From 295daaeded46410e8728c9762d01d340a35f3102 Mon Sep 17 00:00:00 2001 From: Randall Barker Date: Mon, 25 Jan 2016 17:34:00 -0800 Subject: [PATCH] Bug 1230674 - part 4, Update AsyncPanZoomController to call overscroll api when building for Android r=kats --- gfx/layers/apz/src/AsyncPanZoomController.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp index f6054616b8a..a20f4241bf9 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.cpp +++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp @@ -2379,15 +2379,22 @@ void AsyncPanZoomController::OverscrollBy(ParentLayerPoint& aOverscroll) { // scroll to begin with. bool xCanScroll = mX.CanScroll(); bool yCanScroll = mY.CanScroll(); - bool xConsumed = FuzzyEqualsAdditive(aOverscroll.x, 0.0f, COORDINATE_EPSILON); + bool yConsumed = FuzzyEqualsAdditive(aOverscroll.y, 0.0f, COORDINATE_EPSILON); + +#if defined(MOZ_ANDROID_APZ) + RefPtr controller = GetGeckoContentController(); + if (controller && ((xCanScroll && !xConsumed) || (yCanScroll && !yConsumed))) { + controller->UpdateOverscrollOffset(aOverscroll.x, aOverscroll.y); + aOverscroll.x = aOverscroll.y = 0.0f; + } +#else if (xCanScroll && !xConsumed) { mX.OverscrollBy(aOverscroll.x); aOverscroll.x = 0; xConsumed = true; } - bool yConsumed = FuzzyEqualsAdditive(aOverscroll.y, 0.0f, COORDINATE_EPSILON); if (yCanScroll && !yConsumed) { mY.OverscrollBy(aOverscroll.y); aOverscroll.y = 0; @@ -2397,6 +2404,7 @@ void AsyncPanZoomController::OverscrollBy(ParentLayerPoint& aOverscroll) { if ((xCanScroll && xConsumed) || (yCanScroll && yConsumed)) { ScheduleComposite(); } +#endif } RefPtr AsyncPanZoomController::BuildOverscrollHandoffChain() { @@ -2495,7 +2503,14 @@ void AsyncPanZoomController::HandleFlingOverscroll(const ParentLayerPoint& aVelo aScrolledApzc}; treeManagerLocal->DispatchFling(this, handoffState); if (!IsZero(handoffState.mVelocity) && IsPannable() && gfxPrefs::APZOverscrollEnabled()) { +#if defined(MOZ_ANDROID_APZ) + RefPtr controller = GetGeckoContentController(); + if (controller) { + controller->UpdateOverscrollVelocity(handoffState.mVelocity.x, handoffState.mVelocity.y); + } +#else StartOverscrollAnimation(handoffState.mVelocity); +#endif } } }