Bug 1276537 part 3 - Remove OS X detection code from full screen handling. r=dao
authorXidorn Quan <me@upsuper.org>
Wed, 13 May 2020 12:43:09 +0000
changeset 530223 d809b87c88683b2793564300b44ad29f6f1ad6f7
parent 530222 6d7fac080dca7f3ec0fdd86c9e84834a7e68a9e3
child 530224 ea043dfff6a65516a1925efec246491ba4ec5182
push id37420
push usernerli@mozilla.com
push dateFri, 15 May 2020 21:52:36 +0000
treeherdermozilla-central@f340bbb582d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdao
bugs1276537
milestone78.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 1276537 part 3 - Remove OS X detection code from full screen handling. r=dao Differential Revision: https://phabricator.services.mozilla.com/D74556
browser/base/content/browser-fullScreenAndPointerLock.js
--- a/browser/base/content/browser-fullScreenAndPointerLock.js
+++ b/browser/base/content/browser-fullScreenAndPointerLock.js
@@ -303,17 +303,17 @@ var FullScreen = {
     if (enterFS) {
       gNavToolbox.setAttribute("inFullscreen", true);
       document.documentElement.setAttribute("inFullscreen", true);
       let alwaysUsesNativeFullscreen =
         AppConstants.platform == "macosx" &&
         Services.prefs.getBoolPref("full-screen-api.macos-native-full-screen");
       if (
         (alwaysUsesNativeFullscreen || !document.fullscreenElement) &&
-        this.useLionFullScreen
+        AppConstants.platform == "macosx"
       ) {
         document.documentElement.setAttribute("OSXLionFullscreen", true);
       }
     } else {
       gNavToolbox.removeAttribute("inFullscreen");
       document.documentElement.removeAttribute("inFullscreen");
       document.documentElement.removeAttribute("OSXLionFullscreen");
     }
@@ -654,17 +654,17 @@ var FullScreen = {
     gNavToolbox.removeAttribute("fullscreenShouldAnimate");
     gNavToolbox.style.marginTop = "";
 
     if (!this._isChromeCollapsed) {
       return;
     }
 
     // Track whether mouse is near the toolbox
-    if (trackMouse && !this.useLionFullScreen) {
+    if (trackMouse && AppConstants.platform != "macosx") {
       let rect = gBrowser.tabpanels.getBoundingClientRect();
       this._mouseTargetRect = {
         top: rect.top + 50,
         bottom: rect.bottom,
         left: rect.left,
         right: rect.right,
       };
       MousePosTracker.addListener(this);
@@ -680,18 +680,18 @@ var FullScreen = {
     }
     if (!Services.prefs.getBoolPref("browser.fullscreen.autohide")) {
       return;
     }
     // a popup menu is open in chrome: don't collapse chrome
     if (this._isPopupOpen) {
       return;
     }
-    // On OS X Lion we don't want to hide toolbars.
-    if (this.useLionFullScreen) {
+    // On macOS we don't want to hide toolbars.
+    if (AppConstants.platform == "macosx") {
       return;
     }
 
     // a textbox in chrome is focused (location bar anyone?): don't collapse chrome
     // unless we are kiosk mode
     let focused = document.commandDispatcher.focusedElement;
     if (
       focused &&
@@ -774,21 +774,21 @@ var FullScreen = {
           el.removeAttribute("saved-context");
         }
         el.removeAttribute("inFullscreen");
       }
     }
 
     ToolbarIconColor.inferFromText("fullscreen", aEnterFS);
 
-    // For Lion fullscreen, all fullscreen controls are hidden, don't
-    // bother to touch them. If we don't stop here, the following code
-    // could cause the native fullscreen button be shown unexpectedly.
-    // See bug 1165570.
-    if (this.useLionFullScreen) {
+    // For macOS, we use native full screen, all full screen controls
+    // are hidden, don't bother to touch them. If we don't stop here,
+    // the following code could cause the native full screen button be
+    // shown unexpectedly. See bug 1165570.
+    if (AppConstants.platform == "macosx") {
       return;
     }
 
     var fullscreenctls = document.getElementById("window-controls");
     var navbar = document.getElementById("nav-bar");
     var ctlsOnTabbar = window.toolbar.visible;
     if (fullscreenctls.parentNode == navbar && ctlsOnTabbar) {
       fullscreenctls.removeAttribute("flex");
@@ -809,19 +809,8 @@ XPCOMUtils.defineLazyGetter(FullScreen, 
   return (
     Object.values(PermissionUI)
       .filter(value => value.prototype && value.prototype.notificationID)
       .map(value => value.prototype.notificationID)
       // Additionally include webRTC permission prompt which does not use PermissionUI
       .concat(["webRTC-shareDevices"])
   );
 });
-
-XPCOMUtils.defineLazyGetter(FullScreen, "useLionFullScreen", () => {
-  // We'll only use OS X Lion full screen if we're
-  // * on OS X
-  // * on Lion or higher (Darwin 11+)
-  // * have fullscreenbutton="true"
-  return (
-    AppConstants.isPlatformAndVersionAtLeast("macosx", 11) &&
-    document.documentElement.getAttribute("fullscreenbutton") == "true"
-  );
-});