зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1083395 - Extract helpers function from the input-handling codepath. r=botond
This commit is contained in:
Родитель
eea9473d65
Коммит
2489aa5b2e
|
@ -1036,7 +1036,7 @@ nsEventStatus AsyncPanZoomController::ReceiveInputEvent(const InputData& aEvent)
|
|||
block->GetOverscrollHandoffChain()->CancelAnimations();
|
||||
}
|
||||
|
||||
if (mFrameMetrics.GetMayHaveTouchListeners() || mFrameMetrics.GetMayHaveTouchCaret()) {
|
||||
if (NeedToWaitForContent()) {
|
||||
// Content may intercept the touch events and prevent-default them. So we schedule
|
||||
// a timeout to give content time to do that.
|
||||
ScheduleContentResponseTimeout();
|
||||
|
@ -3004,14 +3004,8 @@ AsyncPanZoomController::ProcessPendingInputBlocks() {
|
|||
APZC_LOG("%p processing input block %p; preventDefault %d\n",
|
||||
this, curBlock, curBlock->IsDefaultPrevented());
|
||||
if (curBlock->IsDefaultPrevented()) {
|
||||
SetState(NOTHING);
|
||||
curBlock->DropEvents();
|
||||
// Also clear the state in the gesture event listener
|
||||
nsRefPtr<GestureEventListener> listener = GetGestureEventListener();
|
||||
if (listener) {
|
||||
MultiTouchInput cancel(MultiTouchInput::MULTITOUCH_CANCEL, 0, TimeStamp::Now(), 0);
|
||||
listener->HandleInputEvent(cancel);
|
||||
}
|
||||
ResetInputState();
|
||||
} else {
|
||||
while (curBlock->HasEvents()) {
|
||||
HandleInputEvent(curBlock->RemoveFirstEvent());
|
||||
|
@ -3034,6 +3028,24 @@ AsyncPanZoomController::ProcessPendingInputBlocks() {
|
|||
}
|
||||
}
|
||||
|
||||
bool
|
||||
AsyncPanZoomController::NeedToWaitForContent() const
|
||||
{
|
||||
return (mFrameMetrics.GetMayHaveTouchListeners() || mFrameMetrics.GetMayHaveTouchCaret());
|
||||
}
|
||||
|
||||
void
|
||||
AsyncPanZoomController::ResetInputState()
|
||||
{
|
||||
SetState(NOTHING);
|
||||
// Also clear the state in the gesture event listener
|
||||
nsRefPtr<GestureEventListener> listener = GetGestureEventListener();
|
||||
if (listener) {
|
||||
MultiTouchInput cancel(MultiTouchInput::MULTITOUCH_CANCEL, 0, TimeStamp::Now(), 0);
|
||||
listener->HandleInputEvent(cancel);
|
||||
}
|
||||
}
|
||||
|
||||
TouchBlockState*
|
||||
AsyncPanZoomController::StartNewTouchBlock(bool aCopyAllowedTouchBehaviorFromCurrent)
|
||||
{
|
||||
|
|
|
@ -815,6 +815,8 @@ private:
|
|||
TouchBlockState* StartNewTouchBlock(bool aCopyAllowedTouchBehaviorFromCurrent);
|
||||
TouchBlockState* CurrentTouchBlock();
|
||||
bool HasReadyTouchBlock();
|
||||
bool NeedToWaitForContent() const;
|
||||
void ResetInputState();
|
||||
|
||||
private:
|
||||
// The queue of touch blocks that have not yet been processed by this APZC.
|
||||
|
|
Загрузка…
Ссылка в новой задаче