void InputQueue::SetAllowedTouchBehavior(uint64_t aInputBlockId, const nsTArray<TouchBehaviorFlags>& aBehaviors) { APZThreadUtils::AssertOnControllerThread(); INPQ_LOG("got allowed touch behaviours; block=%" PRIu64 "\n", aInputBlockId); bool success = false; CancelableBlockState* block = FindBlockForId(aInputBlockId, nullptr); if (block && block->AsTouchBlock()) { success = block->AsTouchBlock()->SetAllowedTouchBehaviors(aBehaviors); block->RecordContentResponseTime(); } else if (block) { NS_WARNING("input block is not a touch block"); } if (success) { ProcessQueue(); } }
void InputQueue::ProcessQueue() { APZThreadUtils::AssertOnControllerThread(); while (!mQueuedInputs.IsEmpty()) { CancelableBlockState* curBlock = mQueuedInputs[0]->Block(); if (!curBlock->IsReadyForHandling()) { break; } INPQ_LOG("processing input from block %p; preventDefault %d target %p\n", curBlock, curBlock->IsDefaultPrevented(), curBlock->GetTargetApzc().get()); RefPtr<AsyncPanZoomController> target = curBlock->GetTargetApzc(); // target may be null here if the initial target was unconfirmed and then // we later got a confirmed null target. in that case drop the events. if (target) { if (curBlock->IsDefaultPrevented()) { if (curBlock->AsTouchBlock()) { target->ResetTouchInputState(); } } else { UpdateActiveApzc(target); curBlock->DispatchEvent(*(mQueuedInputs[0]->Input())); } } mQueuedInputs.RemoveElementAt(0); } if (CanDiscardBlock(mActiveTouchBlock)) { mActiveTouchBlock = nullptr; } if (CanDiscardBlock(mActiveWheelBlock)) { mActiveWheelBlock = nullptr; } if (CanDiscardBlock(mActiveDragBlock)) { mActiveDragBlock = nullptr; } if (CanDiscardBlock(mActivePanGestureBlock)) { mActivePanGestureBlock = nullptr; } }
TouchBlockState* InputQueue::GetCurrentTouchBlock() const { CancelableBlockState* block = GetCurrentBlock(); return block ? block->AsTouchBlock() : mActiveTouchBlock.get(); }