Bug 610378, initialize effectAllowed properly for external drags, r=smaug,a=bsmedberg

This commit is contained in:
Neil Deakin 2010-11-24 13:31:24 -05:00
parent fd894fdd5f
commit 0cc69e24ed
3 changed files with 5 additions and 12 deletions

View File

@ -4945,12 +4945,9 @@ nsContentUtils::SetDataTransferInEvent(nsDragEvent* aDragEvent)
// A dataTransfer won't exist when a drag was started by some other
// means, for instance calling the drag service directly, or a drag
// from another application. In either case, a new dataTransfer should
// be created that reflects the data. Pass true to the constructor for
// the aIsExternal argument, so that only system access is allowed.
PRUint32 action = 0;
dragSession->GetDragAction(&action);
// be created that reflects the data.
initialDataTransfer =
new nsDOMDataTransfer(aDragEvent->message, action);
new nsDOMDataTransfer(aDragEvent->message);
NS_ENSURE_TRUE(initialDataTransfer, NS_ERROR_OUT_OF_MEMORY);
// now set it in the drag session so we don't need to create it again

View File

@ -84,9 +84,10 @@ nsDOMDataTransfer::nsDOMDataTransfer()
{
}
nsDOMDataTransfer::nsDOMDataTransfer(PRUint32 aEventType, PRUint32 aAction)
nsDOMDataTransfer::nsDOMDataTransfer(PRUint32 aEventType)
: mEventType(aEventType),
mDropEffect(nsIDragService::DRAGDROP_ACTION_NONE),
mEffectAllowed(nsIDragService::DRAGDROP_ACTION_UNINITIALIZED),
mCursorState(PR_FALSE),
mReadOnly(PR_TRUE),
mIsExternal(PR_TRUE),
@ -94,11 +95,6 @@ nsDOMDataTransfer::nsDOMDataTransfer(PRUint32 aEventType, PRUint32 aAction)
mDragImageX(0),
mDragImageY(0)
{
mEffectAllowed = aAction &
(nsIDragService::DRAGDROP_ACTION_COPY |
nsIDragService::DRAGDROP_ACTION_LINK |
nsIDragService::DRAGDROP_ACTION_MOVE);
CacheExternalFormats();
}

View File

@ -93,7 +93,7 @@ protected:
// that was started without using a data transfer, either an external drag,
// that is, a drag where the source is another application, or a drag
// started by calling the drag service directly.
nsDOMDataTransfer(PRUint32 aEventType, PRUint32 aAction);
nsDOMDataTransfer(PRUint32 aEventType);
// this constructor is used only by the Clone method to copy the fields as
// needed to a new data transfer.