From ad98319f2fd2345c210e02f93386eae9ff003a96 Mon Sep 17 00:00:00 2001 From: Jim Mathies Date: Mon, 9 Aug 2010 20:49:35 -0500 Subject: [PATCH] Bug 575870 - Implement custom drawn titlebar for classic, aero basic, and xp. Also fix various content padding issues for desktops with advanced ui customization settings. r=dao. --- browser/base/content/browser.css | 6 +- browser/base/content/browser.js | 18 +++- browser/base/content/browser.xul | 14 ++- browser/themes/winstripe/browser/browser-aero.css | 9 -- browser/themes/winstripe/browser/browser.css | 103 ++++++++++++++++------ 5 files changed, 109 insertions(+), 41 deletions(-) diff --git a/browser/base/content/browser.css b/browser/base/content/browser.css index 98304186bf..9a5af3f7f7 100644 --- a/browser/base/content/browser.css +++ b/browser/base/content/browser.css @@ -83,9 +83,13 @@ toolbar[printpreview="true"] { } %ifdef MENUBAR_CAN_AUTOHIDE -#main-window[inFullscreen] > #appmenu-button-container { +#main-window[inFullscreen] > #titlebar { display: none; } + +#titlebar { + -moz-binding: url("chrome://global/content/bindings/general.xml#windowdragbox"); +} %endif toolbarpaletteitem[place="palette"] > toolbaritem > hbox[type="places"] { diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index e8ad912187..d38fda3c80 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -1316,6 +1316,15 @@ function prepareForStartup() { // setup simple gestures support gGestureSupport.init(true); + +#ifdef MENUBAR_CAN_AUTOHIDE + // update the visibility of the titlebar buttons after the window is + // displayed. (required by theme code.) + window.addEventListener("MozAfterPaint", function () { + window.removeEventListener("MozAfterPaint", arguments.callee, false); + document.getElementById("titlebar-buttonbox").collapsed = false; + }, false); +#endif } function delayedStartup(isLoadingBlank, mustLoadSidebar) { @@ -4756,13 +4765,20 @@ function updateAppButtonDisplay() { window.menubar.visible && document.getElementById("toolbar-menubar").getAttribute("autohide") == "true"; - document.getElementById("appmenu-button-container").hidden = !displayAppButton; + document.getElementById("titlebar").hidden = !displayAppButton; if (displayAppButton) document.documentElement.setAttribute("chromemargin", "0,-1,-1,-1"); else document.documentElement.removeAttribute("chromemargin"); } + +function onTitlebarMaxClick() { + if (window.windowState == window.STATE_MAXIMIZED) + window.restore(); + else + window.maximize(); +} #endif function displaySecurityInfo() diff --git a/browser/base/content/browser.xul b/browser/base/content/browser.xul index fb6409ea77..858b4e10bb 100644 --- a/browser/base/content/browser.xul +++ b/browser/base/content/browser.xul @@ -437,7 +437,9 @@ #ifdef MENUBAR_CAN_AUTOHIDE - + + + - + + + + + + + + + #endif #titlebar { + -moz-appearance: -moz-window-titlebar-maximized; +} + +#titlebar-content { + margin-left: 15px; + margin-right: 15px; +} + +/* aesthetic - push the fx button off the top window border */ +@media not all and (-moz-windows-classic) { + #main-window[sizemode="normal"] > #titlebar > #titlebar-content > #appmenu-button-container { +%ifndef WINSTRIPE_AERO + margin-top: 1px; +%else + margin-top: 2px; %endif - #main-window[tabsontop="true"] > #appmenu-button-container > #appmenu-button { - position: relative !important; - margin-bottom: -1.6em !important; } - #navigator-toolbox[tabsontop="true"] > #toolbar-menubar[autohide="true"] { - position: relative !important; - background-color: -moz-dialog !important; +} + +#titlebar-buttonbox { + -moz-appearance: -moz-window-button-box; + -moz-box-align: start; +} + +#main-window[sizemode="maximized"] > #titlebar > #titlebar-content > #titlebar-buttonbox { + -moz-appearance: -moz-window-button-box-maximized; +} + +/* titlebar command buttons */ + +#titlebar-min { + -moz-appearance: -moz-window-button-minimize; +} + +#titlebar-max { + -moz-appearance: -moz-window-button-maximize; +} + +#main-window[sizemode="maximized"] > #titlebar > #titlebar-content > #titlebar-buttonbox > #titlebar-max { + -moz-appearance: -moz-window-button-restore; +} + +#titlebar-close { + -moz-appearance: -moz-window-button-close; +} + +@media not all and (-moz-windows-classic) { + #titlebar-min { + -moz-margin-end: 1px; + } + + #titlebar-max { + -moz-margin-start: 1px; + -moz-margin-end: 1px; } - #navigator-toolbox[tabsontop="true"] > #toolbar-menubar[autohide="true"] ~ #TabsToolbar:not([inFullscreen]) { - -moz-padding-start: 10em !important; + + #titlebar-close { + -moz-margin-start: 1px; + -moz-margin-end: 0; + } +} + +@media all and (-moz-windows-classic) { + #titlebar-close { + -moz-margin-start: 2px !important; } -%ifdef WINSTRIPE_AERO } -%endif /* ::::: bookmark buttons ::::: */ -- 2.11.4.GIT