Bug 1229039 - If a PanGesture input block gets interrupted, just start a new block instead of not sending the rest of the events through the APZ. r=mstange

This commit is contained in:
Kartikaya Gupta 2015-12-17 10:05:47 -05:00
parent 61d91466e4
commit 1b7df272e2

View File

@ -323,22 +323,25 @@ InputQueue::ReceivePanGestureInput(const RefPtr<AsyncPanZoomController>& aTarget
block = mInputBlockQueue.LastElement()->AsPanGestureBlock();
}
PanGestureInput event = aEvent;
nsEventStatus result = nsEventStatus_eConsumeDoDefault;
if (!block || block->WasInterrupted()) {
if (aEvent.mType != PanGestureInput::PANGESTURE_START) {
// Only PANGESTURE_START events are allowed to start a new pan gesture block.
INPQ_LOG("pangesture block %p was interrupted %d\n", block,
block ? block->WasInterrupted() : 0);
return nsEventStatus_eConsumeDoDefault;
if (event.mType != PanGestureInput::PANGESTURE_START) {
// Only PANGESTURE_START events are allowed to start a new pan gesture
// block, but we really want to start a new block here, so we magically
// turn this input into a PANGESTURE_START.
INPQ_LOG("transmogrifying pan input %d to PANGESTURE_START for new block\n",
event.mType);
event.mType = PanGestureInput::PANGESTURE_START;
}
block = new PanGestureBlockState(aTarget, aTargetConfirmed, aEvent);
block = new PanGestureBlockState(aTarget, aTargetConfirmed, event);
INPQ_LOG("started new pan gesture block %p id %" PRIu64 " for target %p\n",
block, block->GetBlockId(), aTarget.get());
if (aTargetConfirmed &&
aEvent.mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection &&
!CanScrollTargetHorizontally(aEvent, block)) {
event.mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection &&
!CanScrollTargetHorizontally(event, block)) {
// This event may trigger a swipe gesture, depending on what our caller
// wants to do it. We need to suspend handling of this block until we get
// a content response which will tell us whether to proceed or abort the
@ -368,8 +371,8 @@ InputQueue::ReceivePanGestureInput(const RefPtr<AsyncPanZoomController>& aTarget
// null) should take priority. This is equivalent to just always using the
// target (confirmed or not) from the block, which is what
// MaybeHandleCurrentBlock() does.
if (!MaybeHandleCurrentBlock(block, aEvent)) {
block->AddEvent(aEvent.AsPanGestureInput());
if (!MaybeHandleCurrentBlock(block, event)) {
block->AddEvent(event.AsPanGestureInput());
}
return result;