Bug 1091283 - Ensure that pinch gesture events actually get processed. r=botond

Currently only pinch gesture events getting created in the GestureEventListener
code will make it to AsyncPanZoomController::HandleGestureEvent. Any pinch
gesture events that the widget code dispatches into the APZCTreeManager get
ignored, which shouldn't be happening. We don't have any production code that
exercises these code paths at the moment, but fixing it up also reduces the
APIs exposed into the testing code.
This commit is contained in:
Kartikaya Gupta 2014-10-31 15:29:36 -04:00
parent b26b26e3fa
commit bb29793fb8
3 changed files with 13 additions and 11 deletions

View File

@ -1081,7 +1081,7 @@ nsEventStatus AsyncPanZoomController::HandleInputEvent(const InputData& aEvent)
} }
break; break;
} }
default: NS_WARNING("Unhandled input event"); break; default: return HandleGestureEvent(aEvent);
} }
return rv; return rv;

View File

@ -30,10 +30,9 @@ InputQueue::ReceiveInputEvent(const nsRefPtr<AsyncPanZoomController>& aTarget, c
AsyncPanZoomController::AssertOnControllerThread(); AsyncPanZoomController::AssertOnControllerThread();
if (aEvent.mInputType != MULTITOUCH_INPUT) { if (aEvent.mInputType != MULTITOUCH_INPUT) {
aTarget->HandleInputEvent(aEvent); // The return value for non-touch input is only used by tests, so just pass
// The return value for non-touch input isn't really used, so just return // through the return value for now. This can be changed later if needed.
// ConsumeDoDefault for now. This can be changed later if needed. return aTarget->HandleInputEvent(aEvent);
return nsEventStatus_eConsumeDoDefault;
} }
TouchBlockState* block = nullptr; TouchBlockState* block = nullptr;

View File

@ -405,26 +405,29 @@ ApzcPinchWithPinchInput(TestAsyncPanZoomController* aApzc,
int aFocusX, int aFocusY, float aScale, int aFocusX, int aFocusY, float aScale,
nsEventStatus (*aOutEventStatuses)[3] = nullptr) nsEventStatus (*aOutEventStatuses)[3] = nullptr)
{ {
nsEventStatus actualStatus = aApzc->HandleGestureEvent( nsEventStatus actualStatus = aApzc->ReceiveInputEvent(
PinchGestureInput(PinchGestureInput::PINCHGESTURE_START, PinchGestureInput(PinchGestureInput::PINCHGESTURE_START,
0, TimeStamp(), ScreenPoint(aFocusX, aFocusY), 0, TimeStamp(), ScreenPoint(aFocusX, aFocusY),
10.0, 10.0, 0)); 10.0, 10.0, 0),
nullptr);
if (aOutEventStatuses) { if (aOutEventStatuses) {
(*aOutEventStatuses)[0] = actualStatus; (*aOutEventStatuses)[0] = actualStatus;
} }
actualStatus = aApzc->HandleGestureEvent( actualStatus = aApzc->ReceiveInputEvent(
PinchGestureInput(PinchGestureInput::PINCHGESTURE_SCALE, PinchGestureInput(PinchGestureInput::PINCHGESTURE_SCALE,
0, TimeStamp(), ScreenPoint(aFocusX, aFocusY), 0, TimeStamp(), ScreenPoint(aFocusX, aFocusY),
10.0 * aScale, 10.0, 0)); 10.0 * aScale, 10.0, 0),
nullptr);
if (aOutEventStatuses) { if (aOutEventStatuses) {
(*aOutEventStatuses)[1] = actualStatus; (*aOutEventStatuses)[1] = actualStatus;
} }
actualStatus = aApzc->HandleGestureEvent( actualStatus = aApzc->ReceiveInputEvent(
PinchGestureInput(PinchGestureInput::PINCHGESTURE_END, PinchGestureInput(PinchGestureInput::PINCHGESTURE_END,
0, TimeStamp(), ScreenPoint(aFocusX, aFocusY), 0, TimeStamp(), ScreenPoint(aFocusX, aFocusY),
// note: negative values here tell APZC // note: negative values here tell APZC
// not to turn the pinch into a pan // not to turn the pinch into a pan
-1.0, -1.0, 0)); -1.0, -1.0, 0),
nullptr);
if (aOutEventStatuses) { if (aOutEventStatuses) {
(*aOutEventStatuses)[2] = actualStatus; (*aOutEventStatuses)[2] = actualStatus;
} }