mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 02:25:34 +00:00
Bug 1618117 - Use BrowsingContext for activeness check in FocusOuter. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D64299 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
a1b1d6ff88
commit
0ca10cda09
@ -4835,15 +4835,22 @@ void nsGlobalWindowOuter::FocusOuter(CallerType aCallerType) {
|
||||
RevisePopupAbuseLevel(PopupBlocker::GetPopupControlState()) <
|
||||
PopupBlocker::openBlocked);
|
||||
|
||||
nsCOMPtr<mozIDOMWindowProxy> activeDOMWindow;
|
||||
fm->GetActiveWindow(getter_AddRefs(activeDOMWindow));
|
||||
bool isActive = false;
|
||||
if (XRE_IsParentProcess()) {
|
||||
nsCOMPtr<nsPIDOMWindowOuter> activeWindow = fm->GetActiveWindow();
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> rootItem;
|
||||
mDocShell->GetInProcessRootTreeItem(getter_AddRefs(rootItem));
|
||||
nsCOMPtr<nsPIDOMWindowOuter> rootWin =
|
||||
rootItem ? rootItem->GetWindow() : nullptr;
|
||||
auto* activeWindow = nsPIDOMWindowOuter::From(activeDOMWindow);
|
||||
bool isActive = (rootWin == activeWindow);
|
||||
nsCOMPtr<nsIDocShellTreeItem> rootItem;
|
||||
mDocShell->GetInProcessRootTreeItem(getter_AddRefs(rootItem));
|
||||
nsCOMPtr<nsPIDOMWindowOuter> rootWin =
|
||||
rootItem ? rootItem->GetWindow() : nullptr;
|
||||
isActive = (rootWin == activeWindow);
|
||||
} else {
|
||||
BrowsingContext* activeBrowsingContext = fm->GetActiveBrowsingContext();
|
||||
BrowsingContext* bc = GetBrowsingContext();
|
||||
if (bc) {
|
||||
isActive = (activeBrowsingContext == bc->Top());
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIBaseWindow> treeOwnerAsWin = GetTreeOwnerWindow();
|
||||
if (treeOwnerAsWin && (canFocus || isActive)) {
|
||||
|
Loading…
Reference in New Issue
Block a user