Bug 191400: don't return DRAG_MOVE after html drag to browser window (return DRAG_NONE instead, to prevent dataloss), patch by Son Le <son.le0@gmail.com>, r=dean_tessman, sr=roc

git-svn-id: svn://10.0.0.236/trunk@213404 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
gavin%gavinsharp.com
2006-10-10 13:09:02 +00:00
parent ce623d2dab
commit f95aa34e25

View File

@@ -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;
}
}
}