зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1292063 - Part 3: Add mComposedInNativeAnonymousContent to determine which events can cross the boundary of native anonymous content. r=smaug
--HG-- extra : rebase_source : 6b3fcc52b2a099944cc1a0427a36624394fb3b2e
This commit is contained in:
Родитель
7b63299a94
Коммит
ce7f1ca7af
|
@ -864,7 +864,11 @@ nsIContent::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
|||
}
|
||||
}
|
||||
|
||||
if (parent) {
|
||||
if (!aVisitor.mEvent->mFlags.mComposedInNativeAnonymousContent &&
|
||||
IsRootOfNativeAnonymousSubtree() && OwnerDoc() &&
|
||||
OwnerDoc()->GetWindow()) {
|
||||
aVisitor.mParentTarget = OwnerDoc()->GetWindow()->GetParentTarget();
|
||||
} else if (parent) {
|
||||
aVisitor.mParentTarget = parent;
|
||||
} else {
|
||||
aVisitor.mParentTarget = GetComposedDoc();
|
||||
|
|
|
@ -575,6 +575,7 @@ Event::SetEventType(const nsAString& aEventTypeArg)
|
|||
mEvent->mSpecifiedEventTypeString = aEventTypeArg;
|
||||
mEvent->SetComposed(aEventTypeArg);
|
||||
}
|
||||
mEvent->SetDefaultComposedInNativeAnonymousContent();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -129,6 +129,9 @@ public:
|
|||
// If mComposed is true, the event fired by nodes in shadow DOM can cross the
|
||||
// boundary of shadow DOM and light DOM.
|
||||
bool mComposed : 1;
|
||||
// Similar to mComposed. Set it to true to allow events cross the boundary
|
||||
// between native non-anonymous content and native anonymouse content
|
||||
bool mComposedInNativeAnonymousContent : 1;
|
||||
|
||||
// If the event is being handled in target phase, returns true.
|
||||
inline bool InTargetPhase() const
|
||||
|
@ -343,6 +346,7 @@ protected:
|
|||
mFlags.mIsTrusted = aIsTrusted;
|
||||
SetDefaultCancelableAndBubbles();
|
||||
SetDefaultComposed();
|
||||
SetDefaultComposedInNativeAnonymousContent();
|
||||
}
|
||||
|
||||
WidgetEvent()
|
||||
|
@ -680,6 +684,20 @@ public:
|
|||
{
|
||||
mFlags.mComposed = aComposed;
|
||||
}
|
||||
|
||||
void SetDefaultComposedInNativeAnonymousContent()
|
||||
{
|
||||
// For compatibility concerns, we set mComposedInNativeAnonymousContent to
|
||||
// false for those events we want to stop propagation.
|
||||
//
|
||||
// nsVideoFrame may create anonymous image element which fires eLoad,
|
||||
// eLoadStart, eLoadEnd, eLoadError. We don't want these events cross
|
||||
// the boundary of NAC
|
||||
mFlags.mComposedInNativeAnonymousContent = mMessage != eLoad &&
|
||||
mMessage != eLoadStart &&
|
||||
mMessage != eLoadEnd &&
|
||||
mMessage != eLoadError;
|
||||
}
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
|
|
Загрузка…
Ссылка в новой задаче