Bug 1446904 - Do not generate drag gestures from synthesized/mouse events while in touch drag mode. r=kats, r=smaug, a=RyanVM
authorJohann Hofmann <jhofmann@mozilla.com>
Thu, 05 Apr 2018 19:02:14 +0200
changeset 463098 975203f0114ddcce4a02378a9b7a4e6cbb803db6
parent 463097 bb3cfe7f354defce79b764925e1f80262bc46c8a
child 463099 50977d34a015f159285f339e8412c927dceb87d8
push id1683
push usersfraser@mozilla.com
push dateThu, 26 Apr 2018 16:43:40 +0000
treeherdermozilla-release@5af6cb21869d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats, smaug, RyanVM
bugs1446904
milestone60.0
Bug 1446904 - Do not generate drag gestures from synthesized/mouse events while in touch drag mode. r=kats, r=smaug, a=RyanVM Calling GenerateDragGesture at this point should not be necessary, since eTouchMove events are already handled in the same function. This code is intermittently triggered through (what I can only call "rogue") eMouseMove, ePointerDown and ePointerMove events, which is causing hangs in the native DoDragDrop function further down the stack. Arguably this shouldn't be triggered by e.g. ePointerDown either, and I'm unclear on why exactly DoDragDrop is hanging (likely because it is called again before the user does a drop), but this is a quick fix that should be suitable for uplift. MozReview-Commit-ID: A0hBlS85icx
dom/events/EventStateManager.cpp
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -713,17 +713,19 @@ EventStateManager::PreHandleEvent(nsPres
     MOZ_FALLTHROUGH;
   case ePointerMove: {
     // on the Mac, GenerateDragGesture() may not return until the drag
     // has completed and so |aTargetFrame| may have been deleted (moving
     // a bookmark, for example).  If this is the case, however, we know
     // that ClearFrameRefs() has been called and it cleared out
     // |mCurrentTarget|. As a result, we should pass |mCurrentTarget|
     // into UpdateCursor().
-    GenerateDragGesture(aPresContext, mouseEvent);
+    if (!mInTouchDrag) {
+      GenerateDragGesture(aPresContext, mouseEvent);
+    }
     UpdateCursor(aPresContext, aEvent, mCurrentTarget, aStatus);
 
     UpdateLastRefPointOfMouseEvent(mouseEvent);
     if (sIsPointerLocked) {
       ResetPointerToWindowCenterWhilePointerLocked(mouseEvent);
     }
     UpdateLastPointerPosition(mouseEvent);