void DragBlockState::DispatchEvent(const InputData& aEvent) const { MouseInput mouseInput = aEvent.AsMouseInput(); if (!mouseInput.TransformToLocal(mTransformToApzc)) { return; } GetTargetApzc()->HandleDragEvent(mouseInput, mDragMetrics); }
nsEventStatus InputQueue::ReceiveInputEvent(const RefPtr<AsyncPanZoomController>& aTarget, bool aTargetConfirmed, const InputData& aEvent, uint64_t* aOutInputBlockId) { APZThreadUtils::AssertOnControllerThread(); switch (aEvent.mInputType) { case MULTITOUCH_INPUT: { const MultiTouchInput& event = aEvent.AsMultiTouchInput(); return ReceiveTouchInput(aTarget, aTargetConfirmed, event, aOutInputBlockId); } case SCROLLWHEEL_INPUT: { const ScrollWheelInput& event = aEvent.AsScrollWheelInput(); return ReceiveScrollWheelInput(aTarget, aTargetConfirmed, event, aOutInputBlockId); } case PANGESTURE_INPUT: { const PanGestureInput& event = aEvent.AsPanGestureInput(); return ReceivePanGestureInput(aTarget, aTargetConfirmed, event, aOutInputBlockId); } case MOUSE_INPUT: { const MouseInput& event = aEvent.AsMouseInput(); return ReceiveMouseInput(aTarget, aTargetConfirmed, event, aOutInputBlockId); } default: // The return value for non-touch input is only used by tests, so just pass // through the return value for now. This can be changed later if needed. // TODO (bug 1098430): we will eventually need to have smarter handling for // non-touch events as well. return aTarget->HandleInputEvent(aEvent, aTarget->GetTransformToThis()); } }
nsEventStatus APZCTreeManagerChild::ReceiveInputEvent( InputData& aEvent, ScrollableLayerGuid* aOutTargetGuid, uint64_t* aOutInputBlockId) { switch (aEvent.mInputType) { case MULTITOUCH_INPUT: { MultiTouchInput& event = aEvent.AsMultiTouchInput(); MultiTouchInput processedEvent; nsEventStatus res; SendReceiveMultiTouchInputEvent(event, &res, &processedEvent, aOutTargetGuid, aOutInputBlockId); event = processedEvent; return res; } case MOUSE_INPUT: { MouseInput& event = aEvent.AsMouseInput(); MouseInput processedEvent; nsEventStatus res; SendReceiveMouseInputEvent(event, &res, &processedEvent, aOutTargetGuid, aOutInputBlockId); event = processedEvent; return res; } case PANGESTURE_INPUT: { PanGestureInput& event = aEvent.AsPanGestureInput(); PanGestureInput processedEvent; nsEventStatus res; SendReceivePanGestureInputEvent(event, &res, &processedEvent, aOutTargetGuid, aOutInputBlockId); event = processedEvent; return res; } case PINCHGESTURE_INPUT: { PinchGestureInput& event = aEvent.AsPinchGestureInput(); PinchGestureInput processedEvent; nsEventStatus res; SendReceivePinchGestureInputEvent(event, &res, &processedEvent, aOutTargetGuid, aOutInputBlockId); event = processedEvent; return res; } case TAPGESTURE_INPUT: { TapGestureInput& event = aEvent.AsTapGestureInput(); TapGestureInput processedEvent; nsEventStatus res; SendReceiveTapGestureInputEvent(event, &res, &processedEvent, aOutTargetGuid, aOutInputBlockId); event = processedEvent; return res; } case SCROLLWHEEL_INPUT: { ScrollWheelInput& event = aEvent.AsScrollWheelInput(); ScrollWheelInput processedEvent; nsEventStatus res; SendReceiveScrollWheelInputEvent(event, &res, &processedEvent, aOutTargetGuid, aOutInputBlockId); event = processedEvent; return res; } default: { MOZ_ASSERT_UNREACHABLE("Invalid InputData type."); return nsEventStatus_eConsumeNoDefault; } } }