Bug 1638458 - Do not use ignoreRootScrollFrame when dispatching a contextmenu event in APZEventState. r=tnikkel
authorBotond Ballo <botond@mozilla.com>
Mon, 18 May 2020 03:07:12 +0000
changeset 530545 8acda9da4ae71f0b6561cb2021bcb370e18ce80c
parent 530544 661c530ea53aad76a7f5e63bd858dfb429bd8a9d
child 530546 74a83c2492318f6b1a48f7d771b8c5020195de89
push id116228
push userbballo@mozilla.com
push dateMon, 18 May 2020 04:27:17 +0000
treeherderautoland@8acda9da4ae7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstnikkel
bugs1638458
milestone78.0a1
first release with
nightly linux32
8acda9da4ae7 / 78.0a1 / 20200518093924 / files
nightly linux64
8acda9da4ae7 / 78.0a1 / 20200518093924 / files
nightly mac
8acda9da4ae7 / 78.0a1 / 20200518093924 / files
nightly win32
8acda9da4ae7 / 78.0a1 / 20200518093924 / files
nightly win64
8acda9da4ae7 / 78.0a1 / 20200518093924 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1638458 - Do not use ignoreRootScrollFrame when dispatching a contextmenu event in APZEventState. r=tnikkel The patch also removes the ignoreRootScrollFrame option from APZCCallbackHelper::DispatchMouseEvent() altogether as it is no longer used. Depends on D75735 Differential Revision: https://phabricator.services.mozilla.com/D75736
dom/ipc/BrowserChild.cpp
gfx/layers/apz/util/APZCCallbackHelper.cpp
gfx/layers/apz/util/APZCCallbackHelper.h
gfx/layers/apz/util/APZEventState.cpp
--- a/dom/ipc/BrowserChild.cpp
+++ b/dom/ipc/BrowserChild.cpp
@@ -1460,20 +1460,20 @@ mozilla::ipc::IPCResult BrowserChild::Re
     const nsString& aType, const float& aX, const float& aY,
     const int32_t& aButton, const int32_t& aClickCount,
     const int32_t& aModifiers) {
   // IPDL doesn't hold a strong reference to protocols as they're not required
   // to be refcounted. This function can run script, which may trigger a nested
   // event loop, which may release this, so we hold a strong reference here.
   RefPtr<BrowserChild> kungFuDeathGrip(this);
   RefPtr<PresShell> presShell = GetTopLevelPresShell();
-  APZCCallbackHelper::DispatchMouseEvent(
-      presShell, aType, CSSPoint(aX, aY), aButton, aClickCount, aModifiers,
-      false, MouseEvent_Binding::MOZ_SOURCE_UNKNOWN,
-      0 /* Use the default value here. */);
+  APZCCallbackHelper::DispatchMouseEvent(presShell, aType, CSSPoint(aX, aY),
+                                         aButton, aClickCount, aModifiers,
+                                         MouseEvent_Binding::MOZ_SOURCE_UNKNOWN,
+                                         0 /* Use the default value here. */);
   return IPC_OK();
 }
 
 void BrowserChild::ProcessPendingCoalescedMouseDataAndDispatchEvents() {
   if (!mCoalesceMouseMoveEvents || !mCoalescedMouseEventFlusher) {
     // We don't enable mouse coalescing or we are destroying BrowserChild.
     return;
   }
--- a/gfx/layers/apz/util/APZCCallbackHelper.cpp
+++ b/gfx/layers/apz/util/APZCCallbackHelper.cpp
@@ -484,26 +484,25 @@ nsEventStatus APZCCallbackHelper::Dispat
   // pointer events again.
   event.convertToPointer = false;
   return DispatchWidgetEvent(event);
 }
 
 bool APZCCallbackHelper::DispatchMouseEvent(
     PresShell* aPresShell, const nsString& aType, const CSSPoint& aPoint,
     int32_t aButton, int32_t aClickCount, int32_t aModifiers,
-    bool aIgnoreRootScrollFrame, unsigned short aInputSourceArg,
-    uint32_t aPointerId) {
+    unsigned short aInputSourceArg, uint32_t aPointerId) {
   NS_ENSURE_TRUE(aPresShell, true);
 
   bool defaultPrevented = false;
   nsContentUtils::SendMouseEvent(
       aPresShell, aType, aPoint.x, aPoint.y, aButton,
       nsIDOMWindowUtils::MOUSE_BUTTONS_NOT_SPECIFIED, aClickCount, aModifiers,
-      aIgnoreRootScrollFrame, 0, aInputSourceArg, aPointerId, false,
-      &defaultPrevented, false, /* aIsWidgetEventSynthesized = */ false);
+      /* aIgnoreRootScrollFrame = */ false, 0, aInputSourceArg, aPointerId,
+      false, &defaultPrevented, false, /* aIsWidgetEventSynthesized = */ false);
   return defaultPrevented;
 }
 
 void APZCCallbackHelper::FireSingleTapEvent(const LayoutDevicePoint& aPoint,
                                             Modifiers aModifiers,
                                             int32_t aClickCount,
                                             nsIWidget* aWidget) {
   if (aWidget->Destroyed()) {
--- a/gfx/layers/apz/util/APZCCallbackHelper.h
+++ b/gfx/layers/apz/util/APZCCallbackHelper.h
@@ -113,17 +113,16 @@ class APZCCallbackHelper {
    * Return whether or not any listeners have called preventDefault on the
    * event.
    * This is a lightweight wrapper around nsContentUtils::SendMouseEvent()
    * and as such expects |aPoint| to be in layout coordinates. */
   MOZ_CAN_RUN_SCRIPT
   static bool DispatchMouseEvent(PresShell* aPresShell, const nsString& aType,
                                  const CSSPoint& aPoint, int32_t aButton,
                                  int32_t aClickCount, int32_t aModifiers,
-                                 bool aIgnoreRootScrollFrame,
                                  unsigned short aInputSourceArg,
                                  uint32_t aPointerId);
 
   /* Fire a single-tap event at the given point. The event is dispatched
    * via the given widget. */
   static void FireSingleTapEvent(const LayoutDevicePoint& aPoint,
                                  Modifiers aModifiers, int32_t aClickCount,
                                  nsIWidget* aWidget);
--- a/gfx/layers/apz/util/APZEventState.cpp
+++ b/gfx/layers/apz/util/APZEventState.cpp
@@ -218,17 +218,17 @@ bool APZEventState::FireContextmenuEvent
   // Converting the modifiers to DOM format for the DispatchMouseEvent call
   // is the most useless thing ever because nsDOMWindowUtils::SendMouseEvent
   // just converts them back to widget format, but that API has many callers,
   // including in JS code, so it's not trivial to change.
   CSSPoint point = CSSPoint::FromAppUnits(
       ViewportUtils::VisualToLayout(CSSPoint::ToAppUnits(aPoint), aPresShell));
   bool eventHandled = APZCCallbackHelper::DispatchMouseEvent(
       aPresShell, NS_LITERAL_STRING("contextmenu"), point, 2, 1,
-      WidgetModifiersToDOMModifiers(aModifiers), true,
+      WidgetModifiersToDOMModifiers(aModifiers),
       dom::MouseEvent_Binding::MOZ_SOURCE_TOUCH,
       0 /* Use the default value here. */);
 
   APZES_LOG("Contextmenu event handled: %d\n", eventHandled);
   if (eventHandled) {
     // If the contextmenu event was handled then we're showing a contextmenu,
     // and so we should remove any activation
     mActiveElementManager->ClearActivation();