Bug 1162050 - Remove use of eLegacyDragGesture from EventStateManager.cpp. draft
authorJimmy Wang <jimmyw22@gmail.com>
Fri, 27 May 2016 14:47:19 -0400
changeset 386638 70c97ba0c9c67d3220f1a02159b6703c351a014d
parent 386637 79697128c68bc5379f667acda0047cbd96d3d5b9
child 386639 807bbb0ab5ccd5081ffaeaf5443e5d3ef1073636
push id22751
push userjimmyw22@gmail.com
push dateTue, 12 Jul 2016 10:57:58 +0000
bugs1162050
milestone50.0a1
Bug 1162050 - Remove use of eLegacyDragGesture from EventStateManager.cpp. MozReview-Commit-ID: F4a52Yw5ri3
dom/events/EventStateManager.cpp
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -697,17 +697,17 @@ EventStateManager::PreHandleEvent(nsPres
     GenerateDragGesture(aPresContext, mouseEvent);
     UpdateCursor(aPresContext, aEvent, mCurrentTarget, aStatus);
     GenerateMouseEnterExit(mouseEvent);
     // Flush pending layout changes, so that later mouse move events
     // will go to the right nodes.
     FlushPendingEvents(aPresContext);
     break;
   }
-  case eLegacyDragGesture:
+  case eDragStart:
     if (Prefs::ClickHoldContextMenu()) {
       // an external drag gesture event came in, not generated internally
       // by Gecko. Make sure we get rid of the click-hold timer.
       KillClickHoldTimer();
     }
     break;
   case eDragOver:
     // eDrop is fired before eLegacyDragDrop so send the enter/exit events
@@ -1761,22 +1761,18 @@ EventStateManager::GenerateDragGesture(n
 
       sLastDragOverFrame = nullptr;
       nsCOMPtr<nsIWidget> widget = mCurrentTarget->GetNearestWidget();
 
       // get the widget from the target frame
       WidgetDragEvent startEvent(aEvent->IsTrusted(), eDragStart, widget);
       FillInEventFromGestureDown(&startEvent);
 
-      WidgetDragEvent gestureEvent(aEvent->IsTrusted(),
-                                   eLegacyDragGesture, widget);
-      FillInEventFromGestureDown(&gestureEvent);
-
-      startEvent.mDataTransfer = gestureEvent.mDataTransfer = dataTransfer;
-      startEvent.inputSource = gestureEvent.inputSource = aEvent->inputSource;
+      startEvent.mDataTransfer = dataTransfer;
+      startEvent.inputSource = aEvent->inputSource;
 
       // Dispatch to the DOM. By setting mCurrentTarget we are faking
       // out the ESM and telling it that the current target frame is
       // actually where the mouseDown occurred, otherwise it will use
       // the frame the mouse is currently over which may or may not be
       // the same. (Note: saari and I have decided that we don't have
       // to reset |mCurrentTarget| when we're through because no one
       // else is doing anything more with this event and it will get
@@ -1791,22 +1787,16 @@ EventStateManager::GenerateDragGesture(n
       // Dispatch both the dragstart and draggesture events to the DOM. For
       // elements in an editor, only fire the draggesture event so that the
       // editor code can handle it but content doesn't see a dragstart.
       nsEventStatus status = nsEventStatus_eIgnore;
       EventDispatcher::Dispatch(targetContent, aPresContext, &startEvent,
                                 nullptr, &status);
 
       WidgetDragEvent* event = &startEvent;
-      if (status != nsEventStatus_eConsumeNoDefault) {
-        status = nsEventStatus_eIgnore;
-        EventDispatcher::Dispatch(targetContent, aPresContext, &gestureEvent,
-                                  nullptr, &status);
-        event = &gestureEvent;
-      }
 
       nsCOMPtr<nsIObserverService> observerService =
         mozilla::services::GetObserverService();
       // Emit observer event to allow addons to modify the DataTransfer object.
       if (observerService) {
         observerService->NotifyObservers(dataTransfer,
                                          "on-datatransfer-available",
                                          nullptr);