From f6cc8801a72365887a72a0f35dab82ed6af2fc7d Mon Sep 17 00:00:00 2001 From: Doug Sherk Date: Fri, 22 Aug 2014 15:12:13 -0400 Subject: [PATCH] Backed out changeset 8a06f8cd41a9 (bug 1037066) for regressions: bug 1055214, bug 1049250, bug 1055203. --- widget/gonk/nsAppShell.cpp | 70 +++++++++++++++----------------------- 1 file changed, 27 insertions(+), 43 deletions(-) diff --git a/widget/gonk/nsAppShell.cpp b/widget/gonk/nsAppShell.cpp index b8815055d1ef..d0d9bc18d72f 100644 --- a/widget/gonk/nsAppShell.cpp +++ b/widget/gonk/nsAppShell.cpp @@ -196,29 +196,8 @@ UserInputData::DOMModifiers() const } static void -sendMouseEvent(UserInputData& data, nsEventStatus status) +sendMouseEvent(uint32_t msg, UserInputData& data, bool forwardToChildren) { - int32_t action = data.action & AMOTION_EVENT_ACTION_MASK; - uint32_t msg; - switch (action) { - case AMOTION_EVENT_ACTION_DOWN: - msg = NS_MOUSE_BUTTON_DOWN; - break; - case AMOTION_EVENT_ACTION_POINTER_DOWN: - case AMOTION_EVENT_ACTION_POINTER_UP: - case AMOTION_EVENT_ACTION_MOVE: - case AMOTION_EVENT_ACTION_HOVER_MOVE: - msg = NS_MOUSE_MOVE; - break; - case AMOTION_EVENT_ACTION_OUTSIDE: - case AMOTION_EVENT_ACTION_CANCEL: - case AMOTION_EVENT_ACTION_UP: - msg = NS_MOUSE_BUTTON_UP; - break; - default: - return; - } - WidgetMouseEvent event(true, msg, nullptr, WidgetMouseEvent::eReal, WidgetMouseEvent::eNormal); @@ -231,7 +210,7 @@ sendMouseEvent(UserInputData& data, nsEventStatus status) event.clickCount = 1; event.modifiers = data.DOMModifiers(); - event.mFlags.mNoCrossProcessBoundaryForwarding = status == nsEventStatus_eConsumeNoDefault; + event.mFlags.mNoCrossProcessBoundaryForwarding = !forwardToChildren; nsWindow::DispatchInputEvent(event); } @@ -788,30 +767,35 @@ GeckoInputDispatcher::dispatchOnce() if (mEnabledUniformityInfo) { printUniformityInfo(data); } - if (!captured) { - sendMouseEvent(data, status); + if (captured) { + return; } } - if (action == AMOTION_EVENT_ACTION_DOWN || - action == AMOTION_EVENT_ACTION_POINTER_DOWN) { - // Bug 1037066: Simulate a touchmove/mousemove event pair at the - // same spot as the touchstart/mousedown pair, but immediately after - // it. This allows content to preventDefault the first touchmove in - // a timely manner, even if the user keeps their finger stationary - // after the touchstart. The ultimate end goal here is to allow APZ - // to receive a prevent-default=yes|no message ASAP. - UserInputData simulatedMoveEvent(data); - simulatedMoveEvent.action &= ~AMOTION_EVENT_ACTION_MASK; - simulatedMoveEvent.action |= AMOTION_EVENT_ACTION_MOVE; - - bool captured; - status = sendTouchEvent(simulatedMoveEvent, &captured); - if (!captured) { - sendMouseEvent(simulatedMoveEvent, status); - } + uint32_t msg; + switch (action) { + case AMOTION_EVENT_ACTION_DOWN: + msg = NS_MOUSE_BUTTON_DOWN; + break; + case AMOTION_EVENT_ACTION_POINTER_DOWN: + case AMOTION_EVENT_ACTION_POINTER_UP: + case AMOTION_EVENT_ACTION_MOVE: + case AMOTION_EVENT_ACTION_HOVER_MOVE: + msg = NS_MOUSE_MOVE; + break; + case AMOTION_EVENT_ACTION_OUTSIDE: + case AMOTION_EVENT_ACTION_CANCEL: + case AMOTION_EVENT_ACTION_UP: + msg = NS_MOUSE_BUTTON_UP; + break; + default: + msg = NS_EVENT_NULL; + break; + } + if (msg != NS_EVENT_NULL) { + sendMouseEvent(msg, data, + status != nsEventStatus_eConsumeNoDefault); } - break; } case UserInputData::KEY_DATA: {