Bug 1631229 - make popup hiding exiting fullscreen work correctly for tooltips, r=dao
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Mon, 27 Apr 2020 09:30:40 +0000
changeset 526184 f53992d7dd1b427cb361945d40da812516d072ba
parent 526183 4e6f16db2484d405fa34552d2221bfb3ec0b0aa2
child 526185 c60ed482b5f434500a005d307e51a9895a68d478
push id37353
push usershindli@mozilla.com
push dateMon, 27 Apr 2020 21:46:18 +0000
treeherdermozilla-central@2b0e2483e2ea [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdao
bugs1631229
milestone77.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1631229 - make popup hiding exiting fullscreen work correctly for tooltips, r=dao Differential Revision: https://phabricator.services.mozilla.com/D72461
browser/base/content/browser-fullScreenAndPointerLock.js
--- a/browser/base/content/browser-fullScreenAndPointerLock.js
+++ b/browser/base/content/browser-fullScreenAndPointerLock.js
@@ -591,29 +591,27 @@ var FullScreen = {
   _isPopupOpen: false,
   _isChromeCollapsed: false,
 
   _setPopupOpen(aEvent) {
     // Popups should only veto chrome collapsing if they were opened when the chrome was not collapsed.
     // Otherwise, they would not affect chrome and the user would expect the chrome to go away.
     // e.g. we wouldn't want the autoscroll icon firing this event, so when the user
     // toggles chrome when moving mouse to the top, it doesn't go away again.
+    let target = aEvent.originalTarget;
+    if (target.localName == "tooltip") {
+      return;
+    }
     if (
       aEvent.type == "popupshown" &&
       !FullScreen._isChromeCollapsed &&
-      aEvent.target.localName != "tooltip" &&
-      aEvent.target.localName != "window" &&
-      aEvent.target.getAttribute("nopreventnavboxhide") != "true"
+      target.getAttribute("nopreventnavboxhide") != "true"
     ) {
       FullScreen._isPopupOpen = true;
-    } else if (
-      aEvent.type == "popuphidden" &&
-      aEvent.target.localName != "tooltip" &&
-      aEvent.target.localName != "window"
-    ) {
+    } else if (aEvent.type == "popuphidden") {
       FullScreen._isPopupOpen = false;
       // Try again to hide toolbar when we close the popup.
       FullScreen.hideNavToolbox(true);
     }
   },
 
   // UrlbarController listener method
   onViewOpen() {