From f95aa34e25dbd83ffe13ea56fc191894df4beb1e Mon Sep 17 00:00:00 2001 From: "gavin%gavinsharp.com" Date: Tue, 10 Oct 2006 13:09:02 +0000 Subject: [PATCH] Bug 191400: don't return DRAG_MOVE after html drag to browser window (return DRAG_NONE instead, to prevent dataloss), patch by Son Le , r=dean_tessman, sr=roc git-svn-id: svn://10.0.0.236/trunk@213404 18797224-902f-48f8-a5cc-f745e15eee43 --- .../widget/src/windows/nsNativeDragTarget.cpp | 26 +++++++------------ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/mozilla/widget/src/windows/nsNativeDragTarget.cpp b/mozilla/widget/src/windows/nsNativeDragTarget.cpp index 3a6f15d282f..21c7f3cfd5d 100644 --- a/mozilla/widget/src/windows/nsNativeDragTarget.cpp +++ b/mozilla/widget/src/windows/nsNativeDragTarget.cpp @@ -147,27 +147,21 @@ nsNativeDragTarget::GetGeckoDragAction(LPDATAOBJECT pData, DWORD grfKeyState, if (pData) canLink = (S_OK == ::OleQueryLinkFromData(pData) ? PR_TRUE : PR_FALSE); - // Default is move if we can, in fact drop here, - // and if the drop source supports a move operation. - if (mCanMove) { - *pdwEffect = DROPEFFECT_MOVE; + // Given the key modifiers figure out what state we are in for both + // the native system and Gecko. Default is link if we can, otherwise copy. + if (grfKeyState & MK_CONTROL) { + *aGeckoAction = nsIDragService::DRAGDROP_ACTION_COPY; + *pdwEffect = DROPEFFECT_COPY; + } else if (grfKeyState & MK_SHIFT && mCanMove) { *aGeckoAction = nsIDragService::DRAGDROP_ACTION_MOVE; + *pdwEffect = DROPEFFECT_MOVE; + } else if (canLink) { + *aGeckoAction = nsIDragService::DRAGDROP_ACTION_LINK; + *pdwEffect = DROPEFFECT_LINK; } else { *aGeckoAction = nsIDragService::DRAGDROP_ACTION_COPY; *pdwEffect = DROPEFFECT_COPY; } - - // Given the key modifiers figure out what state we are in for both - // the native system and Gecko - if (grfKeyState & MK_CONTROL) { - if (canLink && (grfKeyState & MK_SHIFT)) { - *aGeckoAction = nsIDragService::DRAGDROP_ACTION_LINK; - *pdwEffect = DROPEFFECT_LINK; - } else { - *aGeckoAction = nsIDragService::DRAGDROP_ACTION_COPY; - *pdwEffect = DROPEFFECT_COPY; - } - } }