Bug 1445417 part 2. Stop using nsIDOMDragEvent in nsIDragService. r=mystor

MozReview-Commit-ID: 1BW1ki7sdKZ
This commit is contained in:
Boris Zbarsky 2018-03-16 22:25:25 -04:00
Родитель 20a96c6d59
Коммит ec11fcb519
2 изменённых файлов: 27 добавлений и 12 удалений

Просмотреть файл

@ -19,7 +19,6 @@
#include "nsIPresShell.h"
#include "nsViewManager.h"
#include "nsIDOMNode.h"
#include "nsIDOMDragEvent.h"
#include "nsISelection.h"
#include "nsISelectionPrivate.h"
#include "nsPresContext.h"
@ -34,8 +33,10 @@
#include "SVGImageContext.h"
#include "mozilla/MouseEvents.h"
#include "mozilla/Preferences.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/DataTransferItemList.h"
#include "mozilla/dom/DataTransfer.h"
#include "mozilla/dom/DragEvent.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/Unused.h"
#include "nsFrameLoader.h"
@ -279,7 +280,7 @@ nsBaseDragService::InvokeDragSessionWithImage(nsIDOMNode* aDOMNode,
uint32_t aActionType,
nsIDOMNode* aImage,
int32_t aImageX, int32_t aImageY,
nsIDOMDragEvent* aDragEvent,
nsIDOMEvent* aDragEvent,
DataTransfer* aDataTransfer)
{
NS_ENSURE_TRUE(aDragEvent, NS_ERROR_NULL_POINTER);
@ -293,9 +294,14 @@ nsBaseDragService::InvokeDragSessionWithImage(nsIDOMNode* aDOMNode,
mImage = aImage;
mImageOffset = CSSIntPoint(aImageX, aImageY);
aDragEvent->GetScreenX(&mScreenPosition.x);
aDragEvent->GetScreenY(&mScreenPosition.y);
aDragEvent->GetMozInputSource(&mInputSource);
DragEvent* dragEvent = aDragEvent->InternalDOMEvent()->AsDragEvent();
if (NS_WARN_IF(!dragEvent)) {
return NS_ERROR_INVALID_ARG;
}
mScreenPosition.x = dragEvent->ScreenX(CallerType::System);
mScreenPosition.y = dragEvent->ScreenY(CallerType::System);
mInputSource = dragEvent->MozInputSource();
nsresult rv = InvokeDragSession(aDOMNode, aPrincipalURISpec,
aTransferableArray,
@ -316,7 +322,7 @@ nsBaseDragService::InvokeDragSessionWithSelection(nsISelection* aSelection,
const nsACString& aPrincipalURISpec,
nsIArray* aTransferableArray,
uint32_t aActionType,
nsIDOMDragEvent* aDragEvent,
nsIDOMEvent* aDragEvent,
DataTransfer* aDataTransfer)
{
NS_ENSURE_TRUE(aSelection, NS_ERROR_NULL_POINTER);
@ -330,9 +336,14 @@ nsBaseDragService::InvokeDragSessionWithSelection(nsISelection* aSelection,
mImage = nullptr;
mImageOffset = CSSIntPoint();
aDragEvent->GetScreenX(&mScreenPosition.x);
aDragEvent->GetScreenY(&mScreenPosition.y);
aDragEvent->GetMozInputSource(&mInputSource);
DragEvent* dragEvent = aDragEvent->InternalDOMEvent()->AsDragEvent();
if (NS_WARN_IF(!dragEvent)) {
return NS_ERROR_INVALID_ARG;
}
mScreenPosition.x = dragEvent->ScreenX(CallerType::System);
mScreenPosition.y = dragEvent->ScreenY(CallerType::System);
mInputSource = dragEvent->MozInputSource();
// just get the focused node from the selection
// XXXndeakin this should actually be the deepest node that contains both

Просмотреть файл

@ -11,7 +11,7 @@
#include "nsIContentPolicy.idl"
interface nsIDOMNode;
interface nsIDOMDragEvent;
interface nsIDOMEvent;
interface nsISelection;
%{C++
@ -86,6 +86,8 @@ interface nsIDragService : nsISupports
*
* The aDragEvent must be supplied as the current screen coordinates of the
* event are needed to calculate the image location.
*
* aDragEvent should be a DragEvent. See bug 1444991.
*/
[noscript]
void invokeDragSessionWithImage(in nsIDOMNode aDOMNode,
@ -96,7 +98,7 @@ interface nsIDragService : nsISupports
in nsIDOMNode aImage,
in long aImageX,
in long aImageY,
in nsIDOMDragEvent aDragEvent,
in nsIDOMEvent aDragEvent,
in DataTransferPtr aDataTransfer);
/**
@ -105,12 +107,14 @@ interface nsIDragService : nsISupports
* event are needed to calculate the image location.
*
* Note: This method is deprecated for non-native code.
*
* aDragEvent should be a DragEvent. See bug 1444991.
*/
void invokeDragSessionWithSelection(in nsISelection aSelection,
in AUTF8String aPrincipalURISpec,
in nsIArray aTransferableArray,
in unsigned long aActionType,
in nsIDOMDragEvent aDragEvent,
in nsIDOMEvent aDragEvent,
in DataTransferPtr aDataTransfer);
/**