diff options
author | Matt A. Tobin <email@mattatobin.com> | 2020-04-17 07:30:43 -0400 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2020-04-17 07:30:43 -0400 |
commit | 7e506bd98dab604062bfe12a44c096eb287721bf (patch) | |
tree | ebea23264b1fa0f9c23935b253c23bdc0b41c25d /dom/events/EventDispatcher.h | |
parent | 010f37f47b9c15935a6113cd82e43f0673122016 (diff) | |
download | UXP-7e506bd98dab604062bfe12a44c096eb287721bf.tar UXP-7e506bd98dab604062bfe12a44c096eb287721bf.tar.gz UXP-7e506bd98dab604062bfe12a44c096eb287721bf.tar.lz UXP-7e506bd98dab604062bfe12a44c096eb287721bf.tar.xz UXP-7e506bd98dab604062bfe12a44c096eb287721bf.zip |
Bug 1412775 - Implement Event.composedPath
Tag #1375
Diffstat (limited to 'dom/events/EventDispatcher.h')
-rw-r--r-- | dom/events/EventDispatcher.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/dom/events/EventDispatcher.h b/dom/events/EventDispatcher.h index 618c863d5..8a34e6bf7 100644 --- a/dom/events/EventDispatcher.h +++ b/dom/events/EventDispatcher.h @@ -124,6 +124,9 @@ public: , mWantsWillHandleEvent(false) , mMayHaveListenerManager(true) , mWantsPreHandleEvent(false) + , mRootOfClosedTree(false) + , mParentIsSlotInClosedTree(false) + , mParentIsChromeHandler(false) , mParentTarget(nullptr) , mEventTargetAtParent(nullptr) { @@ -139,10 +142,26 @@ public: mWantsWillHandleEvent = false; mMayHaveListenerManager = true; mWantsPreHandleEvent = false; + mRootOfClosedTree = false; + mParentIsSlotInClosedTree = false; + mParentIsChromeHandler = false; mParentTarget = nullptr; mEventTargetAtParent = nullptr; } + dom::EventTarget* GetParentTarget() + { + return mParentTarget; + } + + void SetParentTarget(dom::EventTarget* aParentTarget, bool aIsChromeHandler) + { + mParentTarget = aParentTarget; + if (mParentTarget) { + mParentIsChromeHandler = aIsChromeHandler; + } + } + /** * Member that must be set in GetEventTargetParent by event targets. If set to * false, indicates that this event target will not be handling the event and @@ -195,10 +214,29 @@ public: bool mWantsPreHandleEvent; /** + * True if the current target is either closed ShadowRoot or root of + * chrome only access tree (for example native anonymous content). + */ + bool mRootOfClosedTree; + + /** + * True if mParentTarget is HTMLSlotElement in a closed shadow tree and the + * current target is assigned to that slot. + */ + bool mParentIsSlotInClosedTree; + + /** + * True if mParentTarget is a chrome handler in the event path. + */ + bool mParentIsChromeHandler; + +private: + /** * Parent item in the event target chain. */ dom::EventTarget* mParentTarget; +public: /** * If the event needs to be retargeted, this is the event target, * which should be used when the event is handled at mParentTarget. @@ -281,6 +319,9 @@ public: WidgetEvent* aEvent, const nsAString& aEventType); + static void GetComposedPathFor(WidgetEvent* aEvent, + nsTArray<RefPtr<dom::EventTarget>>& aPath); + /** * Called at shutting down. */ |