From 260759064e08977a869606b155a12ca21cfdf6c7 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Wed, 24 Apr 2019 17:40:28 +0000 Subject: [PATCH] Bug 1544966 - Put the touch behavior flags on the TouchBlockState earlier. r=botond Differential Revision: https://phabricator.services.mozilla.com/D28433 --HG-- extra : moz-landing-system : lando --- gfx/layers/apz/src/APZCTreeManager.cpp | 6 ++---- gfx/layers/apz/src/InputQueue.cpp | 17 ++++++++++++++--- gfx/layers/apz/src/InputQueue.h | 6 ++++-- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/gfx/layers/apz/src/APZCTreeManager.cpp b/gfx/layers/apz/src/APZCTreeManager.cpp index 400e9725f12ea..f538c1a116704 100644 --- a/gfx/layers/apz/src/APZCTreeManager.cpp +++ b/gfx/layers/apz/src/APZCTreeManager.cpp @@ -1787,13 +1787,11 @@ nsEventStatus APZCTreeManager::ProcessTouchInput( uint64_t inputBlockId = 0; result = mInputQueue->ReceiveInputEvent( mApzcForInputBlock, TargetConfirmationFlags{mHitResultForInputBlock}, - aInput, &inputBlockId); + aInput, &inputBlockId, + touchBehaviors.IsEmpty() ? Nothing() : Some(touchBehaviors)); if (aOutInputBlockId) { *aOutInputBlockId = inputBlockId; } - if (!touchBehaviors.IsEmpty()) { - mInputQueue->SetAllowedTouchBehavior(inputBlockId, touchBehaviors); - } // For computing the event to pass back to Gecko, use up-to-date // transforms (i.e. not anything cached in an input block). This ensures diff --git a/gfx/layers/apz/src/InputQueue.cpp b/gfx/layers/apz/src/InputQueue.cpp index 94f63b90ebcad..ff3b4c09035e5 100644 --- a/gfx/layers/apz/src/InputQueue.cpp +++ b/gfx/layers/apz/src/InputQueue.cpp @@ -27,7 +27,8 @@ InputQueue::~InputQueue() { mQueuedInputs.Clear(); } nsEventStatus InputQueue::ReceiveInputEvent( const RefPtr& aTarget, TargetConfirmationFlags aFlags, const InputData& aEvent, - uint64_t* aOutInputBlockId) { + uint64_t* aOutInputBlockId, + const Maybe>& aTouchBehaviors) { APZThreadUtils::AssertOnControllerThread(); AutoRunImmediateTimeout timeoutRunner{this}; @@ -35,7 +36,7 @@ nsEventStatus InputQueue::ReceiveInputEvent( switch (aEvent.mInputType) { case MULTITOUCH_INPUT: { const MultiTouchInput& event = aEvent.AsMultiTouchInput(); - return ReceiveTouchInput(aTarget, aFlags, event, aOutInputBlockId); + return ReceiveTouchInput(aTarget, aFlags, event, aOutInputBlockId, aTouchBehaviors); } case SCROLLWHEEL_INPUT: { @@ -74,7 +75,8 @@ nsEventStatus InputQueue::ReceiveInputEvent( nsEventStatus InputQueue::ReceiveTouchInput( const RefPtr& aTarget, TargetConfirmationFlags aFlags, const MultiTouchInput& aEvent, - uint64_t* aOutInputBlockId) { + uint64_t* aOutInputBlockId, + const Maybe>& aTouchBehaviors) { TouchBlockState* block = nullptr; if (aEvent.mType == MultiTouchInput::MULTITOUCH_START) { nsTArray currentBehaviors; @@ -115,12 +117,21 @@ nsEventStatus InputQueue::ReceiveTouchInput( block->SetAllowedTouchBehaviors(currentBehaviors); } INPQ_LOG("block %p tagged as fast-motion\n", block); + } else if (aTouchBehaviors) { + // If this block isn't started during a fast-fling, and APZCTM has + // provided touch behavior information, then put it on the block so + // that the ArePointerEventsConsumable call below can use it. + block->SetAllowedTouchBehaviors(*aTouchBehaviors); } CancelAnimationsForNewBlock(block); MaybeRequestContentResponse(aTarget, block); } else { + // for touch inputs that don't start a block, APZCTM shouldn't be giving + // us any touch behaviors. + MOZ_ASSERT(aTouchBehaviors.isNothing()); + block = mActiveTouchBlock.get(); if (!block) { NS_WARNING( diff --git a/gfx/layers/apz/src/InputQueue.h b/gfx/layers/apz/src/InputQueue.h index 793237e65ef85..1e0f0add79e40 100644 --- a/gfx/layers/apz/src/InputQueue.h +++ b/gfx/layers/apz/src/InputQueue.h @@ -54,7 +54,8 @@ class InputQueue { nsEventStatus ReceiveInputEvent(const RefPtr& aTarget, TargetConfirmationFlags aFlags, const InputData& aEvent, - uint64_t* aOutInputBlockId); + uint64_t* aOutInputBlockId, + const Maybe>& aTouchBehaviors = Nothing()); /** * This function should be invoked to notify the InputQueue when web content * decides whether or not it wants to cancel a block of events. The block @@ -174,7 +175,8 @@ class InputQueue { nsEventStatus ReceiveTouchInput(const RefPtr& aTarget, TargetConfirmationFlags aFlags, const MultiTouchInput& aEvent, - uint64_t* aOutInputBlockId); + uint64_t* aOutInputBlockId, + const Maybe>& aTouchBehaviors); nsEventStatus ReceiveMouseInput(const RefPtr& aTarget, TargetConfirmationFlags aFlags, const MouseInput& aEvent,