From 9550c68d7a2f369b0b8800359142abd620b4c74e Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Wed, 18 Mar 2020 21:15:10 +0100 Subject: [DOM] Make sure to exit fullscreen mode if popups are opened or focused. --- dom/base/nsFocusManager.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'dom/base') 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 -- cgit v1.2.3