Bug 1221186 - Don't clobber a fling-snap with a snap-to-where-we-are-now in the overscroll handoff chain. r=botond
--- a/gfx/layers/apz/src/AsyncPanZoomController.cpp
+++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp
@@ -2687,18 +2687,21 @@ bool AsyncPanZoomController::SnapBackIfO
// It's possible that we're already in the middle of an overscroll
// animation - if so, don't start a new one.
if (IsOverscrolled() && mState != OVERSCROLL_ANIMATION) {
APZC_LOG("%p is overscrolled, starting snap-back\n", this);
StartOverscrollAnimation(ParentLayerPoint(0, 0));
return true;
}
// If we don't kick off an overscroll animation, we still need to ask the
- // main thread to snap to any nearby snap points.
- RequestSnap();
+ // main thread to snap to any nearby snap points, assuming we haven't already
+ // done so when we started this fling
+ if (mState != FLING) {
+ RequestSnap();
+ }
return false;
}
bool AsyncPanZoomController::IsFlingingFast() const {
ReentrantMonitorAutoEnter lock(mMonitor);
if (mState == FLING &&
GetVelocityVector().Length() > gfxPrefs::APZFlingStopOnTapThreshold()) {
APZC_LOG("%p is moving fast\n", this);
@@ -3558,15 +3561,17 @@ void AsyncPanZoomController::ShareCompos
APZC_LOG("%p failed to share FrameMetrics with content process.", this);
}
}
}
}
void AsyncPanZoomController::RequestSnap() {
if (RefPtr<GeckoContentController> controller = GetGeckoContentController()) {
+ APZC_LOG("%p requesting snap near %s\n", this,
+ Stringify(mFrameMetrics.GetScrollOffset()).c_str());
controller->RequestFlingSnap(mFrameMetrics.GetScrollId(),
mFrameMetrics.GetScrollOffset());
}
}
} // namespace layers
} // namespace mozilla