Bug 1177018 - Send mouse move events generated via nsIPresShell::SynthesizeMouseMove() to the child process through a different IPDL message than real mouse move events. r=smaug draft
authorBotond Ballo <botond@mozilla.com>
Mon, 27 Jul 2015 18:35:51 -0400
changeset 287218 93ea7c6de901b5c15e85c799ef53c786e44f7e19
parent 287217 294fed9243a65378f73605c9ef1472e24b1c397c
child 287219 2b88c42827385e1419eea2c0757bae9110805534
push id4674
push userbballo@mozilla.com
push dateSat, 22 Aug 2015 20:54:14 +0000
reviewerssmaug
bugs1177018
milestone43.0a1
Bug 1177018 - Send mouse move events generated via nsIPresShell::SynthesizeMouseMove() to the child process through a different IPDL message than real mouse move events. r=smaug This avoids a real event being dropped in favour of a synthesized event via IPDL compression, which is important because synthesized events don't generate 'mousemove' DOM events.
dom/ipc/PBrowser.ipdl
dom/ipc/TabChild.cpp
dom/ipc/TabChild.h
dom/ipc/TabParent.cpp
--- a/dom/ipc/PBrowser.ipdl
+++ b/dom/ipc/PBrowser.ipdl
@@ -628,16 +628,24 @@ child:
                int32_t aModifiers,
                bool aIgnoreRootScrollFrame);
 
     /**
      * When two consecutive mouse move events would be added to the message queue,
      * they are 'compressed' by dumping the oldest one.
      */
     RealMouseMoveEvent(WidgetMouseEvent event) compress;
+    /**
+     * Mouse move events with |reason == eSynthesized| are sent via a separate
+     * message because they do not generate DOM 'mousemove' events, and the
+     * 'compress' attribute on RealMouseMoveEvent() could result in a
+     * |reason == eReal| event being dropped in favour of an |eSynthesized|
+     * event, and thus a DOM 'mousemove' event to be lost.
+     */
+    RealSynthMouseMoveEvent(WidgetMouseEvent event);
     RealMouseButtonEvent(WidgetMouseEvent event);
     RealKeyEvent(WidgetKeyboardEvent event, MaybeNativeKeyBinding keyBinding);
     MouseWheelEvent(WidgetWheelEvent event, ScrollableLayerGuid aGuid, uint64_t aInputBlockId);
     RealTouchEvent(WidgetTouchEvent aEvent,
                    ScrollableLayerGuid aGuid,
                    uint64_t aInputBlockId,
                    nsEventStatus aApzResponse);
     RealTouchMoveEvent(WidgetTouchEvent aEvent,
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -1837,16 +1837,22 @@ TabChild::RecvMouseEvent(const nsString&
 
 bool
 TabChild::RecvRealMouseMoveEvent(const WidgetMouseEvent& event)
 {
   return RecvRealMouseButtonEvent(event);
 }
 
 bool
+TabChild::RecvRealSynthMouseMoveEvent(const WidgetMouseEvent& event)
+{
+  return RecvRealMouseButtonEvent(event);
+}
+
+bool
 TabChild::RecvRealMouseButtonEvent(const WidgetMouseEvent& event)
 {
   WidgetMouseEvent localEvent(event);
   localEvent.widget = mPuppetWidget;
   APZCCallbackHelper::DispatchWidgetEvent(localEvent);
   return true;
 }
 
--- a/dom/ipc/TabChild.h
+++ b/dom/ipc/TabChild.h
@@ -329,16 +329,17 @@ public:
     virtual bool RecvMouseEvent(const nsString& aType,
                                 const float&    aX,
                                 const float&    aY,
                                 const int32_t&  aButton,
                                 const int32_t&  aClickCount,
                                 const int32_t&  aModifiers,
                                 const bool&     aIgnoreRootScrollFrame) override;
     virtual bool RecvRealMouseMoveEvent(const mozilla::WidgetMouseEvent& event) override;
+    virtual bool RecvRealSynthMouseMoveEvent(const mozilla::WidgetMouseEvent& event) override;
     virtual bool RecvRealMouseButtonEvent(const mozilla::WidgetMouseEvent& event) override;
     virtual bool RecvRealDragEvent(const WidgetDragEvent& aEvent,
                                    const uint32_t& aDragAction,
                                    const uint32_t& aDropEffect) override;
     virtual bool RecvRealKeyEvent(const mozilla::WidgetKeyboardEvent& event,
                                   const MaybeNativeKeyBinding& aBindings) override;
     virtual bool RecvMouseWheelEvent(const mozilla::WidgetWheelEvent& event,
                                      const ScrollableLayerGuid& aGuid,
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -1375,17 +1375,21 @@ bool TabParent::SendRealMouseEvent(Widge
         widget->SetCursor(mCursor);
       }
     } else if (NS_MOUSE_EXIT_WIDGET == event.message) {
       mTabSetsCursor = false;
     }
   }
 
   if (NS_MOUSE_MOVE == event.message) {
-    return SendRealMouseMoveEvent(event);
+    if (event.reason == WidgetMouseEvent::eSynthesized) {
+      return SendRealSynthMouseMoveEvent(event);
+    } else {
+      return SendRealMouseMoveEvent(event);
+    }
   }
   return SendRealMouseButtonEvent(event);
 }
 
 LayoutDeviceToCSSScale
 TabParent::GetLayoutDeviceToCSSScale()
 {
   nsCOMPtr<nsIContent> content = do_QueryInterface(mFrameElement);