diff --git a/dom/events/EventStateManager.cpp b/dom/events/EventStateManager.cpp index 86b59568f4ff..451298024dac 100644 --- a/dom/events/EventStateManager.cpp +++ b/dom/events/EventStateManager.cpp @@ -1784,7 +1784,9 @@ EventStateManager::GenerateDragGesture(nsPresContext* aPresContext, // Set the current target to the content for the mouse down mCurrentTargetContent = targetContent; - // Dispatch the dragstart event to the DOM. + // 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); @@ -1801,7 +1803,7 @@ EventStateManager::GenerateDragGesture(nsPresContext* aPresContext, } // now that the dataTransfer has been updated in the dragstart and - // draggesture events, make it read only so that the data doesn't + // draggesture events, make it readonly so that the data doesn't // change during the drag. dataTransfer->SetReadOnly(); @@ -1814,6 +1816,10 @@ EventStateManager::GenerateDragGesture(nsPresContext* aPresContext, } } + // Note that frame event handling doesn't care about eLegacyDragGesture, + // which is just as well since we don't really know which frame to + // send it to + // Reset mCurretTargetContent to what it was mCurrentTargetContent = targetBeforeEvent; } @@ -1918,7 +1924,7 @@ EventStateManager::DoDefaultDragStart(nsPresContext* aPresContext, if (!dragService) return false; - // Default handling for the dragstart event. + // Default handling for the draggesture/dragstart event. // // First, check if a drag session already exists. This means that the drag // service was called directly within a draggesture handler. In this case, diff --git a/dom/events/EventStateManager.h b/dom/events/EventStateManager.h index 7ba1b7f1b735..8c1021f7f5be 100644 --- a/dom/events/EventStateManager.h +++ b/dom/events/EventStateManager.h @@ -855,11 +855,11 @@ protected: nsIContent** aTargetNode); /* - * Perform the default handling for the dragstart event and set up a + * Perform the default handling for the dragstart/draggesture event and set up a * drag for aDataTransfer if it contains any data. Returns true if a drag has * started. * - * aDragEvent - the dragstart event + * aDragEvent - the dragstart/draggesture event * aDataTransfer - the data transfer that holds the data to be dragged * aDragTarget - the target of the drag * aSelection - the selection to be dragged