Bug 1446904 - Do not generate drag gestures from synthesized/mouse events while in touch drag mode. r=kats,smaug draft
authorJohann Hofmann <jhofmann@mozilla.com>
Thu, 05 Apr 2018 19:02:14 +0200
changeset 778395 4d26c92c556068fc25dca5ad5d106187274b3e2a
parent 778394 62c2508f27a865dd0ac5ca3f0485cb20afafbbd0
push id105486
push userjhofmann@mozilla.com
push dateFri, 06 Apr 2018 09:35:26 +0000
reviewerskats, smaug
bugs1446904
milestone61.0a1
Bug 1446904 - Do not generate drag gestures from synthesized/mouse events while in touch drag mode. r=kats,smaug 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
@@ -717,17 +717,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);