Bug 1396953 - fix flexible space widget disappearing when adding to toolbar r?Gijs draft
☠☠ backed out by f90acd5a42b3 ☠ ☠
authorMaya Messinger <maya.messinger@duke.edu>
Sat, 30 Sep 2017 13:06:28 -0400
changeset 673068 4e4239384b2e1854037f0c23f2ab285d2a24a947
parent 673058 19f368b1267d67f1bc214abae058ec20cb532c64
child 673073 8beff0a7bc098c1c953f6de8b35de8c79f659825
push id82449
push userbmo:maya.messinger@duke.edu
push dateSat, 30 Sep 2017 17:06:47 +0000
reviewersGijs
bugs1396953
milestone58.0a1
Bug 1396953 - fix flexible space widget disappearing when adding to toolbar r?Gijs MozReview-Commit-ID: Ghdeuefn3pT
browser/components/customizableui/CustomizeMode.jsm
browser/components/customizableui/content/panelUI.inc.xul
--- a/browser/components/customizableui/CustomizeMode.jsm
+++ b/browser/components/customizableui/CustomizeMode.jsm
@@ -579,17 +579,22 @@ CustomizeMode.prototype = {
   },
 
   addToToolbar(aNode) {
     aNode = this._getCustomizableChildForNode(aNode);
     if (aNode.localName == "toolbarpaletteitem" && aNode.firstChild) {
       aNode = aNode.firstChild;
     }
 
-    CustomizableUI.addWidgetToArea(aNode.id, CustomizableUI.AREA_NAVBAR);
+    let widgetToAdd = aNode.id;
+    if (CustomizableUI.isSpecialWidget(widgetToAdd) && aNode.closest("#customization-palette")) {
+      widgetToAdd = widgetToAdd.match(/^customizableui-special-(spring|spacer|separator)/)[1];
+    }
+
+    CustomizableUI.addWidgetToArea(widgetToAdd, CustomizableUI.AREA_NAVBAR);
     if (!this._customizing) {
       CustomizableUI.dispatchToolboxEvent("customizationchange");
     }
 
     // If the user explicitly moves this item, turn off autohide.
     if (aNode.id == "downloads-button") {
       Services.prefs.setBoolPref(kDownloadAutoHidePref, false);
       if (this._customizing) {
@@ -600,17 +605,17 @@ CustomizeMode.prototype = {
 
   addToPanel(aNode) {
     aNode = this._getCustomizableChildForNode(aNode);
     if (aNode.localName == "toolbarpaletteitem" && aNode.firstChild) {
       aNode = aNode.firstChild;
     }
 
     let panel = CustomizableUI.AREA_FIXED_OVERFLOW_PANEL;
-    CustomizableUI.addWidgetToArea(aNode.id, panel);
+    CustomizableUI.addWidgetToArea(widgetToAdd, panel);
     if (!this._customizing) {
       CustomizableUI.dispatchToolboxEvent("customizationchange");
     }
 
     // If the user explicitly moves this item, turn off autohide.
     if (aNode.id == "downloads-button") {
       Services.prefs.setBoolPref(kDownloadAutoHidePref, false);
       if (this._customizing) {
--- a/browser/components/customizableui/content/panelUI.inc.xul
+++ b/browser/components/customizableui/content/panelUI.inc.xul
@@ -627,16 +627,22 @@
                        label="&printCmd.label;"
 #ifdef XP_MACOSX
                        key="printKb"
                        command="cmd_print"
 #else
                        command="cmd_printPreview"
 #endif
                        />
+        <toolbarbutton id="appMenu-print-preview-button"
+                       class="subviewbutton subviewbutton-iconic"
+                       label="&printCmd.label;"
+                       key="printKb"
+                       command="cmd_printPreview"
+                       />
         <toolbarseparator/>
         <toolbarbutton id="appMenu-find-button"
                        class="subviewbutton subviewbutton-iconic"
                        label="&findOnCmd.label;"
                        key="key_find"
                        command="cmd_find"/>
         <toolbarbutton id="appMenu-more-button"
                        class="subviewbutton subviewbutton-nav"