Bug 946661 - Dont send tapconfirmed event when tapup was handled. r=kats

This commit is contained in:
Dale Harvey 2013-12-11 17:19:42 +00:00
Родитель e95fed93c5
Коммит f90a83a007
2 изменённых файлов: 19 добавлений и 12 удалений

Просмотреть файл

@ -824,6 +824,8 @@ nsEventStatus AsyncPanZoomController::OnLongPress(const TapGestureInput& aEvent)
nsEventStatus AsyncPanZoomController::OnSingleTapUp(const TapGestureInput& aEvent) {
APZC_LOG("%p got a single-tap-up in state %d\n", this, mState);
nsRefPtr<GeckoContentController> controller = GetGeckoContentController();
// If mAllowZoom is true we wait for a call to OnSingleTapConfirmed before
// sending event to content
if (controller && !mAllowZoom) {
int32_t modifiers = WidgetModifiersToDOMModifiers(aEvent.modifiers);
CSSIntPoint geckoScreenPoint;
@ -838,8 +840,7 @@ nsEventStatus AsyncPanZoomController::OnSingleTapUp(const TapGestureInput& aEven
nsEventStatus AsyncPanZoomController::OnSingleTapConfirmed(const TapGestureInput& aEvent) {
APZC_LOG("%p got a single-tap-confirmed in state %d\n", this, mState);
nsRefPtr<GeckoContentController> controller = GetGeckoContentController();
// If zooming is disabled, we handle this in OnSingleTapUp
if (controller && mAllowZoom) {
if (controller) {
int32_t modifiers = WidgetModifiersToDOMModifiers(aEvent.modifiers);
CSSIntPoint geckoScreenPoint;
if (ConvertToGecko(aEvent.mPoint, &geckoScreenPoint)) {

Просмотреть файл

@ -167,19 +167,25 @@ nsEventStatus GestureEventListener::HandleInputEvent(const InputData& aEvent)
mState = GESTURE_NONE;
} else if (mState == GESTURE_WAITING_SINGLE_TAP) {
CancelLongTapTimeoutTask();
HandleSingleTapUpEvent(event);
nsEventStatus tapupEvent = HandleSingleTapUpEvent(event);
// We were not waiting for anything but a single tap has happened that
// may turn into a double tap. Wait a while and if it doesn't turn into
// a double tap, send a single tap instead.
mState = GESTURE_WAITING_DOUBLE_TAP;
if (tapupEvent == nsEventStatus_eIgnore) {
// We were not waiting for anything but a single tap has happened that
// may turn into a double tap. Wait a while and if it doesn't turn into
// a double tap, send a single tap instead.
mState = GESTURE_WAITING_DOUBLE_TAP;
mDoubleTapTimeoutTask =
NewRunnableMethod(this, &GestureEventListener::TimeoutDoubleTap);
mDoubleTapTimeoutTask =
NewRunnableMethod(this, &GestureEventListener::TimeoutDoubleTap);
mAsyncPanZoomController->PostDelayedTask(
mDoubleTapTimeoutTask,
MAX_TAP_TIME);
mAsyncPanZoomController->PostDelayedTask(
mDoubleTapTimeoutTask,
MAX_TAP_TIME);
} else if (tapupEvent == nsEventStatus_eConsumeNoDefault) {
// We sent the tapup into content without waiting for a double tap
mState = GESTURE_NONE;
}
}
mLastTapEndTime = event.mTime;