Bug 1396953 - fix flexible space widget disappearing when adding to toolbar r?Gijs
MozReview-Commit-ID: Ghdeuefn3pT
--- 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"