diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-03-18 21:15:10 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-03-18 21:15:10 +0100 |
commit | 9550c68d7a2f369b0b8800359142abd620b4c74e (patch) | |
tree | d4470e0f34bd720e506b5ed2bbcea52bda25452a | |
parent | 54f44bb628df675f9359b588a0ef628b7c783f6a (diff) | |
download | uxp-9550c68d7a2f369b0b8800359142abd620b4c74e.tar.gz |
[DOM] Make sure to exit fullscreen mode if popups are opened or focused.
-rw-r--r-- | dom/base/nsFocusManager.cpp | 9 | ||||
-rw-r--r-- | embedding/components/windowwatcher/nsWindowWatcher.cpp | 6 |
2 files changed, 15 insertions, 0 deletions
diff --git a/dom/base/nsFocusManager.cpp b/dom/base/nsFocusManager.cpp index fb350fa120..01c1944bec 100644 --- a/dom/base/nsFocusManager.cpp +++ b/dom/base/nsFocusManager.cpp @@ -1261,6 +1261,15 @@ nsFocusManager::SetFocusInner(nsIContent* aNewContent, int32_t aFlags, isElementInActiveWindow = (mActiveWindow && newRootWindow == mActiveWindow); } + // Exit fullscreen if a website focuses another window + if (!isElementInActiveWindow && aFlags & FLAG_RAISE) { + if (nsIDocument* doc = mActiveWindow ? mActiveWindow->GetDoc() : nullptr) { + if (doc && doc->GetFullscreenElement()) { + nsIDocument::AsyncExitFullscreen(doc); + } + } + } + // Exit fullscreen if we're focusing a windowed plugin on a non-MacOSX // system. We don't control event dispatch to windowed plugins on non-MacOSX, // so we can't display the "Press ESC to leave fullscreen mode" warning on diff --git a/embedding/components/windowwatcher/nsWindowWatcher.cpp b/embedding/components/windowwatcher/nsWindowWatcher.cpp index 3732ea66de..fa23e285bf 100644 --- a/embedding/components/windowwatcher/nsWindowWatcher.cpp +++ b/embedding/components/windowwatcher/nsWindowWatcher.cpp @@ -1297,6 +1297,12 @@ nsWindowWatcher::OpenWindowInternal(mozIDOMWindowProxy* aParent, } } + // If a website opens a popup exit DOM fullscreen + if (windowIsNew && aCalledFromJS && !hasChromeParent && !isCallerChrome && + parentWindow) { + nsIDocument::AsyncExitFullscreen(parentWindow->GetDoc()); + } + if (aForceNoOpener && windowIsNew) { NS_RELEASE(*aResult); } |