Bug 1618152 - Use BrowsingContext for activeness check in nsGenericHTMLFormElement::FocusState. r=farre

Differential Revision: https://phabricator.services.mozilla.com/D64340

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Henri Sivonen 2020-03-05 08:29:38 +00:00
parent 13b081a62d
commit e0301a2e76

View File

@ -1979,23 +1979,7 @@ nsGenericHTMLFormElement::FocusTristate nsGenericHTMLFormElement::FocusState() {
return eUnfocusable;
}
// If the window is not active, do not allow the focus to bring the
// window to the front. We update the focus controller, but do
// nothing else.
if (nsPIDOMWindowOuter* win = doc->GetWindow()) {
nsCOMPtr<nsPIDOMWindowOuter> rootWindow = win->GetPrivateRoot();
nsCOMPtr<nsIFocusManager> fm = do_GetService(FOCUSMANAGER_CONTRACTID);
if (fm && rootWindow) {
nsCOMPtr<mozIDOMWindowProxy> activeWindow;
fm->GetActiveWindow(getter_AddRefs(activeWindow));
if (activeWindow == rootWindow) {
return eActiveWindow;
}
}
}
return eInactiveWindow;
return IsInActiveTab(doc) ? eActiveWindow : eInactiveWindow;
}
Element* nsGenericHTMLFormElement::AddFormIdObserver() {