Bug 1193062 - Make AllowScrollHandoff work for both ScrollWheelInput and PanGestureInput blocks. r=kats

--HG--
extra : commitid : DwBaXlllNDK
extra : rebase_source : f5f76749edd625b925cacda5627c40c7633c4609
extra : histedit_source : 6ba23a9269071eec6c08baab31a36532c9e143d6
This commit is contained in:
Markus Stange 2015-08-11 15:29:44 -04:00
parent 395b5b7beb
commit 0f591d06f6
4 changed files with 32 additions and 21 deletions

View File

@ -1534,10 +1534,9 @@ AsyncPanZoomController::CanScroll(Layer::ScrollDirection aDirection) const
}
bool
AsyncPanZoomController::AllowScrollHandoffInWheelTransaction() const
AsyncPanZoomController::AllowScrollHandoffInCurrentBlock() const
{
WheelBlockState* block = mInputQueue->CurrentWheelBlock();
return block->AllowScrollHandoff();
return mInputQueue->AllowScrollHandoff();
}
nsEventStatus AsyncPanZoomController::OnScrollWheel(const ScrollWheelInput& aEvent)
@ -2093,22 +2092,17 @@ bool AsyncPanZoomController::AttemptScroll(const ParentLayerPoint& aStartPoint,
return true;
}
// If in a wheel transaction that has not ended, we drop overscroll.
if (aOverscrollHandoffState.mScrollSource == ScrollSource::Wheel &&
!AllowScrollHandoffInWheelTransaction())
{
return true;
}
// If there is overscroll, first try to hand it off to an APZC later
// in the handoff chain to consume (either as a normal scroll or as
// overscroll).
// Note: "+ overscroll" rather than "- overscroll" because "overscroll"
// is what's left of "displacement", and "displacement" is "start - end".
++aOverscrollHandoffState.mChainIndex;
if (CallDispatchScroll(aEndPoint + overscroll, aEndPoint,
aOverscrollHandoffState)) {
return true;
if (AllowScrollHandoffInCurrentBlock()) {
// If there is overscroll, first try to hand it off to an APZC later
// in the handoff chain to consume (either as a normal scroll or as
// overscroll).
// Note: "+ overscroll" rather than "- overscroll" because "overscroll"
// is what's left of "displacement", and "displacement" is "start - end".
++aOverscrollHandoffState.mChainIndex;
if (CallDispatchScroll(aEndPoint + overscroll, aEndPoint,
aOverscrollHandoffState)) {
return true;
}
}
// If there is no APZC later in the handoff chain that accepted the

View File

@ -894,8 +894,8 @@ private:
void StartSmoothScroll(ScrollSource aSource);
// Returns whether overscroll is allowed during a wheel event.
bool AllowScrollHandoffInWheelTransaction() const;
// Returns whether overscroll is allowed during an event.
bool AllowScrollHandoffInCurrentBlock() const;
/* ===================================================================
* The functions and members in this section are used to make ancestor chains

View File

@ -405,6 +405,19 @@ InputQueue::HasReadyTouchBlock() const
mInputBlockQueue[0]->IsReadyForHandling();
}
bool
InputQueue::AllowScrollHandoff() const
{
MOZ_ASSERT(CurrentBlock());
if (CurrentBlock()->AsWheelBlock()) {
return CurrentBlock()->AsWheelBlock()->AllowScrollHandoff();
}
if (CurrentBlock()->AsPanGestureBlock()) {
return CurrentBlock()->AsPanGestureBlock()->AllowScrollHandoff();
}
return true;
}
void
InputQueue::ScheduleMainThreadTimeout(const nsRefPtr<AsyncPanZoomController>& aTarget, uint64_t aInputBlockId) {
INPQ_LOG("scheduling main thread timeout for target %p\n", aTarget.get());

View File

@ -102,6 +102,10 @@ public:
* Remove all input blocks from the input queue.
*/
void Clear();
/**
* Whether the current pending block allows scroll handoff.
*/
bool AllowScrollHandoff() const;
private:
~InputQueue();