From b74d7af666f7cd2c0e3ade529071aaf8d71e530c Mon Sep 17 00:00:00 2001 From: Mike Conley Date: Tue, 30 Apr 2013 16:25:08 +1200 Subject: [PATCH] Bug 864355 - Extend customization target across (almost) the entire nav-bar. r=Unfocused,jaws --- browser/base/content/browser.js | 3 +- browser/base/content/browser.xul | 272 +++++++++--------- .../customizableui/content/toolbar.xml | 11 + .../customizableui/src/CustomizableUI.jsm | 26 +- .../customizableui/src/CustomizeMode.jsm | 18 +- browser/themes/linux/browser.css | 4 +- browser/themes/osx/browser.css | 2 +- browser/themes/windows/browser.css | 2 +- 8 files changed, 177 insertions(+), 161 deletions(-) diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index ff18c60c6b2..df1d34168bf 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -4061,8 +4061,7 @@ var CombinedStopReload = { var stop = document.getElementById("stop-button"); if (urlbar) { - if (urlbar.parentNode.getAttribute("mode") != "icons" || - !reload || urlbar.nextSibling != reload || + if (!reload || urlbar.nextSibling != reload || !stop || reload.nextSibling != stop) urlbar.removeAttribute("combined"); else { diff --git a/browser/base/content/browser.xul b/browser/base/content/browser.xul index b7afb1199fd..01abe7ad6fc 100644 --- a/browser/base/content/browser.xul +++ b/browser/base/content/browser.xul @@ -532,145 +532,145 @@ customizationtarget="nav-bar-customizationtarget" context="toolbar-context-menu"> - - - - - - - - - - - - - - - - - - - - - - - + + - - - + tooltip="back-button-tooltip"/> + + + - - - - - - - + + + + + + + + + + + + - - + tooltiptext="&pageReportIcon.tooltip;" + onclick="gPopupBlockerObserver.onReportButtonClick(event);"/> + + + + + + + + + + + + + + + + + + + + diff --git a/browser/components/customizableui/src/CustomizableUI.jsm b/browser/components/customizableui/src/CustomizableUI.jsm index da5ce0f734d..e078f08bd64 100644 --- a/browser/components/customizableui/src/CustomizableUI.jsm +++ b/browser/components/customizableui/src/CustomizableUI.jsm @@ -224,11 +224,16 @@ let gFuturePlacements = new Map(); */ let gDefaultPlacements = new Map([ ["nav-bar", [ + "unified-back-forward-button", + "urlbar-container", + "reload-button", + "stop-button", "search-container", + "webrtc-status-button", "bookmarks-menu-button-container", "downloads-button", + "home-button", "social-toolbar-button", - "PanelUI-button", "share-page" ]], ["PanelUI-contents", [ @@ -371,6 +376,7 @@ let CustomizableUIInternal = { let placements = gPlacements.get(area); this.buildArea(area, placements, aToolbar); + aToolbar.setAttribute("currentset", placements.join(",")); // We register this window to have its customization data cleaned up when // unloading. @@ -413,14 +419,18 @@ let CustomizableUIInternal = { let limit = currentNode.previousSibling; let node = container.lastChild; while (node != limit) { - // XXXunf Deprecating the old "removable" attribute, is this right? - // XXXmconley I think we need to hear from UX about this. - if (palette) { - palette.appendChild(node); - } else { - container.removeChild(node); + // Nodes opt-in to removability. If they're removable, and we haven't + // seen them in the placements array, then we toss them into the palette + // if one exists. If no palette exists, we just remove the node. If the + // node is not removable, we leave it where it is. + if (node.getAttribute("removable") == "true") { + if (palette) { + palette.appendChild(node); + } else { + container.removeChild(node); + } } - node = container.lastChild; + node = node.previousSibling; } } }, diff --git a/browser/components/customizableui/src/CustomizeMode.jsm b/browser/components/customizableui/src/CustomizeMode.jsm index d1ee9ccd54a..1578969949a 100644 --- a/browser/components/customizableui/src/CustomizeMode.jsm +++ b/browser/components/customizableui/src/CustomizeMode.jsm @@ -375,19 +375,15 @@ CustomizeMode.prototype = { // also want to (try) persisting with currentset as well to make it // less painful to switch to older builds. persistCurrentSets: function() { - //XXXjaws The toolbar bindings that are included in this changeset (/browser/base/content/toolbar.xml) - // don't implement currentSet. They probably need to inherit the toolkit bindings. - return; - let document = this.document; - let toolbar = document.getElementById("nav-bar"); + let toolbars = document.querySelectorAll("toolbar"); - // Calculate currentset and store it in the attribute. - let currentSet = toolbar.currentSet; - toolbar.setAttribute("currentset", currentSet); - - // Persist the currentset attribute directly on hardcoded toolbars. - document.persist(toolbar.id, "currentset"); + for (let toolbar of toolbars) { + // Calculate currentset and store it in the attribute. + toolbar.setAttribute("currentset", toolbar.currentSet); + // Persist the currentset attribute directly on hardcoded toolbars. + document.persist(toolbar.id, "currentset"); + } }, reset: function() { diff --git a/browser/themes/linux/browser.css b/browser/themes/linux/browser.css index d508482a0d8..98d4b5d8f5b 100644 --- a/browser/themes/linux/browser.css +++ b/browser/themes/linux/browser.css @@ -15,8 +15,8 @@ %define fgTabTexture linear-gradient(transparent 0px, transparent 1px, hsla(0,0%,100%,0.35) 1px, hsla(0,0%,100%,0.35) 2px, hsla(0,0%,100%,0.65) 2px, hsla(0,0%,100%,0.65) 3px, @toolbarHighlight@) %define fgTabBackgroundMiddle @fgTabTexture@, linear-gradient(transparent 0px, transparent 2px, -moz-dialog 2px, -moz-dialog) %define forwardTransitionLength 150ms -%define conditionalForwardWithUrlbar window:not([chromehidden~=toolbar]) :-moz-any(#nav-bar[currentset*="unified-back-forward-button,urlbar-container"], #nav-bar:not([currentset])) > #unified-back-forward-button -%define conditionalForwardWithUrlbar_small window:not([chromehidden~=toolbar]) :-moz-any(#nav-bar[currentset*="unified-back-forward-button,urlbar-container"][iconsize=small],#nav-bar:not([currentset])[iconsize=small]) > #unified-back-forward-button +%define conditionalForwardWithUrlbar window:not([chromehidden~=toolbar]) :-moz-any(#nav-bar[currentset*="unified-back-forward-button,urlbar-container"], #nav-bar:not([currentset])) > #nav-bar-customizationtarget > #unified-back-forward-button +%define conditionalForwardWithUrlbar_small window:not([chromehidden~=toolbar]) :-moz-any(#nav-bar[currentset*="unified-back-forward-button,urlbar-container"][iconsize=small],#nav-bar:not([currentset])[iconsize=small]) > #nav-bar-customizationtarget > #unified-back-forward-button %define conditionalForwardWithUrlbarWidth 32 %define conditionalForwardWithUrlbarWidth_small 24 diff --git a/browser/themes/osx/browser.css b/browser/themes/osx/browser.css index 99b2166758a..62bfec6850f 100644 --- a/browser/themes/osx/browser.css +++ b/browser/themes/osx/browser.css @@ -9,7 +9,7 @@ %define fgTabTexture linear-gradient(hsla(0,0%,100%,0.6), hsla(0,0%,100%,0.6) 0px, hsl(0,0%,99%) 1px, hsl(0,0%,92%)) %define fgTabBackgroundMiddle linear-gradient(transparent, transparent) %define forwardTransitionLength 150ms -%define conditionalForwardWithUrlbar window:not([chromehidden~=toolbar]) #navigator-toolbox[iconsize=large] > :-moz-any(#nav-bar[currentset*="unified-back-forward-button,urlbar-container"],#nav-bar:not([currentset])) > #unified-back-forward-button +%define conditionalForwardWithUrlbar window:not([chromehidden~=toolbar]) #navigator-toolbox[iconsize=large] > :-moz-any(#nav-bar[currentset*="unified-back-forward-button,urlbar-container"],#nav-bar:not([currentset])) > #nav-bar-customizationtarget > #unified-back-forward-button %define conditionalForwardWithUrlbarWidth 27 @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); diff --git a/browser/themes/windows/browser.css b/browser/themes/windows/browser.css index bdc819d2e00..3dc64b52e58 100644 --- a/browser/themes/windows/browser.css +++ b/browser/themes/windows/browser.css @@ -15,7 +15,7 @@ %define navbarTextboxCustomBorder border-color: rgba(0,0,0,.32); %define navbarLargeIcons #navigator-toolbox[iconsize=large] > #nav-bar %define forwardTransitionLength 150ms -%define conditionalForwardWithUrlbar window:not([chromehidden~=toolbar]) #navigator-toolbox[iconsize=large] > :-moz-any(#nav-bar[currentset*="unified-back-forward-button,urlbar-container"],#nav-bar:not([currentset])) > #unified-back-forward-button +%define conditionalForwardWithUrlbar window:not([chromehidden~=toolbar]) #navigator-toolbox[iconsize=large] > :-moz-any(#nav-bar[currentset*="unified-back-forward-button,urlbar-container"],#nav-bar:not([currentset])) > #nav-bar-customizationtarget > #unified-back-forward-button %define conditionalForwardWithUrlbarWidth 27 %ifdef MOZ_OFFICIAL_BRANDING