Bug 965381 - Delay the single tap notification until after the touchdown is handled. r=daleharvey

This commit is contained in:
Kartikaya Gupta
2014-02-11 10:42:42 -05:00
parent d29b0910db
commit e46e33a164
2 changed files with 66 additions and 17 deletions

View File

@@ -963,7 +963,15 @@ nsEventStatus AsyncPanZoomController::OnSingleTapUp(const TapGestureInput& aEven
int32_t modifiers = WidgetModifiersToDOMModifiers(aEvent.modifiers);
CSSIntPoint geckoScreenPoint;
if (ConvertToGecko(aEvent.mPoint, &geckoScreenPoint)) {
controller->HandleSingleTap(geckoScreenPoint, modifiers, GetGuid());
// Because this may be being running as part of APZCTreeManager::ReceiveInputEvent,
// calling controller->HandleSingleTap directly might mean that content receives
// the single tap message before the corresponding touch-up. To avoid that we
// schedule the singletap message to run on the next spin of the event loop.
// See bug 965381 for the issue this was causing.
controller->PostDelayedTask(
NewRunnableMethod(controller.get(), &GeckoContentController::HandleSingleTap,
geckoScreenPoint, modifiers, GetGuid()),
0);
return nsEventStatus_eConsumeNoDefault;
}
}
@@ -977,7 +985,11 @@ nsEventStatus AsyncPanZoomController::OnSingleTapConfirmed(const TapGestureInput
int32_t modifiers = WidgetModifiersToDOMModifiers(aEvent.modifiers);
CSSIntPoint geckoScreenPoint;
if (ConvertToGecko(aEvent.mPoint, &geckoScreenPoint)) {
controller->HandleSingleTap(geckoScreenPoint, modifiers, GetGuid());
// See comment in OnSingleTapUp as to why we do this in PostDelayedTask.
controller->PostDelayedTask(
NewRunnableMethod(controller.get(), &GeckoContentController::HandleSingleTap,
geckoScreenPoint, modifiers, GetGuid()),
0);
return nsEventStatus_eConsumeNoDefault;
}
}