Bug 1287980 - fix combined toolbar button styling after undo reset, r?jaws
MozReview-Commit-ID: GnkIUIAByH7
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -660,22 +660,16 @@
#ifdef XP_MACOSX
<hbox class="titlebar-placeholder" type="fullscreen-button"
id="titlebar-placeholder-on-TabsToolbar-for-fullscreen-button" persist="width"
skipintoolbarset="true"/>
#endif
#endif
</toolbar>
- <!--
- CAVEAT EMPTOR
- Should you need to add items to the toolbar here, make sure to also add them
- to the default placements of buttons in CustomizableUI.jsm, so the
- customization code doesn't get confused.
- -->
<toolbar id="nav-bar"
aria-label="&navbarCmd.label;"
fullscreentoolbar="true" mode="icons" customizable="true"
iconsize="small"
customizationtarget="nav-bar-customization-target"
overflowable="true"
overflowbutton="nav-bar-overflow-button"
overflowtarget="widget-overflow-list"
--- a/browser/components/customizableui/CustomizableUI.jsm
+++ b/browser/components/customizableui/CustomizableUI.jsm
@@ -721,46 +721,48 @@ var CustomizableUIInternal = {
}
let [provider, node] = this.getWidgetNode(id, window);
if (!node) {
log.debug("Unknown widget: " + id);
continue;
}
+ let widget = null;
// If the placements have items in them which are (now) no longer removable,
// we shouldn't be moving them:
if (provider == CustomizableUI.PROVIDER_API) {
- let widgetInfo = gPalette.get(id);
- if (!widgetInfo.removable && aArea != widgetInfo.defaultArea) {
+ widget = gPalette.get(id);
+ if (!widget.removable && aArea != widget.defaultArea) {
placementsToRemove.add(id);
continue;
}
} else if (provider == CustomizableUI.PROVIDER_XUL &&
node.parentNode != container && !this.isWidgetRemovable(node)) {
placementsToRemove.add(id);
continue;
} // Special widgets are always removable, so no need to check them
- if (inPrivateWindow && provider == CustomizableUI.PROVIDER_API) {
- let widget = gPalette.get(id);
- if (!widget.showInPrivateBrowsing && inPrivateWindow) {
- continue;
- }
+ if (inPrivateWindow && widget && !widget.showInPrivateBrowsing) {
+ continue;
}
this.ensureButtonContextMenu(node, aAreaNode);
if (node.localName == "toolbarbutton") {
if (areaIsPanel) {
node.setAttribute("wrap", "true");
} else {
node.removeAttribute("wrap");
}
}
+ // This needs updating in case we're resetting / undoing a reset.
+ if (widget) {
+ widget.currentArea = aArea;
+ }
this.insertWidgetBefore(node, currentNode, container, aArea);
if (gResetting) {
this.notifyListeners("onWidgetReset", node, container);
} else if (gUndoResetting) {
this.notifyListeners("onWidgetUndoMove", node, container);
}
}
--- a/browser/components/customizableui/CustomizableWidgets.jsm
+++ b/browser/components/customizableui/CustomizableWidgets.jsm
@@ -743,16 +743,23 @@ const CustomizableWidgets = [
onWidgetReset: function(aWidgetNode) {
if (aWidgetNode != node)
return;
updateCombinedWidgetStyle(node, this.currentArea, true);
updateZoomResetButton();
}.bind(this),
+ onWidgetUndoMove: function(aWidgetNode) {
+ if (aWidgetNode != node)
+ return;
+ updateCombinedWidgetStyle(node, this.currentArea, true);
+ updateZoomResetButton();
+ }.bind(this),
+
onWidgetMoved: function(aWidgetId, aArea) {
if (aWidgetId != this.id)
return;
updateCombinedWidgetStyle(node, aArea, true);
updateZoomResetButton();
}.bind(this),
onWidgetInstanceRemoved: function(aWidgetId, aDoc) {
@@ -854,16 +861,22 @@ const CustomizableWidgets = [
}.bind(this),
onWidgetReset: function(aWidgetNode) {
if (aWidgetNode != node)
return;
updateCombinedWidgetStyle(node, this.currentArea);
}.bind(this),
+ onWidgetUndoMove: function(aWidgetNode) {
+ if (aWidgetNode != node)
+ return;
+ updateCombinedWidgetStyle(node, this.currentArea);
+ }.bind(this),
+
onWidgetMoved: function(aWidgetId, aArea) {
if (aWidgetId != this.id)
return;
updateCombinedWidgetStyle(node, aArea);
}.bind(this),
onWidgetInstanceRemoved: function(aWidgetId, aDoc) {
if (aWidgetId != this.id || aDoc != aDocument)