mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 806596 - Don't fire double tap if the delayed task to timeout the 1st tap fails to run in time. r=roc
This commit is contained in:
parent
585436962e
commit
f436443f50
@ -34,6 +34,7 @@ GestureEventListener::GestureEventListener(AsyncPanZoomController* aAsyncPanZoom
|
||||
: mAsyncPanZoomController(aAsyncPanZoomController),
|
||||
mState(GESTURE_NONE),
|
||||
mSpanChange(0.0f),
|
||||
mLastTapEndTime(0),
|
||||
mLastTouchInput(MultiTouchInput::MULTITOUCH_START, 0)
|
||||
{
|
||||
}
|
||||
@ -137,6 +138,17 @@ nsEventStatus GestureEventListener::HandleInputEvent(const InputData& aEvent)
|
||||
NS_WARN_IF_FALSE(foundAlreadyExistingTouch, "Touch ended, but not in list");
|
||||
|
||||
if (event.mTime - mTapStartTime <= MAX_TAP_TIME) {
|
||||
if (mState == GESTURE_WAITING_DOUBLE_TAP &&
|
||||
event.mTime - mLastTapEndTime > MAX_TAP_TIME) {
|
||||
// mDoubleTapTimeoutTask wasn't scheduled in time. We need to run the
|
||||
// task synchronously to confirm the last tap.
|
||||
mDoubleTapTimeoutTask->Cancel();
|
||||
TimeoutDoubleTap();
|
||||
|
||||
// Change the state so we can proceed to process the current tap.
|
||||
mState = GESTURE_WAITING_SINGLE_TAP;
|
||||
}
|
||||
|
||||
if (mState == GESTURE_WAITING_DOUBLE_TAP) {
|
||||
mDoubleTapTimeoutTask->Cancel();
|
||||
|
||||
@ -161,6 +173,8 @@ nsEventStatus GestureEventListener::HandleInputEvent(const InputData& aEvent)
|
||||
mDoubleTapTimeoutTask,
|
||||
MAX_TAP_TIME);
|
||||
}
|
||||
|
||||
mLastTapEndTime = event.mTime;
|
||||
}
|
||||
|
||||
if (mState == GESTURE_WAITING_SINGLE_TAP) {
|
||||
|
@ -178,6 +178,13 @@ protected:
|
||||
*/
|
||||
uint64_t mTapStartTime;
|
||||
|
||||
/**
|
||||
* Stores the time the last tap ends (finger leaves the screen). This is used
|
||||
* when mDoubleTapTimeoutTask cannot be scheduled in time and consecutive
|
||||
* taps are falsely regarded as double taps.
|
||||
*/
|
||||
uint64_t mLastTapEndTime;
|
||||
|
||||
/**
|
||||
* Cached copy of the last touch input, only valid when in the
|
||||
* "GESTURE_WAITING_DOUBLE_TAP" state. This is used to forward along to
|
||||
|
Loading…
Reference in New Issue
Block a user