Bug 612588 - Toolbars outside of the toolbox should be visible while customizing, just like those inside of the toolbox. r=enn a=gavin
authorDão Gottwald <dao@mozilla.com>
Mon, 22 Nov 2010 11:21:43 +0100
changeset 57987 6c4cca9bd1052ed7840b2514f743b1a42aed9aae
parent 57986 2867e48dec94da8d217512034f0dc91466828a52
child 57988 97670819ee38d34773c44db9ea6e17961444bf70
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
reviewersenn, gavin
bugs612588
milestone2.0b8pre
Bug 612588 - Toolbars outside of the toolbox should be visible while customizing, just like those inside of the toolbox. r=enn a=gavin
browser/base/content/browser.js
browser/base/content/test/browser_bug599325.js
toolkit/content/customizeToolbar.js
toolkit/content/xul.css
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -3429,22 +3429,16 @@ function BrowserCustomizeToolbar()
   if (splitter)
     splitter.parentNode.removeChild(splitter);
 
   CombinedStopReload.uninit();
 
   PlacesToolbarHelper.customizeStart();
   BookmarksMenuButton.customizeStart();
 
-  let addonBar = document.getElementById("addon-bar");
-  if (addonBar.collapsed) {
-    addonBar.wasCollapsed = addonBar.collapsed;
-    addonBar.collapsed = false;
-  }
-
   var customizeURL = "chrome://global/content/customizeToolbar.xul";
   gCustomizeSheet = getBoolPref("toolbar.customization.usesheet", false);
 
   if (gCustomizeSheet) {
     var sheetFrame = document.getElementById("customizeToolbarSheetIFrame");
     var panel = document.getElementById("customizeToolbarSheetPopup");
     sheetFrame.hidden = false;
     sheetFrame.toolbox = gNavToolbox;
@@ -3493,22 +3487,16 @@ function BrowserToolboxCustomizeDone(aTo
 #ifndef XP_MACOSX
     updateEditUIVisibility();
 #endif
   }
 
   PlacesToolbarHelper.customizeDone();
   BookmarksMenuButton.customizeDone();
 
-  let addonBar = document.getElementById("addon-bar");
-  if (addonBar.wasCollapsed === true) {
-    addonBar.collapsed = true;
-    delete addonBar.wasCollapsed;
-  }
-
   // The url bar splitter state is dependent on whether stop/reload
   // and the location bar are combined, so we need this ordering
   CombinedStopReload.init();
   UpdateUrlbarSearchSplitterState();
 
   // Update the urlbar
   if (gURLBar) {
     URLBarSetURI();
--- a/browser/base/content/test/browser_bug599325.js
+++ b/browser/base/content/test/browser_bug599325.js
@@ -1,56 +1,37 @@
 function test() {
   waitForExplicitFinish();
-  
-  // test the main (normal) browser window
-  testCustomize(window, testChromeless);
-}
 
-function testChromeless() {
-  // test a chromeless window
-  var newWin = openDialog("chrome://browser/content/", "_blank",
-                      "chrome,dialog=no,toolbar=no", "about:blank");
-  ok(newWin, "got new window");
-
-  function runWindowTest() {
-    function finalize() {
-      newWin.removeEventListener("load", runWindowTest, false);
-      newWin.close();
-      finish();
-    }
-    testCustomize(newWin, finalize);
-  }
-
-  newWin.addEventListener("load", runWindowTest, false);
+  testCustomize(window, finish);
 }
 
 function testCustomize(aWindow, aCallback) {
   var addonBar = aWindow.document.getElementById("addon-bar");
   ok(addonBar, "got addon bar");
-  is(addonBar.collapsed, true, "addon bar initially disabled");
+  ok(!isElementVisible(addonBar), "addon bar initially hidden");
 
   // Launch toolbar customization
   // ctEl is either iframe that contains the customize sheet, or the dialog
   var ctEl = aWindow.BrowserCustomizeToolbar();
 
-  is(addonBar.collapsed, false,
-     "file menu is not collapsed during toolbar customization");
-
   aWindow.gNavToolbox.addEventListener("beforecustomization", function () {
     aWindow.gNavToolbox.removeEventListener("beforecustomization", arguments.callee, false);
     executeSoon(ctInit);
   }, false);
 
   function ctInit() {
+    ok(isElementVisible(addonBar),
+       "add-on bar is visible during toolbar customization");
+
     // Close toolbar customization
     closeToolbarCustomization(aWindow, ctEl);
 
-    is(addonBar.getAttribute("collapsed"), "true",
-       "addon bar is collapsed after toolbar customization");
+    ok(!isElementVisible(addonBar),
+       "addon bar is hidden after toolbar customization");
 
     if (aCallback)
       aCallback();
   }
 }
 
 function closeToolbarCustomization(aWindow, aCTWindow) {
   // Force the cleanup code to be run now instead of onunload.
--- a/toolkit/content/customizeToolbar.js
+++ b/toolkit/content/customizeToolbar.js
@@ -61,16 +61,19 @@ function onLoad()
 }
 
 function InitWithToolbox(aToolbox)
 {
   gToolbox = aToolbox;
   dispatchCustomizationEvent("beforecustomization");
   gToolboxDocument = gToolbox.ownerDocument;
   gToolbox.customizing = true;
+  forEachCustomizableToolbar(function (toolbar) {
+    toolbar.setAttribute("customizing", "true");
+  });
 
   var elts = getRootElements();
   for (let i=0; i < elts.length; i++) {
     elts[i].addEventListener("dragstart", onToolbarDragStart, true);
     elts[i].addEventListener("dragover", onToolbarDragOver, true);
     elts[i].addEventListener("dragleave", onToolbarDragLeave, true);
     elts[i].addEventListener("drop", onToolbarDrop, true);
   }
@@ -93,16 +96,19 @@ function onUnload()
 }
 
 function finishToolbarCustomization()
 {
   removeToolboxListeners();
   unwrapToolbarItems();
   persistCurrentSets();
   gToolbox.customizing = false;
+  forEachCustomizableToolbar(function (toolbar) {
+    toolbar.removeAttribute("customizing");
+  });
 
   notifyParentComplete();
 }
 
 function initDialog()
 {
   var mode = gToolbox.getAttribute("mode");
   document.getElementById("modelist").value = mode;
--- a/toolkit/content/xul.css
+++ b/toolkit/content/xul.css
@@ -252,41 +252,40 @@ toolbox {
   -moz-binding: url("chrome://global/content/bindings/toolbar.xml#toolbox");
   -moz-box-orient: vertical;
 }
   
 toolbar {
   -moz-binding: url("chrome://global/content/bindings/toolbar.xml#toolbar");
 }
 
-toolbox[customizing="true"] > toolbar[customizable="true"][collapsed="true"] {
+toolbar[customizing="true"][collapsed="true"] {
   /* Some apps, e.g. Firefox, use 'collapsed' to hide toolbars.
      Override it while customizing. */
   visibility: visible;
 }
 
-toolbox[customizing="true"] > toolbar[customizable="true"][hidden="true"] {
+toolbar[customizing="true"][hidden="true"] {
   /* Some apps, e.g. SeaMonkey, use 'hidden' to hide toolbars.
      Override it while customizing. */
   display: -moz-box;
 }
 
 %ifdef XP_MACOSX
 toolbar[type="menubar"] {
   min-height: 0 !important;
   border: 0 !important;
 }
 %else
 toolbar[type="menubar"][autohide="true"] {
   -moz-binding: url("chrome://global/content/bindings/toolbar.xml#toolbar-menubar-autohide");
   overflow: hidden;
 }
 
-toolbar[type="menubar"][autohide="true"][inactive="true"]:not([customizable="true"]),
-toolbox:not([customizing="true"]) > toolbar[type="menubar"][autohide="true"][inactive="true"][customizable="true"] {
+toolbar[type="menubar"][autohide="true"][inactive="true"]:not([customizing="true"]) {
   min-height: 0 !important;
   height: 0 !important;
   -moz-appearance: none !important;
   border-style: none !important;
 }
 %endif
 
 toolbarseparator {