Bug 1230674 - part 4, Update AsyncPanZoomController to call overscroll api when building for Android r=kats

This commit is contained in:
Randall Barker 2016-01-25 17:34:00 -08:00
parent dcf89b18d6
commit 06b9fe5f8f

View File

@ -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<GeckoContentController> 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<const OverscrollHandoffChain> 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<GeckoContentController> controller = GetGeckoContentController();
if (controller) {
controller->UpdateOverscrollVelocity(handoffState.mVelocity.x, handoffState.mVelocity.y);
}
#else
StartOverscrollAnimation(handoffState.mVelocity);
#endif
}
}
}