Bug 1473029, remove the region arguments from InvokeDragSession and InvokeDragSessionWithImage, r=mstange

This commit is contained in:
Neil Deakin 2018-08-07 09:32:07 -04:00
parent 5c09ea7e66
commit 03caccfe9e
7 changed files with 23 additions and 30 deletions

View file

@ -2141,8 +2141,7 @@ EventStateManager::DoDefaultDragStart(nsPresContext* aPresContext,
else { else {
dragService->InvokeDragSessionWithImage(dragTarget, dragService->InvokeDragSessionWithImage(dragTarget,
aPrincipalURISpec, transArray, aPrincipalURISpec, transArray,
nullptr, action, action, dragImage,
dragImage,
imageX, imageY, event, imageX, imageY, event,
dataTransfer); dataTransfer);
} }

View file

@ -28,6 +28,7 @@
class nsFontMetrics; class nsFontMetrics;
class nsOverflowChecker; class nsOverflowChecker;
class nsTreeImageListener; class nsTreeImageListener;
class nsIScriptableRegion;
namespace mozilla { namespace mozilla {
namespace layout { namespace layout {

View file

@ -312,7 +312,6 @@ NS_IMETHODIMP
nsDragService::InvokeDragSession(nsINode *aDOMNode, nsDragService::InvokeDragSession(nsINode *aDOMNode,
const nsACString& aPrincipalURISpec, const nsACString& aPrincipalURISpec,
nsIArray * aArrayTransferables, nsIArray * aArrayTransferables,
nsIScriptableRegion * aRegion,
uint32_t aActionType, uint32_t aActionType,
nsContentPolicyType aContentPolicyType = nsContentPolicyType aContentPolicyType =
nsIContentPolicy::TYPE_OTHER) nsIContentPolicy::TYPE_OTHER)
@ -328,7 +327,7 @@ nsDragService::InvokeDragSession(nsINode *aDOMNode,
return nsBaseDragService::InvokeDragSession(aDOMNode, aPrincipalURISpec, return nsBaseDragService::InvokeDragSession(aDOMNode, aPrincipalURISpec,
aArrayTransferables, aArrayTransferables,
aRegion, aActionType, aActionType,
aContentPolicyType); aContentPolicyType);
} }
@ -351,9 +350,6 @@ nsDragService::InvokeDragSessionImpl(nsIArray* aArrayTransferables,
if (!sourceList) if (!sourceList)
return NS_OK; return NS_OK;
// stored temporarily until the drag-begin signal has been received
mSourceRegion = aRegion;
// save our action type // save our action type
GdkDragAction action = GDK_ACTION_DEFAULT; GdkDragAction action = GDK_ACTION_DEFAULT;
@ -396,8 +392,6 @@ nsDragService::InvokeDragSessionImpl(nsIArray* aArrayTransferables,
1, 1,
&event); &event);
mSourceRegion = nullptr;
nsresult rv; nsresult rv;
if (context) { if (context) {
StartDragSession(); StartDragSession();
@ -1723,7 +1717,7 @@ void nsDragService::SetDragIcon(GdkDragContext* aContext)
LayoutDeviceIntRect dragRect; LayoutDeviceIntRect dragRect;
nsPresContext* pc; nsPresContext* pc;
RefPtr<SourceSurface> surface; RefPtr<SourceSurface> surface;
DrawDrag(mSourceNode, mSourceRegion, mScreenPosition, DrawDrag(mSourceNode, mRegion, mScreenPosition,
&dragRect, &surface, &pc); &dragRect, &surface, &pc);
if (!pc) if (!pc)
return; return;

View file

@ -67,7 +67,6 @@ public:
NS_IMETHOD InvokeDragSession (nsINode *aDOMNode, NS_IMETHOD InvokeDragSession (nsINode *aDOMNode,
const nsACString& aPrincipalURISpec, const nsACString& aPrincipalURISpec,
nsIArray * anArrayTransferables, nsIArray * anArrayTransferables,
nsIScriptableRegion * aRegion,
uint32_t aActionType, uint32_t aActionType,
nsContentPolicyType aContentPolicyType) override; nsContentPolicyType aContentPolicyType) override;
NS_IMETHOD StartDragSession() override; NS_IMETHOD StartDragSession() override;
@ -209,8 +208,6 @@ private:
// our source data items // our source data items
nsCOMPtr<nsIArray> mSourceDataItems; nsCOMPtr<nsIArray> mSourceDataItems;
nsCOMPtr<nsIScriptableRegion> mSourceRegion;
// get a list of the sources in gtk's format // get a list of the sources in gtk's format
GtkTargetList *GetSourceList(void); GtkTargetList *GetSourceList(void);

View file

@ -63,7 +63,8 @@ nsBaseDragService::nsBaseDragService()
mDragAction(DRAGDROP_ACTION_NONE), mDragAction(DRAGDROP_ACTION_NONE),
mDragActionFromChildProcess(DRAGDROP_ACTION_UNINITIALIZED), mTargetSize(0,0), mDragActionFromChildProcess(DRAGDROP_ACTION_UNINITIALIZED), mTargetSize(0,0),
mContentPolicyType(nsIContentPolicy::TYPE_OTHER), mContentPolicyType(nsIContentPolicy::TYPE_OTHER),
mSuppressLevel(0), mInputSource(MouseEvent_Binding::MOZ_SOURCE_MOUSE) mSuppressLevel(0), mInputSource(MouseEvent_Binding::MOZ_SOURCE_MOUSE),
mRegion(nullptr)
{ {
} }
@ -236,7 +237,6 @@ NS_IMETHODIMP
nsBaseDragService::InvokeDragSession(nsINode *aDOMNode, nsBaseDragService::InvokeDragSession(nsINode *aDOMNode,
const nsACString& aPrincipalURISpec, const nsACString& aPrincipalURISpec,
nsIArray* aTransferableArray, nsIArray* aTransferableArray,
nsIScriptableRegion* aDragRgn,
uint32_t aActionType, uint32_t aActionType,
nsContentPolicyType aContentPolicyType = nsContentPolicyType aContentPolicyType =
nsIContentPolicy::TYPE_OTHER) nsIContentPolicy::TYPE_OTHER)
@ -260,7 +260,7 @@ nsBaseDragService::InvokeDragSession(nsINode *aDOMNode,
nsIPresShell::ClearMouseCapture(nullptr); nsIPresShell::ClearMouseCapture(nullptr);
nsresult rv = InvokeDragSessionImpl(aTransferableArray, nsresult rv = InvokeDragSessionImpl(aTransferableArray,
aDragRgn, aActionType); mRegion, aActionType);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
// Set mDoingDrag so that EndDragSession cleans up and sends the dragend event // Set mDoingDrag so that EndDragSession cleans up and sends the dragend event
@ -276,7 +276,6 @@ NS_IMETHODIMP
nsBaseDragService::InvokeDragSessionWithImage(nsINode* aDOMNode, nsBaseDragService::InvokeDragSessionWithImage(nsINode* aDOMNode,
const nsACString& aPrincipalURISpec, const nsACString& aPrincipalURISpec,
nsIArray* aTransferableArray, nsIArray* aTransferableArray,
nsIScriptableRegion* aRegion,
uint32_t aActionType, uint32_t aActionType,
nsINode* aImage, nsINode* aImage,
int32_t aImageX, int32_t aImageY, int32_t aImageX, int32_t aImageY,
@ -303,7 +302,7 @@ nsBaseDragService::InvokeDragSessionWithImage(nsINode* aDOMNode,
// to be set to the area encompassing the selected rows of the // to be set to the area encompassing the selected rows of the
// tree to ensure that the drag feedback gets clipped to those // tree to ensure that the drag feedback gets clipped to those
// rows. For other content, region should be null. // rows. For other content, region should be null.
nsCOMPtr<nsIScriptableRegion> region; mRegion = nullptr;
#ifdef MOZ_XUL #ifdef MOZ_XUL
if (aDOMNode && aDOMNode->IsContent() && !aImage) { if (aDOMNode && aDOMNode->IsContent() && !aImage) {
if (aDOMNode->NodeInfo()->Equals(nsGkAtoms::treechildren, if (aDOMNode->NodeInfo()->Equals(nsGkAtoms::treechildren,
@ -311,16 +310,18 @@ nsBaseDragService::InvokeDragSessionWithImage(nsINode* aDOMNode,
nsTreeBodyFrame* treeBody = nsTreeBodyFrame* treeBody =
do_QueryFrame(aDOMNode->AsContent()->GetPrimaryFrame()); do_QueryFrame(aDOMNode->AsContent()->GetPrimaryFrame());
if (treeBody) { if (treeBody) {
treeBody->GetSelectionRegion(getter_AddRefs(region)); treeBody->GetSelectionRegion(getter_AddRefs(mRegion));
} }
} }
} }
#endif #endif
return InvokeDragSession(aDOMNode, aPrincipalURISpec, nsresult rv = InvokeDragSession(aDOMNode, aPrincipalURISpec,
aTransferableArray, aTransferableArray,
region, aActionType, aActionType,
nsIContentPolicy::TYPE_INTERNAL_IMAGE); nsIContentPolicy::TYPE_INTERNAL_IMAGE);
mRegion = nullptr;
return rv;
} }
NS_IMETHODIMP NS_IMETHODIMP
@ -341,6 +342,7 @@ nsBaseDragService::InvokeDragSessionWithSelection(Selection* aSelection,
mDragPopup = nullptr; mDragPopup = nullptr;
mImage = nullptr; mImage = nullptr;
mImageOffset = CSSIntPoint(); mImageOffset = CSSIntPoint();
mRegion = nullptr;
mScreenPosition.x = aDragEvent->ScreenX(CallerType::System); mScreenPosition.x = aDragEvent->ScreenX(CallerType::System);
mScreenPosition.y = aDragEvent->ScreenY(CallerType::System); mScreenPosition.y = aDragEvent->ScreenY(CallerType::System);
@ -353,7 +355,7 @@ nsBaseDragService::InvokeDragSessionWithSelection(Selection* aSelection,
return InvokeDragSession(node, aPrincipalURISpec, return InvokeDragSession(node, aPrincipalURISpec,
aTransferableArray, aTransferableArray,
nullptr, aActionType, aActionType,
nsIContentPolicy::TYPE_OTHER); nsIContentPolicy::TYPE_OTHER);
} }
@ -471,6 +473,7 @@ nsBaseDragService::EndDragSession(bool aDoneDrag, uint32_t aKeyModifiers)
mScreenPosition = CSSIntPoint(); mScreenPosition = CSSIntPoint();
mEndDragPoint = LayoutDeviceIntPoint(0, 0); mEndDragPoint = LayoutDeviceIntPoint(0, 0);
mInputSource = MouseEvent_Binding::MOZ_SOURCE_MOUSE; mInputSource = MouseEvent_Binding::MOZ_SOURCE_MOUSE;
mRegion = nullptr;
return NS_OK; return NS_OK;
} }

View file

@ -8,6 +8,7 @@
#include "nsIDragService.h" #include "nsIDragService.h"
#include "nsIDragSession.h" #include "nsIDragSession.h"
#include "nsIScriptableRegion.h"
#include "nsITransferable.h" #include "nsITransferable.h"
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#include "nsRect.h" #include "nsRect.h"
@ -196,6 +197,9 @@ protected:
uint16_t mInputSource; uint16_t mInputSource;
nsTArray<RefPtr<mozilla::dom::ContentParent>> mChildProcesses; nsTArray<RefPtr<mozilla::dom::ContentParent>> mChildProcesses;
// Sub-region for tree-selections.
nsCOMPtr<nsIScriptableRegion> mRegion;
}; };
#endif // nsBaseDragService_h__ #endif // nsBaseDragService_h__

View file

@ -7,7 +7,6 @@
#include "nsIArray.idl" #include "nsIArray.idl"
#include "nsISupports.idl" #include "nsISupports.idl"
#include "nsIDragSession.idl" #include "nsIDragSession.idl"
#include "nsIScriptableRegion.idl"
#include "nsIContentPolicy.idl" #include "nsIContentPolicy.idl"
webidl DragEvent; webidl DragEvent;
@ -46,8 +45,6 @@ interface nsIDragService : nsISupports
* @param aPrincipalURISpec - the URI of the triggering principal of the * @param aPrincipalURISpec - the URI of the triggering principal of the
* drag, or an empty string if it's from browser chrome or OS * drag, or an empty string if it's from browser chrome or OS
* @param aTransferables - an array of transferables to be dragged * @param aTransferables - an array of transferables to be dragged
* @param aRegion - a region containing rectangles for cursor feedback,
* in window coordinates.
* @param aActionType - specified which of copy/move/link are allowed * @param aActionType - specified which of copy/move/link are allowed
* @param aContentPolicyType - the contentPolicyType that will be * @param aContentPolicyType - the contentPolicyType that will be
* passed to the loadInfo when creating a new channel * passed to the loadInfo when creating a new channel
@ -55,8 +52,7 @@ interface nsIDragService : nsISupports
*/ */
void invokeDragSession (in Node aDOMNode, void invokeDragSession (in Node aDOMNode,
in AUTF8String aPrincipalURISpec, in AUTF8String aPrincipalURISpec,
in nsIArray aTransferables, in nsIArray aTransferables,
in nsIScriptableRegion aRegion,
in unsigned long aActionType, in unsigned long aActionType,
[optional] in nsContentPolicyType aContentPolicyType); [optional] in nsContentPolicyType aContentPolicyType);
@ -91,7 +87,6 @@ interface nsIDragService : nsISupports
void invokeDragSessionWithImage(in Node aDOMNode, void invokeDragSessionWithImage(in Node aDOMNode,
in AUTF8String aPrincipalURISpec, in AUTF8String aPrincipalURISpec,
in nsIArray aTransferableArray, in nsIArray aTransferableArray,
in nsIScriptableRegion aRegion,
in unsigned long aActionType, in unsigned long aActionType,
in Node aImage, in Node aImage,
in long aImageX, in long aImageX,