зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1419144 - Part 8: Move TryGetTabChildGlobalAsEventTarget into nsContentUtils, r=smaug
MozReview-Commit-ID: 8vi1mAzmQUU
This commit is contained in:
Родитель
38a7e13386
Коммит
e005db891d
|
@ -10999,3 +10999,20 @@ nsContentUtils::ContentIsLink(nsIContent* aContent)
|
|||
aContent->AttrValueIs(kNameSpaceID_XLink, nsGkAtoms::type,
|
||||
nsGkAtoms::simple, eCaseMatters));
|
||||
}
|
||||
|
||||
/* static */ already_AddRefed<EventTarget>
|
||||
nsContentUtils::TryGetTabChildGlobalAsEventTarget(nsISupports* aFrom)
|
||||
{
|
||||
nsCOMPtr<nsIFrameLoaderOwner> frameLoaderOwner = do_QueryInterface(aFrom);
|
||||
if (!frameLoaderOwner) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<nsFrameLoader> frameLoader = frameLoaderOwner->GetFrameLoader();
|
||||
if (!frameLoader) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsCOMPtr<EventTarget> target = frameLoader->GetTabChildGlobalAsEventTarget();
|
||||
return target.forget();
|
||||
}
|
||||
|
|
|
@ -3250,6 +3250,9 @@ public:
|
|||
|
||||
static bool ContentIsLink(nsIContent* aContent);
|
||||
|
||||
static already_AddRefed<mozilla::dom::EventTarget>
|
||||
TryGetTabChildGlobalAsEventTarget(nsISupports* aFrom);
|
||||
|
||||
private:
|
||||
static bool InitializeEventTable();
|
||||
|
||||
|
|
|
@ -528,24 +528,6 @@ CreateNativeGlobalForInner(JSContext* aCx,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static
|
||||
already_AddRefed<EventTarget>
|
||||
TryGetTabChildGlobalAsEventTarget(nsISupports *aFrom)
|
||||
{
|
||||
nsCOMPtr<nsIFrameLoaderOwner> frameLoaderOwner = do_QueryInterface(aFrom);
|
||||
if (!frameLoaderOwner) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<nsFrameLoader> frameLoader = frameLoaderOwner->GetFrameLoader();
|
||||
if (!frameLoader) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsCOMPtr<EventTarget> target = frameLoader->GetTabChildGlobalAsEventTarget();
|
||||
return target.forget();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
nsIURI*
|
||||
nsPIDOMWindow<T>::GetDocumentURI() const
|
||||
|
|
|
@ -1629,18 +1629,20 @@ nsGlobalWindowInner::UpdateParentTarget()
|
|||
|
||||
nsCOMPtr<Element> frameElement = GetOuterWindow()->GetFrameElementInternal();
|
||||
nsCOMPtr<EventTarget> eventTarget =
|
||||
TryGetTabChildGlobalAsEventTarget(frameElement);
|
||||
nsContentUtils::TryGetTabChildGlobalAsEventTarget(frameElement);
|
||||
|
||||
if (!eventTarget) {
|
||||
nsGlobalWindowOuter* topWin = GetScriptableTopInternal();
|
||||
if (topWin) {
|
||||
frameElement = topWin->AsOuter()->GetFrameElementInternal();
|
||||
eventTarget = TryGetTabChildGlobalAsEventTarget(frameElement);
|
||||
eventTarget =
|
||||
nsContentUtils::TryGetTabChildGlobalAsEventTarget(frameElement);
|
||||
}
|
||||
}
|
||||
|
||||
if (!eventTarget) {
|
||||
eventTarget = TryGetTabChildGlobalAsEventTarget(mChromeEventHandler);
|
||||
eventTarget =
|
||||
nsContentUtils::TryGetTabChildGlobalAsEventTarget(mChromeEventHandler);
|
||||
}
|
||||
|
||||
if (!eventTarget) {
|
||||
|
|
|
@ -2240,18 +2240,20 @@ nsGlobalWindowOuter::UpdateParentTarget()
|
|||
|
||||
nsCOMPtr<Element> frameElement = GetOuterWindow()->GetFrameElementInternal();
|
||||
nsCOMPtr<EventTarget> eventTarget =
|
||||
TryGetTabChildGlobalAsEventTarget(frameElement);
|
||||
nsContentUtils::TryGetTabChildGlobalAsEventTarget(frameElement);
|
||||
|
||||
if (!eventTarget) {
|
||||
nsGlobalWindowOuter* topWin = GetScriptableTopInternal();
|
||||
if (topWin) {
|
||||
frameElement = topWin->GetFrameElementInternal();
|
||||
eventTarget = TryGetTabChildGlobalAsEventTarget(frameElement);
|
||||
eventTarget =
|
||||
nsContentUtils::TryGetTabChildGlobalAsEventTarget(frameElement);
|
||||
}
|
||||
}
|
||||
|
||||
if (!eventTarget) {
|
||||
eventTarget = TryGetTabChildGlobalAsEventTarget(mChromeEventHandler);
|
||||
eventTarget =
|
||||
nsContentUtils::TryGetTabChildGlobalAsEventTarget(mChromeEventHandler);
|
||||
}
|
||||
|
||||
if (!eventTarget) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче