From 7443e3d6139ce4f0c822c23d1efb9c097419456d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 4 May 2024 03:54:08 +0200 Subject: Merging upstream version 125.0.3. Signed-off-by: Daniel Baumann --- widget/gtk/nsDragService.cpp | 17 ++++++++++------- widget/gtk/nsDragService.h | 3 ++- 2 files changed, 12 insertions(+), 8 deletions(-) (limited to 'widget') diff --git a/widget/gtk/nsDragService.cpp b/widget/gtk/nsDragService.cpp index df0965b5e4..0135f97a4e 100644 --- a/widget/gtk/nsDragService.cpp +++ b/widget/gtk/nsDragService.cpp @@ -712,7 +712,7 @@ nsDragService::GetNumDropItems(uint32_t* aNumItems) { *aNumItems = 0; return NS_OK; } - GetTargetDragData(gdkFlavor, dragFlavors); + GetTargetDragData(gdkFlavor, dragFlavors, false /* resetTargetData */); } // application/vnd.portal.filetransfer @@ -722,7 +722,7 @@ nsDragService::GetNumDropItems(uint32_t* aNumItems) { *aNumItems = 0; return NS_OK; } - GetTargetDragData(gdkFlavor, dragFlavors); + GetTargetDragData(gdkFlavor, dragFlavors, false /* resetTargetData */); } if (mTargetDragUris) { @@ -875,7 +875,7 @@ nsDragService::GetData(nsITransferable* aTransferable, uint32_t aItemIndex) { LOGDRAGSERVICE(" file not found, proceed with %s flavor\n", gPortalFile); gdkFlavor = gdk_atom_intern(gPortalFile, FALSE); if (gdkFlavor) { - GetTargetDragData(gdkFlavor, dragFlavors); + GetTargetDragData(gdkFlavor, dragFlavors, false /* resetTargetData */); GetReachableFileFromUriList(mTargetDragUris.get(), aItemIndex, file); } } @@ -886,7 +886,7 @@ nsDragService::GetData(nsITransferable* aTransferable, uint32_t aItemIndex) { gPortalFileTransfer); gdkFlavor = gdk_atom_intern(gPortalFileTransfer, FALSE); if (gdkFlavor) { - GetTargetDragData(gdkFlavor, dragFlavors); + GetTargetDragData(gdkFlavor, dragFlavors, false /* resetTargetData */); GetReachableFileFromUriList(mTargetDragUris.get(), aItemIndex, file); } } @@ -899,7 +899,7 @@ nsDragService::GetData(nsITransferable* aTransferable, uint32_t aItemIndex) { gdkFlavor = gdk_atom_intern(gTextUriListType, FALSE); if (gdkFlavor) { - GetTargetDragData(gdkFlavor, dragFlavors); + GetTargetDragData(gdkFlavor, dragFlavors, false /* resetTargetData */); GetReachableFileFromUriList(mTargetDragUris.get(), aItemIndex, file); } } @@ -1290,13 +1290,16 @@ bool nsDragService::IsTargetContextList(void) { // DispatchMotionEvents(). // Can lead to another round of drag_motion events. void nsDragService::GetTargetDragData(GdkAtom aFlavor, - nsTArray& aDropFlavors) { + nsTArray& aDropFlavors, + bool aResetTargetData) { LOGDRAGSERVICE("nsDragService::GetTargetDragData(%p) '%s'\n", mTargetDragContext.get(), GUniquePtr(gdk_atom_name(aFlavor)).get()); // reset our target data areas - TargetResetData(); + if (aResetTargetData) { + TargetResetData(); + } GUniquePtr name(gdk_atom_name(aFlavor)); nsDependentCString flavor(name.get()); diff --git a/widget/gtk/nsDragService.h b/widget/gtk/nsDragService.h index 8a45b7b8ed..bb5da26cd4 100644 --- a/widget/gtk/nsDragService.h +++ b/widget/gtk/nsDragService.h @@ -207,7 +207,8 @@ class nsDragService final : public nsBaseDragService, public nsIObserver { bool IsTargetContextList(void); // this will get the native data from the last target given a // specific flavor - void GetTargetDragData(GdkAtom aFlavor, nsTArray& aDropFlavors); + void GetTargetDragData(GdkAtom aFlavor, nsTArray& aDropFlavors, + bool aResetTargetData = true); // this will reset all of the target vars void TargetResetData(void); // Ensure our data cache belongs to aDragContext and clear the cache if -- cgit v1.2.3