b=497498 no need to explicitly dispatch NS_DRAGDROP_ENTER as this is handled during NS_DRAGDROP_OVER r=enndeakin
authorKarl Tomlinson <karlt+@karlt.net>
Tue, 17 Apr 2012 12:59:56 +1200
changeset 91811 5bd66f15b1f21a4769e632f2bf2a52df595a05e2
parent 91810 9e9d4bca6460dcdd5a668450922caf2a72012068
child 91812 0d31d468778b51a2f3795a607c58476393932f32
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersenndeakin
bugs497498
milestone14.0a1
b=497498 no need to explicitly dispatch NS_DRAGDROP_ENTER as this is handled during NS_DRAGDROP_OVER r=enndeakin
widget/gtk2/nsWindow.cpp
widget/gtk2/nsWindow.h
--- a/widget/gtk2/nsWindow.cpp
+++ b/widget/gtk2/nsWindow.cpp
@@ -3290,40 +3290,39 @@ nsWindow::ThemeChanged()
             win->ThemeChanged();
         }
 
         children = children->next;
     }
 }
 
 void
-nsWindow::CheckNeedDragLeaveEnter(nsWindow* aInnerMostWidget,
-                                  nsIDragService* aDragService,
-                                  GdkDragContext *aDragContext,
-                                  nscoord aX, nscoord aY)
+nsWindow::CheckNeedDragLeave(nsWindow* aInnerMostWidget,
+                             nsIDragService* aDragService,
+                             GdkDragContext *aDragContext,
+                             nscoord aX, nscoord aY)
 {
     // check to see if there was a drag motion window already in place
     if (sLastDragMotionWindow) {
-        // same as the last window so no need for dragenter and dragleave events
+        // same as the last window so no need for dragleave event
         if (sLastDragMotionWindow == aInnerMostWidget) {
             UpdateDragStatus(aDragContext, aDragService);
             return;
         }
 
         // send a dragleave event to the last window that got a motion event
         nsRefPtr<nsWindow> kungFuDeathGrip = sLastDragMotionWindow;
         sLastDragMotionWindow->OnDragLeave();
     }
 
     // Make sure that the drag service knows we're now dragging
     aDragService->StartDragSession();
 
-    // update our drag status and send a dragenter event to the window
+    // update our drag status
     UpdateDragStatus(aDragContext, aDragService);
-    aInnerMostWidget->OnDragEnter(aX, aY);
 
     // set the last window to the innerMostWidget
     sLastDragMotionWindow = aInnerMostWidget;
 }
 
 gboolean
 nsWindow::OnDragMotionEvent(GtkWidget *aWidget,
                             GdkDragContext *aDragContext,
@@ -3374,17 +3373,17 @@ nsWindow::OnDragMotionEvent(GtkWidget *a
 
     // clear any drag leave timer that might be pending so that it
     // doesn't get processed when we actually go out to get data.
     if (mDragLeaveTimer) {
         mDragLeaveTimer->Cancel();
         mDragLeaveTimer = nsnull;
     }
 
-    CheckNeedDragLeaveEnter(innerMostWidget, dragService, aDragContext, retx, rety);
+    CheckNeedDragLeave(innerMostWidget, dragService, aDragContext, retx, rety);
 
     // notify the drag service that we are starting a drag motion.
     dragSessionGTK->TargetStartDragMotion();
 
     dragService->FireDragEventAtSource(NS_DRAGDROP_DRAG);
 
     nsDragEvent event(true, NS_DRAGDROP_OVER, innerMostWidget);
 
@@ -3463,17 +3462,17 @@ nsWindow::OnDragDropEvent(GtkWidget *aWi
 
     // clear any drag leave timer that might be pending so that it
     // doesn't get processed when we actually go out to get data.
     if (mDragLeaveTimer) {
         mDragLeaveTimer->Cancel();
         mDragLeaveTimer = nsnull;
     }
 
-    CheckNeedDragLeaveEnter(innerMostWidget, dragService, aDragContext, retx, rety);
+    CheckNeedDragLeave(innerMostWidget, dragService, aDragContext, retx, rety);
 
     // http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#drag-and-drop-processing-model
     // (as at 27 December 2010) indicates that a "drop" event should only be
     // fired (at the current target element) if the current drag operation is
     // not none.  The current drag operation will only be set to a non-none
     // value during a "dragover" event.
     //
     // If the user has ended the drag before any dragover events have been
@@ -3598,32 +3597,16 @@ nsWindow::OnDragLeave(void)
                 // since we're done with it for now (until the user
                 // drags back into mozilla).
                 dragService->EndDragSession(false);
             }
         }
     }
 }
 
-void
-nsWindow::OnDragEnter(nscoord aX, nscoord aY)
-{
-    // XXX Do we want to pass this on only if the event's subwindow is null?
-
-    LOGDRAG(("nsWindow::OnDragEnter(%p)\n", (void*)this));
-
-    nsDragEvent event(true, NS_DRAGDROP_ENTER, this);
-
-    event.refPoint.x = aX;
-    event.refPoint.y = aY;
-
-    nsEventStatus status;
-    DispatchEvent(&event, status);
-}
-
 static void
 GetBrandName(nsXPIDLString& brandName)
 {
     nsCOMPtr<nsIStringBundleService> bundleService =
         do_GetService(NS_STRINGBUNDLE_CONTRACTID);
 
     nsCOMPtr<nsIStringBundle> bundle;
     if (bundleService)
--- a/widget/gtk2/nsWindow.h
+++ b/widget/gtk2/nsWindow.h
@@ -256,17 +256,16 @@ public:
                                                GdkDragContext  *aDragContext,
                                                gint             aX,
                                                gint             aY,
                                                GtkSelectionData*aSelectionData,
                                                guint            aInfo,
                                                guint            aTime,
                                                gpointer         aData);
     void               OnDragLeave(void);
-    void               OnDragEnter(nscoord aX, nscoord aY);
 
 private:
     void               NativeResize(PRInt32 aWidth,
                                     PRInt32 aHeight,
                                     bool    aRepaint);
 
     void               NativeResize(PRInt32 aX,
                                     PRInt32 aY,
@@ -292,20 +291,20 @@ public:
     void               SetPluginType(PluginType aPluginType);
 #ifdef MOZ_X11
     void               SetNonXEmbedPluginFocus(void);
     void               LoseNonXEmbedPluginFocus(void);
 #endif /* MOZ_X11 */
 
     void               ThemeChanged(void);
 
-    void CheckNeedDragLeaveEnter(nsWindow* aInnerMostWidget,
-                                 nsIDragService* aDragService,
-                                 GdkDragContext *aDragContext,
-                                 nscoord aX, nscoord aY);
+    void CheckNeedDragLeave(nsWindow* aInnerMostWidget,
+                            nsIDragService* aDragService,
+                            GdkDragContext *aDragContext,
+                            nscoord aX, nscoord aY);
 
 #ifdef MOZ_X11
     Window             mOldFocusWindow;
 #endif /* MOZ_X11 */
 
     static guint32     sLastButtonPressTime;
     static guint32     sLastButtonReleaseTime;