diff --git a/browser/base/content/browser-tabsintitlebar-stub.js b/browser/base/content/browser-tabsintitlebar-stub.js deleted file mode 100644 index 7276cc4751b8..000000000000 --- a/browser/base/content/browser-tabsintitlebar-stub.js +++ /dev/null @@ -1,16 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -// This file is used as a stub object for platforms which -// don't have CAN_DRAW_IN_TITLEBAR defined. - -var TabsInTitlebar = { - init() {}, - whenWindowLayoutReady() {}, - uninit() {}, - allowedBy() {}, - update() {}, - enabled: false, -}; diff --git a/browser/base/content/browser-tabsintitlebar.js b/browser/base/content/browser-tabsintitlebar.js index 70eeeeaab51f..c1cb43de4213 100644 --- a/browser/base/content/browser-tabsintitlebar.js +++ b/browser/base/content/browser-tabsintitlebar.js @@ -3,19 +3,11 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -// Note: the file browser-tabsintitlebar-stub.js is used instead of -// this one on platforms which don't have CAN_DRAW_IN_TITLEBAR defined. - var TabsInTitlebar = { init() { this._readPref(); Services.prefs.addObserver(this._prefName, this); - // Always disable on unsupported GTK versions. - if (AppConstants.MOZ_WIDGET_TOOLKIT == "gtk3") { - this.allowedBy("gtk", window.matchMedia("(-moz-gtk-csd-available)")); - } - // We need to update the appearance of the titlebar when the menu changes // from the active to the inactive state. We can't, however, rely on // DOMMenuBarInactive, because the menu fires this event and then removes @@ -66,6 +58,21 @@ var TabsInTitlebar = { } }, + get systemSupported() { + let isSupported = false; + switch (AppConstants.MOZ_WIDGET_TOOLKIT) { + case "windows": + case "cocoa": + isSupported = true; + break; + case "gtk3": + isSupported = window.matchMedia("(-moz-gtk-csd-available)"); + break; + } + delete this.systemSupported; + return this.systemSupported = isSupported; + }, + get enabled() { return document.documentElement.getAttribute("tabsintitlebar") == "true"; }, @@ -134,7 +141,8 @@ var TabsInTitlebar = { return; } - let allowed = (Object.keys(this._disallowed)).length == 0; + let allowed = this.systemSupported && + (Object.keys(this._disallowed)).length == 0; if (allowed) { document.documentElement.setAttribute("tabsintitlebar", "true"); if (AppConstants.platform == "macosx") { diff --git a/browser/base/content/browser.css b/browser/base/content/browser.css index b08f72ad0d5e..de5229667b67 100644 --- a/browser/base/content/browser.css +++ b/browser/base/content/browser.css @@ -277,7 +277,6 @@ window:not([chromehidden~="toolbar"]) #nav-bar[nonemptyoverflow] > .overflow-but } -%ifdef CAN_DRAW_IN_TITLEBAR %ifdef MENUBAR_CAN_AUTOHIDE #toolbar-menubar:not([autohide=true]) + #TabsToolbar > .titlebar-placeholder, %endif @@ -347,8 +346,6 @@ toolbarpaletteitem { } %endif -%endif - #main-window[inFullscreen][inDOMFullscreen] #navigator-toolbox, #main-window[inFullscreen][inDOMFullscreen] #fullscr-toggler, #main-window[inFullscreen][inDOMFullscreen] #sidebar-box, diff --git a/browser/base/content/browser.xul b/browser/base/content/browser.xul index 5f069e03bb8f..d6d770d121fb 100644 --- a/browser/base/content/browser.xul +++ b/browser/base/content/browser.xul @@ -46,14 +46,12 @@ titlemodifier_normal="&mainWindow.titlemodifier;" titlemodifier_privatebrowsing="&mainWindow.titlemodifier; &mainWindow.titlePrivateBrowsingSuffix;" #endif -#ifdef CAN_DRAW_IN_TITLEBAR #ifdef XP_WIN chromemargin="0,2,2,2" #else chromemargin="0,-1,-1,-1" #endif tabsintitlebar="true" -#endif titlemenuseparator="&mainWindow.titlemodifiermenuseparator;" windowtype="navigator:browser" macanimationtype="document" @@ -598,7 +596,6 @@