From 0f826385704f4a5baa5d1dcbb1619c05ea25bffe Mon Sep 17 00:00:00 2001 From: Piro / YUKI Hiroshi Date: Wed, 20 Nov 2013 23:38:12 +0900 Subject: [PATCH] Draw navigation bar in the titlebar for Australis on Windows --- chrome.manifest | 1 + defaults/preferences/treestyletab.js | 4 +++ modules/constants.js | 1 + modules/window.js | 11 ++++-- skin/classic/treestyletab/Darwin-base.css | 17 +++------- skin/classic/treestyletab/WINNT-base.css | 41 +++++++++++++++++++++++ 6 files changed, 61 insertions(+), 14 deletions(-) create mode 100644 skin/classic/treestyletab/WINNT-base.css diff --git a/chrome.manifest b/chrome.manifest index 18f9d60b..7110799d 100644 --- a/chrome.manifest +++ b/chrome.manifest @@ -37,6 +37,7 @@ override chrome://treestyletab/skin/platform-base.css chrome://treestyletab/skin override chrome://treestyletab/skin/platform-base.css chrome://treestyletab/skin/Darwin-base.css os=Darwin appversion>=28.0a1 override chrome://treestyletab/skin/platform-base.css chrome://treestyletab/skin/Linux-base.css os=Linux override chrome://treestyletab/skin/platform-base.css chrome://treestyletab/skin/dummy.css os=WINNT +override chrome://treestyletab/skin/platform-base.css chrome://treestyletab/skin/WINNT-base.css os=WINNT appversion>=28.0a1 override chrome://treestyletab/skin/platform-styled.css chrome://treestyletab/skin/Darwin-styled.css os=Darwin override chrome://treestyletab/skin/platform-styled.css chrome://treestyletab/skin/dummy.css os=Linux override chrome://treestyletab/skin/platform-styled.css chrome://treestyletab/skin/WINNT-styled.css os=WINNT diff --git a/defaults/preferences/treestyletab.js b/defaults/preferences/treestyletab.js index 6afaa036..d5cf9015 100644 --- a/defaults/preferences/treestyletab.js +++ b/defaults/preferences/treestyletab.js @@ -94,6 +94,10 @@ pref("extensions.treestyletab.platform.Linux.tabbar.style", "plain"); * Aero Glass will be applied for the vertical tab bar, if you set this to "true". */ pref("extensions.treestyletab.tabbar.style.aero", false); +/** + * Allow/disallow to show toolbox in the titlebar, for Australis. + */ +pref("extensions.treestyletab.toolbox.allowShowInTitlebar", true); /** * AutoHide style for the vertical tab bar. diff --git a/modules/constants.js b/modules/constants.js index 77208845..7adee602 100644 --- a/modules/constants.js +++ b/modules/constants.js @@ -59,6 +59,7 @@ const TreeStyleTabConstants = Object.freeze({ kCOLLAPSING_PHASE_TO_BE_COLLAPSED : 'collapse', kCOLLAPSING_PHASE_TO_BE_EXPANDED : 'expand', kALLOW_COLLAPSE : 'treestyletab-allow-subtree-collapse', + kALLOW_TOOLBOX_IN_TITLEBAR : 'treestyletab-allow-toolbox-in-titlebar', kALLOW_STACK : 'treestyletab-stack-collapsed-tabs', kREMOVED : 'treestyletab-removed', diff --git a/modules/window.js b/modules/window.js index 0d16044d..afbe5420 100644 --- a/modules/window.js +++ b/modules/window.js @@ -393,6 +393,7 @@ TreeStyleTabWindow.prototype = { this.onPrefChange('extensions.treestyletab.tabbar.autoHide.mode'); this.onPrefChange('extensions.treestyletab.autoCollapseExpandSubtreeOnSelect.whileFocusMovingByShortcut'); + this.onPrefChange('extensions.treestyletab.toolbox.allowShowInTitlebar'); this.initialized = true; }, @@ -1039,8 +1040,10 @@ TreeStyleTabWindow.prototype = { utils.clearTreePref('tabsOnTop.originalState'); } } - if (TabsInTitlebar) - TabsInTitlebar.allowedBy('TreeStyleTab', isTopTabbar); + if (TabsInTitlebar) { + let allowed = isTopTabbar || utils.getTreePref('toolbox.allowShowInTitlebar'); + TabsInTitlebar.allowedBy('TreeStyleTab', allowed); + } } finally { this.tabsOnTopChangingByTST = false; @@ -1685,6 +1688,10 @@ TreeStyleTabWindow.prototype = { this.themeManager.set(prefs.getPref('extensions.treestyletab.tabbar.style'), this.position); break; + case 'extensions.treestyletab.toolbox.allowShowInTitlebar': + this.setTabbrowserAttribute(this.kALLOW_TOOLBOX_IN_TITLEBAR, value); + break; + case 'browser.ctrlTab.previews': this.autoHideWindow.updateKeyListeners(this.window); case 'extensions.treestyletab.autoCollapseExpandSubtreeOnSelect.whileFocusMovingByShortcut': diff --git a/skin/classic/treestyletab/Darwin-base.css b/skin/classic/treestyletab/Darwin-base.css index a00b1f33..bddb4d04 100644 --- a/skin/classic/treestyletab/Darwin-base.css +++ b/skin/classic/treestyletab/Darwin-base.css @@ -2,7 +2,6 @@ /** * Cancel "tabs on top" appearance on Australis. - * This is possibly moved to /skin/base.css for all platforms. */ :root:not([treestyletab-tabbar-position="top"]) #nav-bar:not(:-moz-lwtheme), @@ -13,16 +12,10 @@ border-left: none; border-right: none; box-shadow: none; -} - -/** - * With Australis, the "back" button in the navigation toolbar is - * unexpectedly overwrapped on the border of the expanded titlebar. - * This negative margin solves the overwrapping. - */ -:root:not([treestyletab-tabbar-position="top"]) - #nav-bar:not(:-moz-lwtheme), -:root:not([treestyletab-tabbar-position="top"]) - #nav-bar:not(:-moz-lwtheme):-moz-window-inactive { + /** + * With Australis, the "back" button in the navigation toolbar is + * unexpectedly overwrapped on the border of the expanded titlebar. + * This negative margin solves the overwrapping. + */ margin-top: -4px; } diff --git a/skin/classic/treestyletab/WINNT-base.css b/skin/classic/treestyletab/WINNT-base.css new file mode 100644 index 00000000..55c861c7 --- /dev/null +++ b/skin/classic/treestyletab/WINNT-base.css @@ -0,0 +1,41 @@ +@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); + +@media (-moz-windows-compositor) { + +/** + * Cancel "tabs on top" appearance on Australis. + */ +#main-window[sizemode="normal"]:not([treestyletab-tabbar-position="top"]) + #browser-panel + > #navigator-toolbox + > #nav-bar:not(:-moz-lwtheme), +#main-window[sizemode="normal"]:not([treestyletab-tabbar-position="top"]) + #browser-panel + > #navigator-toolbox + > #nav-bar:not(:-moz-lwtheme):-moz-window-inactive { + background: transparent; + border-top: none !important; + border-left: none; + border-right: none; + box-shadow: none; + position: relative; + margin-top: -5px; + padding-top: 0; + padding-left: 0; + padding-right: 0; + -moz-binding: url("chrome://browser/content/customizableui/toolbar.xml#toolbar-drag"); +} + +/* show in titlebar mode */ +#main-window[sizemode="normal"][treestyletab-allow-toolbox-in-titlebar="true"]:not([treestyletab-tabbar-position="top"]) + #browser-panel + > #navigator-toolbox + > #nav-bar:not(:-moz-lwtheme), +#main-window[sizemode="normal"][treestyletab-allow-toolbox-in-titlebar="true"]:not([treestyletab-tabbar-position="top"]) + #browser-panel + > #navigator-toolbox + > #nav-bar:not(:-moz-lwtheme):-moz-window-inactive { + margin-top: 1.5em; +} + +}