mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-24 13:52:37 +00:00
Bug 1562796 - Pop BrowserParents of the previous window when raising/creating a window. r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D36581 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
3a5c721abb
commit
381b9f24a9
@ -682,6 +682,9 @@ nsFocusManager::WindowRaised(mozIDOMWindowProxy* aWindow) {
|
||||
// Events for child process windows will be sent when ParentActivated
|
||||
// is called.
|
||||
if (XRE_IsParentProcess()) {
|
||||
// Popping upon lowering was inhibited to accommodate ATOK,
|
||||
// so we need to do it here.
|
||||
BrowserParent::PopFocusAll();
|
||||
ActivateOrDeactivate(window, true);
|
||||
}
|
||||
|
||||
|
@ -2739,17 +2739,12 @@ void BrowserParent::PushFocus(BrowserParent* aBrowserParent) {
|
||||
}
|
||||
if (!aBrowserParent->GetBrowserBridgeParent()) {
|
||||
// top-level Web content
|
||||
if (!sFocusStack->IsEmpty()) {
|
||||
// When a new native window is created, we spin a nested event loop.
|
||||
// As a result, unlike when raising an existing window, we get
|
||||
// PushFocus for content in the new window before we get the PopFocus
|
||||
// for content in the old one. Hence, if the stack isn't empty when
|
||||
// pushing top-level Web content, first pop everything off the stack.
|
||||
LOGBROWSERFOCUS(
|
||||
("PushFocus for top-level Web content needs to clear the stack %p",
|
||||
aBrowserParent));
|
||||
PopFocus(sFocusStack->ElementAt(0));
|
||||
}
|
||||
// When a new native window is created, we spin a nested event loop.
|
||||
// As a result, unlike when raising an existing window, we get
|
||||
// PushFocus for content in the new window before we get the PopFocus
|
||||
// for content in the old one. Hence, if the stack isn't empty when
|
||||
// pushing top-level Web content, first pop everything off the stack.
|
||||
PopFocusAll();
|
||||
MOZ_ASSERT(sFocusStack->IsEmpty());
|
||||
} else {
|
||||
// out-of-process iframe
|
||||
@ -2812,6 +2807,16 @@ void BrowserParent::PopFocus(BrowserParent* aBrowserParent) {
|
||||
}
|
||||
}
|
||||
|
||||
/* static */
|
||||
void BrowserParent::PopFocusAll() {
|
||||
if (!sFocusStack->IsEmpty()) {
|
||||
LOGBROWSERFOCUS(("PopFocusAll pops items"));
|
||||
PopFocus(sFocusStack->ElementAt(0));
|
||||
} else {
|
||||
LOGBROWSERFOCUS(("PopFocusAll does nothing"));
|
||||
}
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult BrowserParent::RecvRequestIMEToCommitComposition(
|
||||
const bool& aCancel, bool* aIsCommitted, nsString* aCommittedString) {
|
||||
nsCOMPtr<nsIWidget> widget = GetWidget();
|
||||
|
@ -822,6 +822,10 @@ class BrowserParent final : public PBrowserParent,
|
||||
|
||||
static void PopFocus(BrowserParent* aBrowserParent);
|
||||
|
||||
public:
|
||||
static void PopFocusAll();
|
||||
|
||||
private:
|
||||
TabId mTabId;
|
||||
|
||||
RefPtr<ContentParent> mManager;
|
||||
|
Loading…
x
Reference in New Issue
Block a user