Bug 1364166 - Only update combined buttons style in the customizableUI panel. r=Gijs draft
authorJohann Hofmann <jhofmann@mozilla.com>
Thu, 11 May 2017 22:05:01 -0400
changeset 576652 6ea20aba09bfe12a558dc20a6e65f324292ca0f2
parent 576334 3b96f277325747fe668ca8cd896d2f581238e4ee
child 628269 83ca4a372aeb01c262c6862d5990f380d953b531
push id58440
push userbmo:jhofmann@mozilla.com
push dateFri, 12 May 2017 02:05:23 +0000
reviewersGijs
bugs1364166
milestone55.0a1
Bug 1364166 - Only update combined buttons style in the customizableUI panel. r=Gijs This Photon-specific workaround styles the zoom and edit button combinations when the user switches back to the old menu panel. Before this patch, it used to apply the panel style even if the buttons were in the toolbar. This patch fixes that by not even updating the style if the buttons are not in the panel. MozReview-Commit-ID: JZZUTudSDeZ
browser/components/customizableui/CustomizableWidgets.jsm
--- a/browser/components/customizableui/CustomizableWidgets.jsm
+++ b/browser/components/customizableui/CustomizableWidgets.jsm
@@ -751,18 +751,19 @@ const CustomizableWidgets = [
           aArea = aArea || this.currentArea;
           updateCombinedWidgetStyle(node, aArea, true);
         },
 
         // Hack. This can go away when the old menu panel goes away (post photon).
         // We need it right now for the case where we re-register the old-style
         // main menu panel if photon is disabled at runtime, and we automatically
         // put the widgets in there, so they get the right style in the panel.
-        onAreaNodeRegistered(aArea, aContainer) {
+        onAreaNodeRegistered: (aArea, aContainer) => {
           if (aContainer.ownerDocument == node.ownerDocument &&
+              aArea == this.currentArea &&
               aArea == CustomizableUI.AREA_PANEL) {
             updateCombinedWidgetStyle(node, aArea, true);
           }
         },
       };
       CustomizableUI.addListener(listener);
 
       return node;
@@ -858,18 +859,19 @@ const CustomizableWidgets = [
           aArea = aArea || this.currentArea;
           updateCombinedWidgetStyle(node, aArea);
         },
 
         // Hack. This can go away when the old menu panel goes away (post photon).
         // We need it right now for the case where we re-register the old-style
         // main menu panel if photon is disabled at runtime, and we automatically
         // put the widgets in there, so they get the right style in the panel.
-        onAreaNodeRegistered(aArea, aContainer) {
+        onAreaNodeRegistered: (aArea, aContainer) => {
           if (aContainer.ownerDocument == node.ownerDocument &&
+              aArea == this.currentArea &&
               aArea == CustomizableUI.AREA_PANEL) {
             updateCombinedWidgetStyle(node, aArea);
           }
         },
       };
       CustomizableUI.addListener(listener);
 
       return node;