Skip to content

Commit

Permalink
Bug 1544966 - Put the touch behavior flags on the TouchBlockState ear…
Browse files Browse the repository at this point in the history
…lier. r=botond

Differential Revision: https://phabricator.services.mozilla.com/D28433

--HG--
extra : moz-landing-system : lando
  • Loading branch information
staktrace committed Apr 24, 2019
1 parent 1df4ea3 commit 2607590
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
6 changes: 2 additions & 4 deletions gfx/layers/apz/src/APZCTreeManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 14 additions & 3 deletions gfx/layers/apz/src/InputQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,16 @@ InputQueue::~InputQueue() { mQueuedInputs.Clear(); }
nsEventStatus InputQueue::ReceiveInputEvent(
const RefPtr<AsyncPanZoomController>& aTarget,
TargetConfirmationFlags aFlags, const InputData& aEvent,
uint64_t* aOutInputBlockId) {
uint64_t* aOutInputBlockId,
const Maybe<nsTArray<TouchBehaviorFlags>>& aTouchBehaviors) {
APZThreadUtils::AssertOnControllerThread();

AutoRunImmediateTimeout timeoutRunner{this};

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: {
Expand Down Expand Up @@ -74,7 +75,8 @@ nsEventStatus InputQueue::ReceiveInputEvent(
nsEventStatus InputQueue::ReceiveTouchInput(
const RefPtr<AsyncPanZoomController>& aTarget,
TargetConfirmationFlags aFlags, const MultiTouchInput& aEvent,
uint64_t* aOutInputBlockId) {
uint64_t* aOutInputBlockId,
const Maybe<nsTArray<TouchBehaviorFlags>>& aTouchBehaviors) {
TouchBlockState* block = nullptr;
if (aEvent.mType == MultiTouchInput::MULTITOUCH_START) {
nsTArray<TouchBehaviorFlags> currentBehaviors;
Expand Down Expand Up @@ -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(
Expand Down
6 changes: 4 additions & 2 deletions gfx/layers/apz/src/InputQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ class InputQueue {
nsEventStatus ReceiveInputEvent(const RefPtr<AsyncPanZoomController>& aTarget,
TargetConfirmationFlags aFlags,
const InputData& aEvent,
uint64_t* aOutInputBlockId);
uint64_t* aOutInputBlockId,
const Maybe<nsTArray<TouchBehaviorFlags>>& 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
Expand Down Expand Up @@ -174,7 +175,8 @@ class InputQueue {
nsEventStatus ReceiveTouchInput(const RefPtr<AsyncPanZoomController>& aTarget,
TargetConfirmationFlags aFlags,
const MultiTouchInput& aEvent,
uint64_t* aOutInputBlockId);
uint64_t* aOutInputBlockId,
const Maybe<nsTArray<TouchBehaviorFlags>>& aTouchBehaviors);
nsEventStatus ReceiveMouseInput(const RefPtr<AsyncPanZoomController>& aTarget,
TargetConfirmationFlags aFlags,
const MouseInput& aEvent,
Expand Down

0 comments on commit 2607590

Please sign in to comment.