summaryrefslogtreecommitdiffstats
path: root/dom/events
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-04-17 07:33:51 -0400
committerMatt A. Tobin <email@mattatobin.com>2020-04-17 07:33:51 -0400
commitd925bfcc6930594abfba44125c0d94b34f9c23f6 (patch)
tree41446ffc177c1fca512ced4c9cf8bca95d4ecb4d /dom/events
parent7e506bd98dab604062bfe12a44c096eb287721bf (diff)
downloadUXP-d925bfcc6930594abfba44125c0d94b34f9c23f6.tar
UXP-d925bfcc6930594abfba44125c0d94b34f9c23f6.tar.gz
UXP-d925bfcc6930594abfba44125c0d94b34f9c23f6.tar.lz
UXP-d925bfcc6930594abfba44125c0d94b34f9c23f6.tar.xz
UXP-d925bfcc6930594abfba44125c0d94b34f9c23f6.zip
Bug 1327185 - Refine EventStateManager::FireDragEnterOrExit
Tag #1375
Diffstat (limited to 'dom/events')
-rw-r--r--dom/events/EventStateManager.cpp33
1 files changed, 23 insertions, 10 deletions
diff --git a/dom/events/EventStateManager.cpp b/dom/events/EventStateManager.cpp
index e16d68c81..459521b83 100644
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -3484,6 +3484,12 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
// make sure to fire the enter and exit_synth events after the
// eDragExit event, otherwise we'll clean up too early
GenerateDragDropEnterExit(presContext, aEvent->AsDragEvent());
+ if (ContentChild* child = ContentChild::GetSingleton()) {
+ // SendUpdateDropEffect to prevent nsIDragService from waiting for
+ // response of forwarded dragexit event.
+ child->SendUpdateDropEffect(nsIDragService::DRAGDROP_ACTION_NONE,
+ nsIDragService::DRAGDROP_ACTION_NONE);
+ }
break;
case eBeforeKeyUp:
@@ -4446,6 +4452,19 @@ EventStateManager::GenerateDragDropEnterExit(nsPresContext* aPresContext,
FireDragEnterOrExit(sLastDragOverFrame->PresContext(),
aDragEvent, eDragExit,
targetContent, lastContent, sLastDragOverFrame);
+ nsIContent* target = sLastDragOverFrame ? sLastDragOverFrame.GetFrame()->GetContent() : nullptr;
+ if (IsRemoteTarget(target)) {
+ // Dragging something and moving from web content to chrome only
+ // fires dragexit and dragleave to xul:browser. We have to forward
+ // dragexit to sLastDragOverFrame when its content is a remote
+ // target. We don't forward dragleave since it's generated from
+ // dragexit.
+ WidgetDragEvent remoteEvent(aDragEvent->IsTrusted(), eDragExit,
+ aDragEvent->mWidget);
+ remoteEvent.AssignDragEventData(*aDragEvent, true);
+ nsEventStatus remoteStatus = nsEventStatus_eIgnore;
+ HandleCrossProcessEvent(&remoteEvent, &remoteStatus);
+ }
}
FireDragEnterOrExit(aPresContext, aDragEvent, eDragEnter,
@@ -4502,14 +4521,11 @@ EventStateManager::FireDragEnterOrExit(nsPresContext* aPresContext,
nsIContent* aTargetContent,
nsWeakFrame& aTargetFrame)
{
+ MOZ_ASSERT(aMessage == eDragLeave || aMessage == eDragExit ||
+ aMessage == eDragEnter);
nsEventStatus status = nsEventStatus_eIgnore;
WidgetDragEvent event(aDragEvent->IsTrusted(), aMessage, aDragEvent->mWidget);
- event.mRefPoint = aDragEvent->mRefPoint;
- event.mModifiers = aDragEvent->mModifiers;
- event.buttons = aDragEvent->buttons;
- event.relatedTarget = aRelatedTarget;
- event.inputSource = aDragEvent->inputSource;
-
+ event.AssignDragEventData(*aDragEvent, true);
mCurrentTargetContent = aTargetContent;
if (aTargetContent != aRelatedTarget) {
@@ -4527,10 +4543,7 @@ EventStateManager::FireDragEnterOrExit(nsPresContext* aPresContext,
// collect any changes to moz cursor settings stored in the event's
// data transfer.
- if (aMessage == eDragLeave || aMessage == eDragExit ||
- aMessage == eDragEnter) {
- UpdateDragDataTransfer(&event);
- }
+ UpdateDragDataTransfer(&event);
}
// Finally dispatch the event to the frame