deleted file mode 100644
--- 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,
-};
--- a/browser/base/content/browser-tabsintitlebar.js
+++ b/browser/base/content/browser-tabsintitlebar.js
@@ -1,26 +1,18 @@
/* -*- 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/. */
-// 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
// the inactive attribute after an event-loop spin.
//
// Because updating the appearance involves sampling the heights and margins
// of various elements, it's important that the layout be more or less
// settled before updating the titlebar. So instead of listening to
@@ -61,16 +53,31 @@ var TabsInTitlebar = {
this.update();
}
} else if (!(condition in this._disallowed)) {
this._disallowed[condition] = null;
this.update();
}
},
+ 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";
},
observe(subject, topic, data) {
if (topic == "nsPref:changed")
this._readPref();
},
@@ -129,17 +136,18 @@ var TabsInTitlebar = {
Services.prefs.getBoolPref(this._prefName));
},
update() {
if (!this._initialized || window.fullScreen) {
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") {
document.documentElement.setAttribute("chromemargin", "0,-1,-1,-1");
document.documentElement.removeAttribute("drawtitle");
} else {
document.documentElement.setAttribute("chromemargin", "0,2,2,2");
}
--- a/browser/base/content/browser.css
+++ b/browser/base/content/browser.css
@@ -272,17 +272,16 @@ window:not([chromehidden~="toolbar"]) #n
* using a tagname as the last item would be less so.
*/
#widget-overflow-list:empty + #widget-overflow-fixed-separator,
#widget-overflow:not([hasfixeditems]) #widget-overflow-fixed-separator {
display: none;
}
-%ifdef CAN_DRAW_IN_TITLEBAR
%ifdef MENUBAR_CAN_AUTOHIDE
#toolbar-menubar:not([autohide=true]) + #TabsToolbar > .titlebar-placeholder,
%endif
%ifndef MOZ_WIDGET_COCOA
#main-window:not([sizemode=normal]) .titlebar-placeholder[type="pre-tabs"],
%endif
#main-window:not([chromemargin]) > #titlebar,
#main-window[inFullscreen] > #titlebar,
@@ -342,18 +341,16 @@ toolbarpaletteitem {
}
#main-window[tabletmode] #titlebar-min,
#main-window[tabletmode] #titlebar-max {
display: none !important;
}
%endif
-%endif
-
#main-window[inFullscreen][inDOMFullscreen] #navigator-toolbox,
#main-window[inFullscreen][inDOMFullscreen] #fullscr-toggler,
#main-window[inFullscreen][inDOMFullscreen] #sidebar-box,
#main-window[inFullscreen][inDOMFullscreen] #sidebar-splitter,
#main-window[inFullscreen][inDOMFullscreen] #developer-toolbar,
#main-window[inFullscreen]:not([OSXLionFullscreen]) toolbar:not([fullscreentoolbar=true]),
#main-window[inFullscreen] #global-notificationbox,
#main-window[inFullscreen] #high-priority-global-notificationbox {
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -41,24 +41,22 @@
titlemodifier_normal=""
titlemodifier_privatebrowsing="&mainWindow.titlePrivateBrowsingSuffix;"
#else
title_privatebrowsing="&mainWindow.titlemodifier; &mainWindow.titlePrivateBrowsingSuffix;"
titlemodifier="&mainWindow.titlemodifier;"
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"
screenX="4" screenY="4"
fullscreenbutton="true"
sizemode="normal"
retargetdocumentfocus="urlbar"
persist="screenX screenY width height sizemode">
@@ -593,17 +591,16 @@
<menuseparator/>
<menuitem label="&syncSyncNowItem.label;"
accesskey="&syncSyncNowItem.accesskey;"
id="syncedTabsRefreshFilter"/>
</menupopup>
</popupset>
<box id="appMenu-viewCache" hidden="true"/>
-#ifdef CAN_DRAW_IN_TITLEBAR
<vbox id="titlebar">
<hbox id="titlebar-content">
<spacer id="titlebar-spacer" flex="1"/>
<hbox id="titlebar-buttonbox-container">
<hbox id="titlebar-buttonbox" class="titlebar-color">
<toolbarbutton class="titlebar-button" id="titlebar-min" oncommand="window.minimize();"/>
<toolbarbutton class="titlebar-button" id="titlebar-max" oncommand="onTitlebarMaxClick();"/>
<toolbarbutton class="titlebar-button" id="titlebar-close" command="cmd_closeWindow"/>
@@ -615,17 +612,16 @@
<hbox id="titlebar-secondary-buttonbox" dir="ltr">
<button class="accessibility-indicator" tooltiptext="&accessibilityIndicator.tooltip;" aria-live="polite"/>
<hbox class="private-browsing-indicator"/>
<hbox id="titlebar-fullscreen-button"/>
</hbox>
#endif
</hbox>
</vbox>
-#endif
<toolbox id="navigator-toolbox">
<!-- Menu -->
<toolbar type="menubar" id="toolbar-menubar"
class="chromeclass-menubar titlebar-color"
customizable="true"
mode="icons"
#ifdef MENUBAR_CAN_AUTOHIDE
@@ -635,37 +631,32 @@
#endif
context="toolbar-context-menu">
<toolbaritem id="menubar-items" align="center">
# The entire main menubar is placed into browser-menubar.inc, so that it can be
# shared with other top level windows in macWindow.inc.xul.
#include browser-menubar.inc
</toolbaritem>
-#ifdef CAN_DRAW_IN_TITLEBAR
#ifndef XP_MACOSX
<hbox class="titlebar-placeholder" type="caption-buttons" ordinal="1000"
skipintoolbarset="true"/>
#endif
-#endif
</toolbar>
<toolbar id="TabsToolbar"
class="titlebar-color"
fullscreentoolbar="true"
customizable="true"
mode="icons"
aria-label="&tabsToolbar.label;"
context="toolbar-context-menu"
collapsed="true">
-
-#ifdef CAN_DRAW_IN_TITLEBAR
<hbox class="titlebar-placeholder" type="pre-tabs"
skipintoolbarset="true"/>
-#endif
<tabs id="tabbrowser-tabs"
flex="1"
setfocus="false"
tooltip="tabbrowser-tab-tooltip"
stopwatchid="FX_TAB_CLICK_MS">
<tab class="tabbrowser-tab" selected="true" visuallyselected="true" fadein="true"/>
</tabs>
@@ -699,39 +690,35 @@
<menu id="alltabs_containersTab"
label="&newUserContext.label;">
<menupopup id="alltabs_containersMenuTab" />
</menu>
<menuseparator id="alltabs-popup-separator-2"/>
</menupopup>
</toolbarbutton>
-#ifdef CAN_DRAW_IN_TITLEBAR
<hbox class="titlebar-placeholder" type="post-tabs"
ordinal="1000"
skipintoolbarset="true"/>
-#endif
<button class="accessibility-indicator" tooltiptext="&accessibilityIndicator.tooltip;"
ordinal="1000"
aria-live="polite" skipintoolbarset="true"/>
<hbox class="private-browsing-indicator" skipintoolbarset="true"
ordinal="1000"/>
-#ifdef CAN_DRAW_IN_TITLEBAR
<hbox class="titlebar-placeholder" type="caption-buttons"
#ifndef XP_MACOSX
ordinal="1000"
#endif
skipintoolbarset="true"/>
#ifdef XP_MACOSX
<hbox class="titlebar-placeholder" type="fullscreen-button"
skipintoolbarset="true"/>
#endif
-#endif
</toolbar>
<toolbar id="nav-bar"
aria-label="&navbarCmd.label;"
fullscreentoolbar="true" mode="icons" customizable="true"
customizationtarget="nav-bar-customization-target"
overflowable="true"
overflowbutton="nav-bar-overflow-button"
--- a/browser/base/jar.mn
+++ b/browser/base/jar.mn
@@ -63,21 +63,17 @@ browser.jar:
content/browser/browser-media.js (content/browser-media.js)
content/browser/browser-pageActions.js (content/browser-pageActions.js)
content/browser/browser-places.js (content/browser-places.js)
content/browser/browser-plugins.js (content/browser-plugins.js)
content/browser/browser-safebrowsing.js (content/browser-safebrowsing.js)
content/browser/browser-sidebar.js (content/browser-sidebar.js)
content/browser/browser-sync.js (content/browser-sync.js)
* content/browser/browser-tabPreviews.xml (content/browser-tabPreviews.xml)
-#ifdef CAN_DRAW_IN_TITLEBAR
content/browser/browser-tabsintitlebar.js (content/browser-tabsintitlebar.js)
-#else
- content/browser/browser-tabsintitlebar.js (content/browser-tabsintitlebar-stub.js)
-#endif
content/browser/browser-thumbnails.js (content/browser-thumbnails.js)
content/browser/browser-trackingprotection.js (content/browser-trackingprotection.js)
content/browser/browser-webrender.js (content/browser-webrender.js)
content/browser/tab-content.js (content/tab-content.js)
content/browser/content.js (content/content.js)
content/browser/default-theme-icon.svg (content/default-theme-icon.svg)
content/browser/defaultthemes/1.header.jpg (content/defaultthemes/1.header.jpg)
content/browser/defaultthemes/1.icon.jpg (content/defaultthemes/1.icon.jpg)
--- a/browser/base/moz.build
+++ b/browser/base/moz.build
@@ -57,15 +57,12 @@ BROWSER_CHROME_MANIFESTS += [
DEFINES['MOZ_APP_VERSION'] = CONFIG['MOZ_APP_VERSION']
DEFINES['MOZ_APP_VERSION_DISPLAY'] = CONFIG['MOZ_APP_VERSION_DISPLAY']
DEFINES['APP_LICENSE_BLOCK'] = '%s/content/overrides/app-license.html' % SRCDIR
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'gtk3', 'cocoa'):
DEFINES['CONTEXT_COPY_IMAGE_CONTENTS'] = 1
-if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'cocoa', 'gtk3'):
- DEFINES['CAN_DRAW_IN_TITLEBAR'] = 1
-
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'gtk3'):
DEFINES['MENUBAR_CAN_AUTOHIDE'] = 1
JAR_MANIFESTS += ['jar.mn']
--- a/browser/components/customizableui/CustomizeMode.jsm
+++ b/browser/components/customizableui/CustomizeMode.jsm
@@ -97,24 +97,29 @@ function CustomizeMode(aWindow) {
this.document = aWindow.document;
this.browser = aWindow.gBrowser;
this.areas = new Set();
// There are two palettes - there's the palette that can be overlayed with
// toolbar items in browser.xul. This is invisible, and never seen by the
// user. Then there's the visible palette, which gets populated and displayed
// to the user when in customizing mode.
- this.visiblePalette = this.document.getElementById(kPaletteId);
- this.pongArena = this.document.getElementById("customization-pong-arena");
- if (AppConstants.CAN_DRAW_IN_TITLEBAR) {
+ this.visiblePalette = this.$(kPaletteId);
+ this.pongArena = this.$("customization-pong-arena");
+
+ if (this._canDrawInTitlebar()) {
this._updateTitlebarCheckbox();
this._updateDragSpaceCheckbox();
Services.prefs.addObserver(kDrawInTitlebarPref, this);
Services.prefs.addObserver(kExtraDragSpacePref, this);
+ } else {
+ this.$("customization-titlebar-visibility-checkbox").hidden = true;
+ this.$("customization-extra-drag-space-checkbox").hidden = true;
}
+
this.window.addEventListener("unload", this);
}
CustomizeMode.prototype = {
_changed: false,
_transitioning: false,
window: null,
document: null,
@@ -133,22 +138,26 @@ CustomizeMode.prototype = {
_skipSourceNodeCheck: null,
_mainViewContext: null,
get _handler() {
return this.window.CustomizationHandler;
},
uninit() {
- if (AppConstants.CAN_DRAW_IN_TITLEBAR) {
+ if (this._canDrawInTitlebar()) {
Services.prefs.removeObserver(kDrawInTitlebarPref, this);
Services.prefs.removeObserver(kExtraDragSpacePref, this);
}
},
+ $(id) {
+ return this.document.getElementById(id);
+ },
+
toggle() {
if (this._handler.isEnteringCustomizeMode || this._handler.isExitingCustomizeMode) {
this._wantToBeInCustomizeMode = !this._wantToBeInCustomizeMode;
return;
}
if (this._customizing) {
this.exit();
} else {
@@ -1572,80 +1581,70 @@ CustomizeMode.prototype = {
delete this.paletteDragHandler;
},
observe(aSubject, aTopic, aData) {
switch (aTopic) {
case "nsPref:changed":
this._updateResetButton();
this._updateUndoResetButton();
- if (AppConstants.CAN_DRAW_IN_TITLEBAR) {
+ if (this._canDrawInTitlebar()) {
this._updateTitlebarCheckbox();
this._updateDragSpaceCheckbox();
}
break;
}
},
+ _canDrawInTitlebar() {
+ return this.window.TabsInTitlebar.systemSupported;
+ },
+
_updateTitlebarCheckbox() {
- if (!AppConstants.CAN_DRAW_IN_TITLEBAR) {
- return;
- }
let drawInTitlebar = Services.prefs.getBoolPref(kDrawInTitlebarPref, true);
- let checkbox = this.document.getElementById("customization-titlebar-visibility-checkbox");
+ let checkbox = this.$("customization-titlebar-visibility-checkbox");
// Drawing in the titlebar means 'hiding' the titlebar.
// We use the attribute rather than a property because if we're not in
// customize mode the button is hidden and properties don't work.
if (drawInTitlebar) {
checkbox.removeAttribute("checked");
} else {
checkbox.setAttribute("checked", "true");
}
},
_updateDragSpaceCheckbox() {
- if (!AppConstants.CAN_DRAW_IN_TITLEBAR) {
- return;
- }
-
let extraDragSpace = Services.prefs.getBoolPref(kExtraDragSpacePref);
let drawInTitlebar = Services.prefs.getBoolPref(kDrawInTitlebarPref, true);
- let menuBar = this.document.getElementById("toolbar-menubar");
+ let menuBar = this.$("toolbar-menubar");
let menuBarEnabled = menuBar
&& AppConstants.platform != "macosx"
&& menuBar.getAttribute("autohide") != "true";
- let checkbox = this.document.getElementById("customization-extra-drag-space-checkbox");
+ let checkbox = this.$("customization-extra-drag-space-checkbox");
if (extraDragSpace) {
checkbox.setAttribute("checked", "true");
} else {
checkbox.removeAttribute("checked");
}
if (!drawInTitlebar || menuBarEnabled) {
checkbox.setAttribute("disabled", "true");
} else {
checkbox.removeAttribute("disabled");
}
},
toggleTitlebar(aShouldShowTitlebar) {
- if (!AppConstants.CAN_DRAW_IN_TITLEBAR) {
- return;
- }
// Drawing in the titlebar means not showing the titlebar, hence the negation:
Services.prefs.setBoolPref(kDrawInTitlebarPref, !aShouldShowTitlebar);
this._updateDragSpaceCheckbox();
},
toggleDragSpace(aShouldShowDragSpace) {
- if (!AppConstants.CAN_DRAW_IN_TITLEBAR) {
- return;
- }
-
Services.prefs.setBoolPref(kExtraDragSpacePref, aShouldShowDragSpace);
},
get _dwu() {
if (!this.__dwu) {
this.__dwu = this.window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
}
return this.__dwu;
--- a/browser/components/customizableui/content/customizeMode.inc.xul
+++ b/browser/components/customizableui/content/customizeMode.inc.xul
@@ -23,26 +23,24 @@
<description id="customization-panelDescription">&customizeMode.overflowList.description;</description>
</vbox>
<box class="panel-inner-arrowcontentfooter" hidden="true"/>
</box>
</vbox>
</vbox>
</box>
<hbox id="customization-footer">
-#ifdef CAN_DRAW_IN_TITLEBAR
<checkbox id="customization-titlebar-visibility-checkbox" class="customizationmode-checkbox"
label="&customizeMode.titlebar;"
#NB: because oncommand fires after click, by the time we've fired, the checkbox binding
# will already have switched the button's state, so this is correct:
oncommand="gCustomizeMode.toggleTitlebar(this.checked)"/>
<checkbox id="customization-extra-drag-space-checkbox" class="customizationmode-checkbox"
label="&customizeMode.extraDragSpace;"
oncommand="gCustomizeMode.toggleDragSpace(this.checked)"/>
-#endif
<button id="customization-toolbar-visibility-button" label="&customizeMode.toolbars2;" class="customizationmode-button" type="menu">
<menupopup id="customization-toolbar-menu" onpopupshowing="onViewToolbarsPopupShowing(event)"/>
</button>
<button id="customization-lwtheme-button" label="&customizeMode.lwthemes;" class="customizationmode-button" type="menu">
<panel type="arrow" id="customization-lwtheme-menu"
onpopupshowing="gCustomizeMode.onLWThemesMenuShowing(event);"
position="topcenter bottomleft"
flip="none"
--- a/browser/components/customizableui/moz.build
+++ b/browser/components/customizableui/moz.build
@@ -15,13 +15,10 @@ EXTRA_JS_MODULES += [
'CustomizableWidgets.jsm',
'CustomizeMode.jsm',
'DragPositionManager.jsm',
'PanelMultiView.jsm',
'ScrollbarSampler.jsm',
'SearchWidgetTracker.jsm',
]
-if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'cocoa'):
- DEFINES['CAN_DRAW_IN_TITLEBAR'] = 1
-
with Files('**'):
BUG_COMPONENT = ('Firefox', 'Toolbars and Customization')
--- a/browser/themes/osx/moz.build
+++ b/browser/themes/osx/moz.build
@@ -3,10 +3,8 @@
# 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/.
DIRS += ['communicator']
JAR_MANIFESTS += ['jar.mn']
-DEFINES['CAN_DRAW_IN_TITLEBAR'] = 1
-
--- a/browser/themes/shared/tabs.inc.css
+++ b/browser/themes/shared/tabs.inc.css
@@ -647,23 +647,21 @@
* Note that this doesn't perfectly solve the issue (dragged tabs
* may still resize very slightly) on some DPI settings with uneven
* scaling factors on Windows, because of bug 477157.
*/
.tabbrowser-tab::before {
margin-inline-start: -1px;
}
-%ifdef CAN_DRAW_IN_TITLEBAR
%ifdef MENUBAR_CAN_AUTOHIDE
:root[tabsintitlebar]:not([extradragspace]) #toolbar-menubar[autohide=true] + #TabsToolbar > #tabbrowser-tabs > .tabbrowser-tab::after,
%else
:root[tabsintitlebar]:not([extradragspace]) .tabbrowser-tab::after,
%endif
-%endif
/* Show full height tab separators on hover. */
.tabbrowser-tab:hover::after,
#tabbrowser-tabs:not([movingtab]) > .tabbrowser-tab[beforehovered]::after {
margin-top: var(--tabs-top-border-width);
margin-bottom: 0;
}
/* Show full height tab separators on selected tabs. */
--- a/browser/themes/windows/moz.build
+++ b/browser/themes/windows/moz.build
@@ -3,11 +3,10 @@
# 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/.
DIRS += ['communicator']
JAR_MANIFESTS += ['jar.mn']
-DEFINES['CAN_DRAW_IN_TITLEBAR'] = 1
DEFINES['MENUBAR_CAN_AUTOHIDE'] = 1
--- a/toolkit/modules/AppConstants.jsm
+++ b/toolkit/modules/AppConstants.jsm
@@ -245,23 +245,16 @@ this.AppConstants = Object.freeze({
MENUBAR_CAN_AUTOHIDE:
#ifdef MENUBAR_CAN_AUTOHIDE
true,
#else
false,
#endif
- CAN_DRAW_IN_TITLEBAR:
-#ifdef CAN_DRAW_IN_TITLEBAR
- true,
-#else
- false,
-#endif
-
MOZ_ANDROID_HISTORY:
#ifdef MOZ_ANDROID_HISTORY
true,
#else
false,
#endif
MOZ_TOOLKIT_SEARCH:
--- a/toolkit/modules/moz.build
+++ b/toolkit/modules/moz.build
@@ -255,19 +255,16 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'coco
EXTRA_JS_MODULES.third_party.jsesc += ['third_party/jsesc/jsesc.js']
EXTRA_JS_MODULES.sessionstore += [
'sessionstore/PrivacyLevel.jsm',
'sessionstore/SessionHistory.jsm',
'sessionstore/Utils.jsm',
]
-if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'cocoa', 'gtk3'):
- DEFINES['CAN_DRAW_IN_TITLEBAR'] = 1
-
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'gtk3'):
DEFINES['MENUBAR_CAN_AUTOHIDE'] = 1
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'gtk3', 'cocoa'):
DEFINES['HAVE_SHELL_SERVICE'] = 1
EXTRA_PP_JS_MODULES += [
'AppConstants.jsm',