Bug 1444686 part 11. Remove nsIDOMDataTransfer from dragsession. r=mystor

MozReview-Commit-ID: CRmiSTSN8af
This commit is contained in:
Boris Zbarsky 2018-03-13 16:24:00 -04:00
parent 145e566cd8
commit e026425f6d
3 changed files with 21 additions and 19 deletions

View File

@ -27,6 +27,7 @@
#include "imgIContainer.h"
#include "imgIRequest.h"
#include "ImageRegion.h"
#include "nsQueryObject.h"
#include "nsRegion.h"
#include "nsXULPopupManager.h"
#include "nsMenuPopupFrame.h"
@ -201,7 +202,7 @@ nsBaseDragService::IsDataFlavorSupported(const char *aDataFlavor,
}
NS_IMETHODIMP
nsBaseDragService::GetDataTransferXPCOM(nsIDOMDataTransfer** aDataTransfer)
nsBaseDragService::GetDataTransferXPCOM(nsISupports** aDataTransfer)
{
*aDataTransfer = mDataTransfer;
NS_IF_ADDREF(*aDataTransfer);
@ -209,10 +210,11 @@ nsBaseDragService::GetDataTransferXPCOM(nsIDOMDataTransfer** aDataTransfer)
}
NS_IMETHODIMP
nsBaseDragService::SetDataTransferXPCOM(nsIDOMDataTransfer* aDataTransfer)
nsBaseDragService::SetDataTransferXPCOM(nsISupports* aDataTransfer)
{
// Cast is safe because nsIDOMDataTransfer is builtinclass.
mDataTransfer = static_cast<DataTransfer*>(aDataTransfer);
RefPtr<DataTransfer> dataTransfer = do_QueryObject(aDataTransfer);
NS_ENSURE_STATE(dataTransfer);
mDataTransfer = dataTransfer.forget();
return NS_OK;
}
@ -278,14 +280,13 @@ nsBaseDragService::InvokeDragSessionWithImage(nsIDOMNode* aDOMNode,
nsIDOMNode* aImage,
int32_t aImageX, int32_t aImageY,
nsIDOMDragEvent* aDragEvent,
nsIDOMDataTransfer* aDataTransfer)
DataTransfer* aDataTransfer)
{
NS_ENSURE_TRUE(aDragEvent, NS_ERROR_NULL_POINTER);
NS_ENSURE_TRUE(aDataTransfer, NS_ERROR_NULL_POINTER);
NS_ENSURE_TRUE(mSuppressLevel == 0, NS_ERROR_FAILURE);
// Cast is safe because nsIDOMDataTransfer is builtinclass.
mDataTransfer = static_cast<DataTransfer*>(aDataTransfer);
mDataTransfer = aDataTransfer;
mSelection = nullptr;
mHasImage = true;
mDragPopup = nullptr;
@ -316,14 +317,13 @@ nsBaseDragService::InvokeDragSessionWithSelection(nsISelection* aSelection,
nsIArray* aTransferableArray,
uint32_t aActionType,
nsIDOMDragEvent* aDragEvent,
nsIDOMDataTransfer* aDataTransfer)
DataTransfer* aDataTransfer)
{
NS_ENSURE_TRUE(aSelection, NS_ERROR_NULL_POINTER);
NS_ENSURE_TRUE(aDragEvent, NS_ERROR_NULL_POINTER);
NS_ENSURE_TRUE(mSuppressLevel == 0, NS_ERROR_FAILURE);
// Cast is safe because nsIDOMDataTransfer is builtinclass.
mDataTransfer = static_cast<DataTransfer*>(aDataTransfer);
mDataTransfer = aDataTransfer;
mSelection = aSelection;
mHasImage = true;
mDragPopup = nullptr;

View File

@ -12,7 +12,6 @@
interface nsIDOMNode;
interface nsIDOMDragEvent;
interface nsIDOMDataTransfer;
interface nsISelection;
%{C++
@ -21,11 +20,13 @@ interface nsISelection;
namespace mozilla {
namespace dom {
class ContentParent;
class DataTransfer;
} // namespace dom
} // namespace mozilla
%}
[ptr] native ContentParentPtr(mozilla::dom::ContentParent);
[ptr] native DataTransferPtr(mozilla::dom::DataTransfer);
native EventMessage(mozilla::EventMessage);
[scriptable, uuid(ebd6b3a2-af16-43af-a698-3091a087dd62), builtinclass]
@ -86,6 +87,7 @@ interface nsIDragService : nsISupports
* The aDragEvent must be supplied as the current screen coordinates of the
* event are needed to calculate the image location.
*/
[noscript]
void invokeDragSessionWithImage(in nsIDOMNode aDOMNode,
in AUTF8String aPrincipalURISpec,
in nsIArray aTransferableArray,
@ -95,7 +97,7 @@ interface nsIDragService : nsISupports
in long aImageX,
in long aImageY,
in nsIDOMDragEvent aDragEvent,
in nsIDOMDataTransfer aDataTransfer);
in DataTransferPtr aDataTransfer);
/**
* Start a modal drag session using the selection as the drag image.
@ -109,12 +111,12 @@ interface nsIDragService : nsISupports
in nsIArray aTransferableArray,
in unsigned long aActionType,
in nsIDOMDragEvent aDragEvent,
in nsIDOMDataTransfer aDataTransfer);
in DataTransferPtr aDataTransfer);
/**
* Returns the current Drag Session
* Returns the current Drag Session
*/
nsIDragSession getCurrentSession ( ) ;
nsIDragSession getCurrentSession();
/**
* Tells the Drag Service to start a drag session. This is called when

View File

@ -23,7 +23,6 @@ native nsSize (nsSize);
interface nsIDOMDocument;
interface nsIDOMNode;
interface nsIDOMDataTransfer;
[scriptable, builtinclass, uuid(25bce737-73f0-43c7-bc20-c71044a73c5a)]
interface nsIDragSession : nsISupports
@ -76,16 +75,17 @@ interface nsIDragSession : nsISupports
attribute AUTF8String triggeringPrincipalURISpec;
/**
* The data transfer object for the current drag.
* The data transfer object for the current drag. Should become a
* DataTransfer once bug 1444991 is fixed.
*/
[binaryname(DataTransferXPCOM)]
attribute nsIDOMDataTransfer dataTransfer;
attribute nsISupports dataTransfer;
[notxpcom, nostdcall] DataTransferPtr getDataTransfer();
[notxpcom, nostdcall] void setDataTransfer(in DataTransferPtr aDataTransfer);
/**
* Get data from a Drag&Drop. Can be called while the drag is in process
* or after the drop has completed.
* or after the drop has completed.
*
* @param aTransferable the transferable for the data to be put into
* @param aItemIndex which of multiple drag items, zero-based