diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp index 561ccc2b2bee..5ae56576462c 100644 --- a/content/base/src/nsContentUtils.cpp +++ b/content/base/src/nsContentUtils.cpp @@ -4874,11 +4874,8 @@ nsContentUtils::SetDataTransferInEvent(nsDragEvent* aDragEvent) } // each event should use a clone of the original dataTransfer. - nsCOMPtr initialDataTransferNS = - do_QueryInterface(initialDataTransfer); - NS_ENSURE_TRUE(initialDataTransferNS, NS_ERROR_FAILURE); - initialDataTransferNS->Clone(aDragEvent->message, aDragEvent->userCancelled, - getter_AddRefs(aDragEvent->dataTransfer)); + initialDataTransfer->Clone(aDragEvent->message, aDragEvent->userCancelled, + getter_AddRefs(aDragEvent->dataTransfer)); NS_ENSURE_TRUE(aDragEvent->dataTransfer, NS_ERROR_OUT_OF_MEMORY); // for the dragenter and dragover events, initialize the drop effect @@ -4886,14 +4883,10 @@ nsContentUtils::SetDataTransferInEvent(nsDragEvent* aDragEvent) // the event is fired based on the keyboard state. if (aDragEvent->message == NS_DRAGDROP_ENTER || aDragEvent->message == NS_DRAGDROP_OVER) { - nsCOMPtr newDataTransfer = - do_QueryInterface(aDragEvent->dataTransfer); - NS_ENSURE_TRUE(newDataTransfer, NS_ERROR_FAILURE); - PRUint32 action, effectAllowed; dragSession->GetDragAction(&action); - newDataTransfer->GetEffectAllowedInt(&effectAllowed); - newDataTransfer->SetDropEffectInt(FilterDropEffect(action, effectAllowed)); + aDragEvent->dataTransfer->GetEffectAllowedInt(&effectAllowed); + aDragEvent->dataTransfer->SetDropEffectInt(FilterDropEffect(action, effectAllowed)); } else if (aDragEvent->message == NS_DRAGDROP_DROP || aDragEvent->message == NS_DRAGDROP_DRAGDROP || @@ -4902,13 +4895,9 @@ nsContentUtils::SetDataTransferInEvent(nsDragEvent* aDragEvent) // last value that the dropEffect had. This will have been set in // nsEventStateManager::PostHandleEvent for the last dragenter or // dragover event. - nsCOMPtr newDataTransfer = - do_QueryInterface(aDragEvent->dataTransfer); - NS_ENSURE_TRUE(newDataTransfer, NS_ERROR_FAILURE); - PRUint32 dropEffect; - initialDataTransferNS->GetDropEffectInt(&dropEffect); - newDataTransfer->SetDropEffectInt(dropEffect); + initialDataTransfer->GetDropEffectInt(&dropEffect); + aDragEvent->dataTransfer->SetDropEffectInt(dropEffect); } return NS_OK; diff --git a/content/events/src/nsDOMDataTransfer.cpp b/content/events/src/nsDOMDataTransfer.cpp index f80274287325..f34d44a3a954 100644 --- a/content/events/src/nsDOMDataTransfer.cpp +++ b/content/events/src/nsDOMDataTransfer.cpp @@ -67,7 +67,6 @@ DOMCI_DATA(DataTransfer, nsDOMDataTransfer) NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMDataTransfer) NS_INTERFACE_MAP_ENTRY(nsIDOMDataTransfer) - NS_INTERFACE_MAP_ENTRY(nsIDOMNSDataTransfer) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMDataTransfer) NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(DataTransfer) NS_INTERFACE_MAP_END diff --git a/content/events/src/nsDOMDataTransfer.h b/content/events/src/nsDOMDataTransfer.h index 5b2c17c4440b..1b7b72d688fb 100644 --- a/content/events/src/nsDOMDataTransfer.h +++ b/content/events/src/nsDOMDataTransfer.h @@ -67,13 +67,11 @@ struct TransferItem { nsCOMPtr mData; }; -class nsDOMDataTransfer : public nsIDOMDataTransfer, - public nsIDOMNSDataTransfer +class nsDOMDataTransfer : public nsIDOMDataTransfer { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_NSIDOMDATATRANSFER - NS_DECL_NSIDOMNSDATATRANSFER NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsDOMDataTransfer, nsIDOMDataTransfer) diff --git a/content/events/src/nsEventStateManager.cpp b/content/events/src/nsEventStateManager.cpp index 8c8f6d5db040..7978989e7d20 100644 --- a/content/events/src/nsEventStateManager.cpp +++ b/content/events/src/nsEventStateManager.cpp @@ -3302,13 +3302,10 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext, // the initial dataTransfer is the one from the dragstart event that // was set on the dragSession when the drag began. - nsCOMPtr dataTransfer; + nsCOMPtr dataTransfer; nsCOMPtr initialDataTransfer; dragSession->GetDataTransfer(getter_AddRefs(initialDataTransfer)); - nsCOMPtr initialDataTransferNS = - do_QueryInterface(initialDataTransfer); - nsDragEvent *dragEvent = (nsDragEvent*)aEvent; // collect any changes to moz cursor settings stored in the event's @@ -3340,7 +3337,7 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext, // initialized (which is done in nsDOMDragEvent::GetDataTransfer), // so set it from the drag action. We'll still want to filter it // based on the effectAllowed below. - dataTransfer = initialDataTransferNS; + dataTransfer = initialDataTransfer; PRUint32 action; dragSession->GetDragAction(&action); @@ -3390,8 +3387,8 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext, // now set the drop effect in the initial dataTransfer. This ensures // that we can get the desired drop effect in the drop event. - if (initialDataTransferNS) - initialDataTransferNS->SetDropEffectInt(dropEffect); + if (initialDataTransfer) + initialDataTransfer->SetDropEffectInt(dropEffect); } break; @@ -4184,18 +4181,11 @@ nsEventStateManager::UpdateDragDataTransfer(nsDragEvent* dragEvent) // was set on the dragSession when the drag began. nsCOMPtr initialDataTransfer; dragSession->GetDataTransfer(getter_AddRefs(initialDataTransfer)); - - // grab the interface that has GetMozCursor. - nsCOMPtr initialDataTransferNS = - do_QueryInterface(initialDataTransfer); - nsCOMPtr eventTransferNS = - do_QueryInterface(dragEvent->dataTransfer); - - if (initialDataTransferNS && eventTransferNS) { + if (initialDataTransfer) { // retrieve the current moz cursor setting and save it. nsAutoString mozCursor; - eventTransferNS->GetMozCursor(mozCursor); - initialDataTransferNS->SetMozCursor(mozCursor); + dragEvent->dataTransfer->GetMozCursor(mozCursor); + initialDataTransfer->SetMozCursor(mozCursor); } } } diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index 4651087df700..7766cd95b7e6 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -4118,7 +4118,6 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_BEGIN(DataTransfer, nsIDOMDataTransfer) DOM_CLASSINFO_MAP_ENTRY(nsIDOMDataTransfer) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSDataTransfer) DOM_CLASSINFO_MAP_END DOM_CLASSINFO_MAP_BEGIN(NotifyPaintEvent, nsIDOMNotifyPaintEvent) diff --git a/dom/interfaces/events/nsIDOMDataTransfer.idl b/dom/interfaces/events/nsIDOMDataTransfer.idl index 9cdd3cf4c40d..8517e87bd81b 100644 --- a/dom/interfaces/events/nsIDOMDataTransfer.idl +++ b/dom/interfaces/events/nsIDOMDataTransfer.idl @@ -40,7 +40,7 @@ interface nsIVariant; interface nsIDOMFileList; -[scriptable, uuid(34042440-60A8-4992-AE5C-798E69148955)] +[scriptable, uuid(E929ACB6-435C-4CB8-9AD1-AE3B9353BCC5)] interface nsIDOMDataTransfer : nsISupports { /** @@ -160,28 +160,6 @@ interface nsIDOMDataTransfer : nsISupports * @throws NO_MODIFICATION_ALLOWED_ERR if the item cannot be modified */ void addElement(in nsIDOMElement element); -}; - -[scriptable, uuid(AE6DF4E2-FA37-4701-A33E-A5678F826EED)] -interface nsIDOMNSDataTransfer : nsISupports -{ - /* - * Integer version of dropEffect, set to one of the constants in nsIDragService. - */ - [noscript] attribute unsigned long dropEffectInt; - - /* - * Integer version of effectAllowed, set to one or a combination of the - * constants in nsIDragService. - */ - [noscript] attribute unsigned long effectAllowedInt; - - /** - * Creates a copy of the data transfer object, for the given event type and - * user cancelled flag. - */ - [noscript] nsIDOMDataTransfer clone(in PRUint32 aEventType, - in boolean aUserCancelled); /** * The number of items being dragged. @@ -272,4 +250,22 @@ interface nsIDOMNSDataTransfer : nsISupports * drags, or if the caller cannot access this node, this will be null. */ readonly attribute nsIDOMNode mozSourceNode; + + /* + * Integer version of dropEffect, set to one of the constants in nsIDragService. + */ + [noscript] attribute unsigned long dropEffectInt; + + /* + * Integer version of effectAllowed, set to one or a combination of the + * constants in nsIDragService. + */ + [noscript] attribute unsigned long effectAllowedInt; + + /** + * Creates a copy of the data transfer object, for the given event type and + * user cancelled flag. + */ + [noscript] nsIDOMDataTransfer clone(in PRUint32 aEventType, + in boolean aUserCancelled); }; diff --git a/editor/libeditor/base/nsEditorEventListener.cpp b/editor/libeditor/base/nsEditorEventListener.cpp index 652470090a03..6948a30dbfc3 100644 --- a/editor/libeditor/base/nsEditorEventListener.cpp +++ b/editor/libeditor/base/nsEditorEventListener.cpp @@ -831,14 +831,11 @@ nsEditorEventListener::CanDrop(nsIDOMDragEvent* aEvent) NS_ENSURE_TRUE(typeSupported, false); - nsCOMPtr dataTransferNS(do_QueryInterface(dataTransfer)); - NS_ENSURE_TRUE(dataTransferNS, false); - // If there is no source node, this is probably an external drag and the // drop is allowed. The later checks rely on checking if the drag target // is the same as the drag source. nsCOMPtr sourceNode; - dataTransferNS->GetMozSourceNode(getter_AddRefs(sourceNode)); + dataTransfer->GetMozSourceNode(getter_AddRefs(sourceNode)); if (!sourceNode) return true; diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm index d81d24e31ec4..0db6b1c94a55 100644 --- a/widget/cocoa/nsChildView.mm +++ b/widget/cocoa/nsChildView.mm @@ -4597,11 +4597,8 @@ NSEvent* gLastDragMouseDownEvent = nil; if (operation == NSDragOperationNone) { nsCOMPtr dataTransfer; dragService->GetDataTransfer(getter_AddRefs(dataTransfer)); - nsCOMPtr dataTransferNS = - do_QueryInterface(dataTransfer); - - if (dataTransferNS) - dataTransferNS->SetDropEffectInt(nsIDragService::DRAGDROP_ACTION_NONE); + if (dataTransfer) + dataTransfer->SetDropEffectInt(nsIDragService::DRAGDROP_ACTION_NONE); } mDragService->EndDragSession(true); diff --git a/widget/gtk2/nsDragService.cpp b/widget/gtk2/nsDragService.cpp index 343df8a76e9d..77e57d3afd71 100644 --- a/widget/gtk2/nsDragService.cpp +++ b/widget/gtk2/nsDragService.cpp @@ -1372,11 +1372,8 @@ nsDragService::SourceEndDragSession(GdkDragContext *aContext, } } - nsCOMPtr dataTransfer = - do_QueryInterface(mDataTransfer); - - if (dataTransfer) { - dataTransfer->SetDropEffectInt(dropEffect); + if (mDataTransfer) { + mDataTransfer->SetDropEffectInt(dropEffect); } // Inform the drag session that we're ending the drag. diff --git a/widget/windows/nsDragService.cpp b/widget/windows/nsDragService.cpp index 8c5df7eee926..b6b5b6228799 100644 --- a/widget/windows/nsDragService.cpp +++ b/widget/windows/nsDragService.cpp @@ -317,7 +317,7 @@ nsDragService::StartInvokingDragSession(IDataObject * aDataObj, HRESULT res = ::DoDragDrop(aDataObj, mNativeDragSrc, effects, &winDropRes); // In cases where the drop operation completed outside the application, update - // the source node's nsIDOMNSDataTransfer dropEffect value so it is up to date. + // the source node's nsIDOMDataTransfer dropEffect value so it is up to date. if (!mSentLocalDropEvent) { PRUint32 dropResult; // Order is important, since multiple flags can be returned. @@ -330,14 +330,11 @@ nsDragService::StartInvokingDragSession(IDataObject * aDataObj, else dropResult = DRAGDROP_ACTION_NONE; - nsCOMPtr dataTransfer = - do_QueryInterface(mDataTransfer); - - if (dataTransfer) { + if (mDataTransfer) { if (res == DRAGDROP_S_DROP) // Success - dataTransfer->SetDropEffectInt(dropResult); + mDataTransfer->SetDropEffectInt(dropResult); else - dataTransfer->SetDropEffectInt(DRAGDROP_ACTION_NONE); + mDataTransfer->SetDropEffectInt(DRAGDROP_ACTION_NONE); } } diff --git a/widget/windows/nsNativeDragSource.h b/widget/windows/nsNativeDragSource.h index 1d05e1de3493..cd069c3ef3f1 100644 --- a/widget/windows/nsNativeDragSource.h +++ b/widget/windows/nsNativeDragSource.h @@ -84,7 +84,7 @@ protected: ULONG m_cRef; // Data object, hold information about cursor state - nsCOMPtr mDataTransfer; + nsCOMPtr mDataTransfer; // Custom drag cursor HCURSOR m_hCursor;