summaryrefslogtreecommitdiff
path: root/dom
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-04-17 07:34:35 -0400
committerMatt A. Tobin <email@mattatobin.com>2020-04-17 07:34:35 -0400
commitf164962a3dc53f4823dfff6c77e7972c72d4c61f (patch)
treed318be62580b715d7fbf9ad100026746cc983e02 /dom
parentd925bfcc6930594abfba44125c0d94b34f9c23f6 (diff)
downloaduxp-f164962a3dc53f4823dfff6c77e7972c72d4c61f.tar.gz
Bug 1425441 - Move relatedTarget to WidgetEvent
Tag #1375
Diffstat (limited to 'dom')
-rw-r--r--dom/base/FragmentOrElement.cpp2
-rwxr-xr-xdom/events/Event.cpp27
-rw-r--r--dom/events/EventStateManager.cpp4
-rw-r--r--dom/events/MouseEvent.cpp5
4 files changed, 7 insertions, 31 deletions
diff --git a/dom/base/FragmentOrElement.cpp b/dom/base/FragmentOrElement.cpp
index 5b2fabd8d2..676665c094 100644
--- a/dom/base/FragmentOrElement.cpp
+++ b/dom/base/FragmentOrElement.cpp
@@ -825,7 +825,7 @@ nsIContent::GetEventTargetParent(EventChainPreVisitor& aVisitor)
((this == aVisitor.mEvent->mOriginalTarget &&
!ChromeOnlyAccess()) || isAnonForEvents || GetShadowRoot())) {
nsCOMPtr<nsIContent> relatedTarget =
- do_QueryInterface(aVisitor.mEvent->AsMouseEvent()->relatedTarget);
+ do_QueryInterface(aVisitor.mEvent->AsMouseEvent()->mRelatedTarget);
if (relatedTarget &&
relatedTarget->OwnerDoc() == OwnerDoc()) {
diff --git a/dom/events/Event.cpp b/dom/events/Event.cpp
index def298228d..aff65b40fa 100755
--- a/dom/events/Event.cpp
+++ b/dom/events/Event.cpp
@@ -158,18 +158,11 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Event)
tmp->mEvent->mTarget = nullptr;
tmp->mEvent->mCurrentTarget = nullptr;
tmp->mEvent->mOriginalTarget = nullptr;
+ tmp->mEvent->mRelatedTarget = nullptr;
switch (tmp->mEvent->mClass) {
- case eMouseEventClass:
- case eMouseScrollEventClass:
- case eWheelEventClass:
- case eSimpleGestureEventClass:
- case ePointerEventClass:
- tmp->mEvent->AsMouseEventBase()->relatedTarget = nullptr;
- break;
case eDragEventClass: {
WidgetDragEvent* dragEvent = tmp->mEvent->AsDragEvent();
dragEvent->mDataTransfer = nullptr;
- dragEvent->relatedTarget = nullptr;
break;
}
case eClipboardEventClass:
@@ -178,9 +171,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Event)
case eMutationEventClass:
tmp->mEvent->AsMutationEvent()->mRelatedNode = nullptr;
break;
- case eFocusEventClass:
- tmp->mEvent->AsFocusEvent()->mRelatedTarget = nullptr;
- break;
default:
break;
}
@@ -196,21 +186,12 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Event)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mEvent->mTarget)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mEvent->mCurrentTarget)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mEvent->mOriginalTarget)
+ NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mEvent->mRelatedTarget)
switch (tmp->mEvent->mClass) {
- case eMouseEventClass:
- case eMouseScrollEventClass:
- case eWheelEventClass:
- case eSimpleGestureEventClass:
- case ePointerEventClass:
- NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->relatedTarget");
- cb.NoteXPCOMChild(tmp->mEvent->AsMouseEventBase()->relatedTarget);
- break;
case eDragEventClass: {
WidgetDragEvent* dragEvent = tmp->mEvent->AsDragEvent();
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->mDataTransfer");
cb.NoteXPCOMChild(dragEvent->mDataTransfer);
- NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->relatedTarget");
- cb.NoteXPCOMChild(dragEvent->relatedTarget);
break;
}
case eClipboardEventClass:
@@ -221,10 +202,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Event)
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->mRelatedNode");
cb.NoteXPCOMChild(tmp->mEvent->AsMutationEvent()->mRelatedNode);
break;
- case eFocusEventClass:
- NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->mRelatedTarget");
- cb.NoteXPCOMChild(tmp->mEvent->AsFocusEvent()->mRelatedTarget);
- break;
default:
break;
}
diff --git a/dom/events/EventStateManager.cpp b/dom/events/EventStateManager.cpp
index 459521b830..cc3bd3f5aa 100644
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -3906,13 +3906,13 @@ CreateMouseOrPointerWidgetEvent(WidgetMouseEvent* aMouseEvent,
newPointerEvent->mWidth = sourcePointer->mWidth;
newPointerEvent->mHeight = sourcePointer->mHeight;
newPointerEvent->inputSource = sourcePointer->inputSource;
- newPointerEvent->relatedTarget = aRelatedContent;
+ newPointerEvent->mRelatedTarget = aRelatedContent;
aNewEvent = newPointerEvent.forget();
} else {
aNewEvent =
new WidgetMouseEvent(aMouseEvent->IsTrusted(), aMessage,
aMouseEvent->mWidget, WidgetMouseEvent::eReal);
- aNewEvent->relatedTarget = aRelatedContent;
+ aNewEvent->mRelatedTarget = aRelatedContent;
}
aNewEvent->mRefPoint = aMouseEvent->mRefPoint;
aNewEvent->mModifiers = aMouseEvent->mModifiers;
diff --git a/dom/events/MouseEvent.cpp b/dom/events/MouseEvent.cpp
index 5e540ac5be..415e626c55 100644
--- a/dom/events/MouseEvent.cpp
+++ b/dom/events/MouseEvent.cpp
@@ -79,7 +79,7 @@ MouseEvent::InitMouseEvent(const nsAString& aType,
case ePointerEventClass:
case eSimpleGestureEventClass: {
WidgetMouseEventBase* mouseEventBase = mEvent->AsMouseEventBase();
- mouseEventBase->relatedTarget = aRelatedTarget;
+ mouseEventBase->mRelatedTarget = aRelatedTarget;
mouseEventBase->button = aButton;
mouseEventBase->InitBasicModifiers(aCtrlKey, aAltKey, aShiftKey, aMetaKey);
mClientPoint.x = aClientX;
@@ -295,8 +295,7 @@ MouseEvent::GetRelatedTarget()
case eDragEventClass:
case ePointerEventClass:
case eSimpleGestureEventClass:
- relatedTarget =
- do_QueryInterface(mEvent->AsMouseEventBase()->relatedTarget);
+ relatedTarget = mEvent->AsMouseEventBase()->mRelatedTarget;
break;
default:
break;