From 30bc5e7c6dc8bd9fd8f3e34d178fe910bd0798e7 Mon Sep 17 00:00:00 2001 From: Roy Tam Date: Fri, 31 May 2019 07:25:07 +0800 Subject: [PATCH] import change from rmottola/Arctic-Fox: - revert PaleMoon HSCROLL (077a87aed) - If APZ is enabled, do not handle wheel-event scrolling in layout. (bug 1126090 part 1) (8c0ba79d6) - Factor out how APZ-aware events are dispatched from widgets. (bug 1126090 part 2) (fb6b7e57b) - Events synthesized in the child process must be propagated back to the parent. (bug 1126090 part 3) (5a4c9439e) - Translate coordinates in events synthesized from the child process. (bug 1126090 part 4) (5148f7fc2) - Wait for all paints to flush before synthesizing scroll events. (bug 1126090 part 5) (b99a19995) - Don't try to async scroll frames that have less than one pixel of scrollability. (bug 1126090 part 7) (475ffa090) --- dom/base/nsDOMWindowUtils.cpp | 4 +--- dom/events/EventStateManager.cpp | 20 +++++++++++++------- dom/events/EventStateManager.h | 3 +-- dom/events/test/mochitest.ini | 3 ++- dom/events/test/test_bug946632.html | 6 +++++- dom/ipc/PBrowser.ipdl | 2 ++ dom/ipc/TabParent.cpp | 15 +++++++++++++++ dom/ipc/TabParent.h | 1 + gfx/layers/apz/src/APZCTreeManager.cpp | 11 ++++++++--- gfx/layers/apz/src/APZCTreeManager.h | 9 +++++++++ layout/generic/nsGfxScrollFrame.cpp | 11 +++++------ layout/generic/test/mochitest.ini | 2 +- widget/PuppetWidget.cpp | 24 ++++++++++++++++++++++++ widget/PuppetWidget.h | 1 + widget/gonk/nsWindow.cpp | 2 +- widget/gtk/nsWindow.cpp | 14 +------------- widget/nsBaseWidget.cpp | 25 ++++++++++++++++++++++--- widget/nsBaseWidget.h | 12 +++++++----- widget/nsIWidget.h | 7 +++++++ widget/windows/nsWindow.cpp | 17 +++++------------ 20 files changed, 131 insertions(+), 58 deletions(-) diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp index 7fd9dad16f..638ab1135c 100644 --- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -1030,9 +1030,7 @@ nsDOMWindowUtils::SendWheelEvent(float aX, wheelEvent.refPoint = ToWidgetPoint(CSSPoint(aX, aY), offset, presContext); - nsEventStatus status; - nsresult rv = widget->DispatchEvent(&wheelEvent, status); - NS_ENSURE_SUCCESS(rv, rv); + widget->DispatchAPZAwareEvent(&wheelEvent); bool failedX = false; if ((aOptions & WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_X_ZERO) && diff --git a/dom/events/EventStateManager.cpp b/dom/events/EventStateManager.cpp index c178edc7aa..595c82c169 100644 --- a/dom/events/EventStateManager.cpp +++ b/dom/events/EventStateManager.cpp @@ -87,6 +87,7 @@ #include "mozilla/LookAndFeel.h" #include "GoannaProfiler.h" #include "Units.h" +#include "mozilla/layers/APZCTreeManager.h" #ifdef XP_MACOSX #import @@ -3046,13 +3047,18 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext, } WidgetWheelEvent* wheelEvent = aEvent->AsWheelEvent(); - switch (WheelPrefs::GetInstance()->ComputeActionFor(wheelEvent)) { - case WheelPrefs::ACTION_HSCROLL: { - // Swap axes and fall through - double deltaX = wheelEvent->deltaX; - wheelEvent->deltaX = wheelEvent->deltaY; - wheelEvent->deltaY = deltaX; - } + + // When APZ is enabled, the actual scroll animation might be handled by + // the compositor. + WheelPrefs::Action action; + if (gfxPrefs::AsyncPanZoomEnabled() && + layers::APZCTreeManager::WillHandleWheelEvent(wheelEvent)) + { + action = WheelPrefs::ACTION_NONE; + } else { + action = WheelPrefs::GetInstance()->ComputeActionFor(wheelEvent); + } + switch (action) { case WheelPrefs::ACTION_SCROLL: { // For scrolling of default action, we should honor the mouse wheel // transaction. diff --git a/dom/events/EventStateManager.h b/dom/events/EventStateManager.h index fe94041f44..3abc247a33 100644 --- a/dom/events/EventStateManager.h +++ b/dom/events/EventStateManager.h @@ -447,8 +447,7 @@ protected: ACTION_SCROLL, ACTION_HISTORY, ACTION_ZOOM, - ACTION_HSCROLL, - ACTION_LAST = ACTION_HSCROLL + ACTION_LAST = ACTION_ZOOM }; Action ComputeActionFor(WidgetWheelEvent* aEvent); diff --git a/dom/events/test/mochitest.ini b/dom/events/test/mochitest.ini index c31a5183e9..66142ed386 100644 --- a/dom/events/test/mochitest.ini +++ b/dom/events/test/mochitest.ini @@ -131,6 +131,7 @@ skip-if = buildapp == 'mulet' || buildapp == 'b2g' # b2g(failing when the test g [test_bug944011.html] [test_bug944847.html] [test_bug946632.html] +skip-if = buildapp == 'b2g' [test_bug967796.html] skip-if = toolkit == "gonk" || e10s [test_bug985988.html] @@ -165,7 +166,7 @@ skip-if = toolkit == 'android' #CRASH_DUMP, RANDOM skip-if = buildapp == 'mulet' [test_messageEvent.html] [test_moz_mouse_pixel_scroll_event.html] -skip-if = buildapp == 'mulet' +skip-if = buildapp == 'mulet' || buildapp == 'b2g' # bug 1126090, no wheel events on b2g [test_onerror_handler_args.html] [test_wheel_default_action.html] skip-if = buildapp == 'mulet' || buildapp == 'b2g' || e10s diff --git a/dom/events/test/test_bug946632.html b/dom/events/test/test_bug946632.html index 2de34ed951..7e2154d34c 100644 --- a/dom/events/test/test_bug946632.html +++ b/dom/events/test/test_bug946632.html @@ -7,6 +7,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=946632 Test for bug 946632 - propagate mouse-wheel vertical scroll events to container +