Bug 1289432 - Update checks for unprocessed events to use mQueuedInputs instead of checking the block is at the head. r=botond
authorKartikaya Gupta <kgupta@mozilla.com>
Wed, 14 Sep 2016 07:54:36 -0400
changeset 355213 525c3eceb1060ec39de57c45f2b8923f5518dcb9
parent 355212 1e58cc81dbefe464518acabcd2babf1eb4d8382e
child 355214 4284c891813dafaaacc329ca931997d16532817a
push id6570
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:26:13 +0000
treeherdermozilla-beta@f455459b2ae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs1289432
milestone51.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1289432 - Update checks for unprocessed events to use mQueuedInputs instead of checking the block is at the head. r=botond MozReview-Commit-ID: GEHDHhkLPKe
gfx/layers/apz/src/InputQueue.cpp
--- a/gfx/layers/apz/src/InputQueue.cpp
+++ b/gfx/layers/apz/src/InputQueue.cpp
@@ -64,17 +64,17 @@ InputQueue::ReceiveInputEvent(const RefP
       // non-touch events as well.
       return aTarget->HandleInputEvent(aEvent, aTarget->GetTransformToThis());
   }
 }
 
 bool
 InputQueue::MaybeHandleCurrentBlock(CancelableBlockState *block,
                                     const InputData& aEvent) {
-  if (block == CurrentBlock() && block->IsReadyForHandling()) {
+  if (mQueuedInputs.IsEmpty() && block->IsReadyForHandling()) {
     const RefPtr<AsyncPanZoomController>& target = block->GetTargetApzc();
     INPQ_LOG("current block is ready with target %p preventdefault %d\n",
         target.get(), block->IsDefaultPrevented());
     if (!target || block->IsDefaultPrevented()) {
       return true;
     }
     UpdateActiveApzc(block->GetTargetApzc());
     block->DispatchImmediate(aEvent);
@@ -105,17 +105,17 @@ InputQueue::ReceiveTouchInput(const RefP
 
     block = StartNewTouchBlock(aTarget, aTargetConfirmed, false);
     INPQ_LOG("started new touch block %p id %" PRIu64 " for target %p\n",
         block, block->GetBlockId(), aTarget.get());
 
     // XXX using the chain from |block| here may be wrong in cases where the
     // target isn't confirmed and the real target turns out to be something
     // else. For now assume this is rare enough that it's not an issue.
-    if (block == CurrentBlock() &&
+    if (mQueuedInputs.IsEmpty() &&
         aEvent.mTouches.Length() == 1 &&
         block->GetOverscrollHandoffChain()->HasFastFlungApzc() &&
         haveBehaviors) {
       // If we're already in a fast fling, and a single finger goes down, then
       // we want special handling for the touch event, because it shouldn't get
       // delivered to content. Note that we don't set this flag when going
       // from a fast fling to a pinch state (i.e. second finger goes down while
       // the first finger is moving).
@@ -381,17 +381,17 @@ void
 InputQueue::CancelAnimationsForNewBlock(CancelableBlockState* aBlock)
 {
   // We want to cancel animations here as soon as possible (i.e. without waiting for
   // content responses) because a finger has gone down and we don't want to keep moving
   // the content under the finger. However, to prevent "future" touchstart events from
   // interfering with "past" animations (i.e. from a previous touch block that is still
   // being processed) we only do this animation-cancellation if there are no older
   // touch blocks still in the queue.
-  if (aBlock == CurrentBlock()) {
+  if (mQueuedInputs.IsEmpty()) {
     aBlock->GetOverscrollHandoffChain()->CancelAnimations(ExcludeOverscroll | ScrollSnap);
   }
 }
 
 void
 InputQueue::MaybeRequestContentResponse(const RefPtr<AsyncPanZoomController>& aTarget,
                                         CancelableBlockState* aBlock)
 {