Commit 2a41dc97 authored by roc+%cs.cmu.edu's avatar roc+%cs.cmu.edu
Browse files

Bug 288406. Stop tracking potential drag gesture *before* we fire the drag DOM...

Bug 288406. Stop tracking potential drag gesture *before* we fire the drag DOM event, in case something happens that causes us to think a second drag gesture happens recursively. r+sr=bzbarsky,a=asa
parent 7ccb32aa
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -1478,6 +1478,11 @@ nsEventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
      KillClickHoldTimer();
#endif

      nsCOMPtr<nsIContent> targetContent = mGestureDownContent;
      // Stop tracking the drag gesture now. This should stop us from
      // reentering GenerateDragGesture inside DOM event processing.
      StopTrackingDragGesture();

      // get the widget from the target frame
      nsEventStatus status = nsEventStatus_eIgnore;
      nsMouseEvent event(NS_DRAGDROP_GESTURE, mCurrentTarget->GetWindow());
@@ -1519,11 +1524,12 @@ nsEventStateManager::GenerateDragGesture(nsPresContext* aPresContext,

      // Hold onto old target content through the event and reset after.
      nsCOMPtr<nsIContent> targetBeforeEvent = mCurrentTargetContent;

      // Set the current target to the content for the mouse down
      mCurrentTargetContent = mGestureDownContent;
      mCurrentTargetContent = targetContent;

      // Dispatch to DOM
      mGestureDownContent->HandleDOMEvent(aPresContext, &event, nsnull,
      targetContent->HandleDOMEvent(aPresContext, &event, nsnull,
                                    NS_EVENT_FLAG_INIT, &status);

      // Note that frame event handling doesn't care about NS_DRAGDROP_GESTURE,
@@ -1532,8 +1538,6 @@ nsEventStateManager::GenerateDragGesture(nsPresContext* aPresContext,

      // Reset mCurretTargetContent to what it was
      mCurrentTargetContent = targetBeforeEvent;

      StopTrackingDragGesture();
    }

    // Now flush all pending notifications, for better responsiveness