mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-28 03:17:31 +09:00
Issue #2135 - Bug 1413102: Ensure Shadow DOM boundaries are dealt properly in event handling
* RE: BasicEvents.h - our WidgetEvent is not movable (yet), so the change that requires that wasn't included. * Parts of this use code that was introduced in bug 1427511. For now, they were replaced with their equivalents.
This commit is contained in:
parent
e286eb8adb
commit
24572438a0
9 changed files with 299 additions and 70 deletions
|
|
@ -113,7 +113,8 @@ public:
|
|||
WidgetEvent* aEvent,
|
||||
nsIDOMEvent* aDOMEvent,
|
||||
nsEventStatus aEventStatus,
|
||||
bool aIsInAnon)
|
||||
bool aIsInAnon,
|
||||
dom::EventTarget* aTargetInKnownToBeHandledScope)
|
||||
: EventChainVisitor(aPresContext, aEvent, aDOMEvent, aEventStatus)
|
||||
, mCanHandle(true)
|
||||
, mAutomaticChromeDispatch(true)
|
||||
|
|
@ -126,8 +127,11 @@ public:
|
|||
, mRootOfClosedTree(false)
|
||||
, mParentIsSlotInClosedTree(false)
|
||||
, mParentIsChromeHandler(false)
|
||||
, mRelatedTargetRetargetedInCurrentScope(false)
|
||||
, mParentTarget(nullptr)
|
||||
, mEventTargetAtParent(nullptr)
|
||||
, mRetargetedRelatedTarget(nullptr)
|
||||
, mTargetInKnownToBeHandledScope(aTargetInKnownToBeHandledScope)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -144,8 +148,12 @@ public:
|
|||
mRootOfClosedTree = false;
|
||||
mParentIsSlotInClosedTree = false;
|
||||
mParentIsChromeHandler = false;
|
||||
// Note, we don't clear mRelatedTargetRetargetedInCurrentScope explicitly,
|
||||
// since it is used during event path creation to indicate whether
|
||||
// relatedTarget may need to be retargeted.
|
||||
mParentTarget = nullptr;
|
||||
mEventTargetAtParent = nullptr;
|
||||
mRetargetedRelatedTarget = nullptr;
|
||||
}
|
||||
|
||||
dom::EventTarget* GetParentTarget()
|
||||
|
|
@ -161,6 +169,13 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void IgnoreCurrentTarget()
|
||||
{
|
||||
mCanHandle = false;
|
||||
SetParentTarget(nullptr, false);
|
||||
mEventTargetAtParent = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
|
@ -229,6 +244,13 @@ public:
|
|||
*/
|
||||
bool mParentIsChromeHandler;
|
||||
|
||||
/**
|
||||
* True if event's related target has been already retargeted in the
|
||||
* current 'scope'. This should be set to false initially and whenever
|
||||
* event path creation crosses shadow boundary.
|
||||
*/
|
||||
bool mRelatedTargetRetargetedInCurrentScope;
|
||||
|
||||
private:
|
||||
/**
|
||||
* Parent item in the event target chain.
|
||||
|
|
@ -241,6 +263,19 @@ public:
|
|||
* which should be used when the event is handled at mParentTarget.
|
||||
*/
|
||||
dom::EventTarget* mEventTargetAtParent;
|
||||
|
||||
/**
|
||||
* If the related target of the event needs to be retargeted, set this
|
||||
* to a new EventTarget.
|
||||
*/
|
||||
dom::EventTarget* mRetargetedRelatedTarget;
|
||||
|
||||
/**
|
||||
* Set to the value of mEvent->mTarget of the previous scope in case of
|
||||
* Shadow DOM or such, and if there is no anonymous content this just points
|
||||
* to the initial target.
|
||||
*/
|
||||
dom::EventTarget* mTargetInKnownToBeHandledScope;
|
||||
};
|
||||
|
||||
class EventChainPostVisitor : public mozilla::EventChainVisitor
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue