Bug 633160 - move away from the page by file drop is possible in spite of modal file picker dialog. r=neil
authorBrian R. Bondy <netzen@gmail.com>
Thu, 01 Sep 2011 09:48:48 -0400
changeset 76380 191f7bab5f5a01be721e48771a9e62ada0285d41
parent 76379 2c6b5f33faa63f98dc8a88b4a0ab0ce271315ed2
child 76381 59c205c5d0adc4c1b2e6b0bc800594c3989a52fc
push id1630
push userbbondy@mozilla.com
push dateThu, 01 Sep 2011 13:49:46 +0000
treeherdermozilla-inbound@191f7bab5f5a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersneil
bugs633160
milestone9.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 633160 - move away from the page by file drop is possible in spite of modal file picker dialog. r=neil
widget/src/windows/nsNativeDragTarget.cpp
--- a/widget/src/windows/nsNativeDragTarget.cpp
+++ b/widget/src/windows/nsNativeDragTarget.cpp
@@ -122,19 +122,26 @@ STDMETHODIMP_(ULONG) nsNativeDragTarget:
   delete this;
   return 0;
 }
 
 void
 nsNativeDragTarget::GetGeckoDragAction(DWORD grfKeyState, LPDWORD pdwEffect,
                                        PRUint32 * aGeckoAction)
 {
+  // If a window is disabled or a modal window is on top of 
+  // it (which implies it is disabled), then we should not allow dropping.
+  PRBool isEnabled;
+  if (NS_SUCCEEDED(mWindow->IsEnabled(&isEnabled)) && !isEnabled) {
+    *pdwEffect = DROPEFFECT_NONE;
+    *aGeckoAction = nsIDragService::DRAGDROP_ACTION_NONE;
+  }
   // Only a single effect should be specified outgoing for the parameter pdwEffect.
   // When Shift and Control are pressed, we should specify a LINK effect.
-  if (!mMovePreferred && (grfKeyState & MK_CONTROL) && 
+  else if (!mMovePreferred && (grfKeyState & MK_CONTROL) && 
       (grfKeyState & MK_SHIFT) && (mEffectsAllowed & DROPEFFECT_LINK)) {
     *pdwEffect = DROPEFFECT_LINK;
     *aGeckoAction = nsIDragService::DRAGDROP_ACTION_LINK;
   }
   // When Shift is pressed we should specify a MOVE effect.
   else if ((mEffectsAllowed & DROPEFFECT_MOVE) && 
            (mMovePreferred || (grfKeyState & MK_SHIFT))) {
     *pdwEffect = DROPEFFECT_MOVE;