summaryrefslogtreecommitdiff
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
parentd925bfcc6930594abfba44125c0d94b34f9c23f6 (diff)
downloaduxp-f164962a3dc53f4823dfff6c77e7972c72d4c61f.tar.gz
Bug 1425441 - Move relatedTarget to WidgetEvent
Tag #1375
-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
-rw-r--r--widget/BasicEvents.h4
-rw-r--r--widget/ContentEvents.h4
-rw-r--r--widget/MouseEvents.h4
7 files changed, 11 insertions, 39 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;
diff --git a/widget/BasicEvents.h b/widget/BasicEvents.h
index 4e9e0e6cea..0ce0f587dd 100644
--- a/widget/BasicEvents.h
+++ b/widget/BasicEvents.h
@@ -423,6 +423,9 @@ public:
nsCOMPtr<dom::EventTarget> mCurrentTarget;
nsCOMPtr<dom::EventTarget> mOriginalTarget;
+ /// The possible related target
+ nsCOMPtr<dom::EventTarget> mRelatedTarget;
+
nsTArray<EventTargetChainItem>* mPath;
dom::EventTarget* GetDOMEventTarget() const;
@@ -442,6 +445,7 @@ public:
mTarget = aCopyTargets ? aEvent.mTarget : nullptr;
mCurrentTarget = aCopyTargets ? aEvent.mCurrentTarget : nullptr;
mOriginalTarget = aCopyTargets ? aEvent.mOriginalTarget : nullptr;
+ mRelatedTarget = aCopyTargets ? aEvent.mRelatedTarget : nullptr;
}
/**
diff --git a/widget/ContentEvents.h b/widget/ContentEvents.h
index be64b7bebd..09d4d9928c 100644
--- a/widget/ContentEvents.h
+++ b/widget/ContentEvents.h
@@ -212,9 +212,6 @@ public:
return result;
}
- /// The possible related target
- nsCOMPtr<dom::EventTarget> mRelatedTarget;
-
bool mFromRaise;
bool mIsRefocus;
@@ -222,7 +219,6 @@ public:
{
AssignUIEventData(aEvent, aCopyTargets);
- mRelatedTarget = aCopyTargets ? aEvent.mRelatedTarget : nullptr;
mFromRaise = aEvent.mFromRaise;
mIsRefocus = aEvent.mIsRefocus;
}
diff --git a/widget/MouseEvents.h b/widget/MouseEvents.h
index 442ac41e82..4b8ff44ce6 100644
--- a/widget/MouseEvents.h
+++ b/widget/MouseEvents.h
@@ -110,9 +110,6 @@ public:
MOZ_CRASH("WidgetMouseEventBase must not be most-subclass");
}
- /// The possible related target
- nsCOMPtr<nsISupports> relatedTarget;
-
enum buttonType
{
eLeftButton = 0,
@@ -162,7 +159,6 @@ public:
{
AssignInputEventData(aEvent, aCopyTargets);
- relatedTarget = aCopyTargets ? aEvent.relatedTarget : nullptr;
button = aEvent.button;
buttons = aEvent.buttons;
pressure = aEvent.pressure;