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
Родитель 5c09ea7e66
Коммит 03caccfe9e
7 изменённых файлов: 23 добавлений и 30 удалений

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -7,7 +7,6 @@
#include "nsIArray.idl"
#include "nsISupports.idl"
#include "nsIDragSession.idl"
#include "nsIScriptableRegion.idl"
#include "nsIContentPolicy.idl"
webidl DragEvent;
@ -46,8 +45,6 @@ interface nsIDragService : nsISupports
* @param aPrincipalURISpec - the URI of the triggering principal of the
* drag, or an empty string if it's from browser chrome or OS
* @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 aContentPolicyType - the contentPolicyType that will be
* passed to the loadInfo when creating a new channel
@ -55,8 +52,7 @@ interface nsIDragService : nsISupports
*/
void invokeDragSession (in Node aDOMNode,
in AUTF8String aPrincipalURISpec,
in nsIArray aTransferables,
in nsIScriptableRegion aRegion,
in nsIArray aTransferables,
in unsigned long aActionType,
[optional] in nsContentPolicyType aContentPolicyType);
@ -91,7 +87,6 @@ interface nsIDragService : nsISupports
void invokeDragSessionWithImage(in Node aDOMNode,
in AUTF8String aPrincipalURISpec,
in nsIArray aTransferableArray,
in nsIScriptableRegion aRegion,
in unsigned long aActionType,
in Node aImage,
in long aImageX,