Bug 1450816 - Combine the "toolbarpaletteitem" bindings in the "browser" folder. r=Gijs draft
authorPaolo Amadini <paolo.mozmail@amadzone.org>
Mon, 21 May 2018 14:43:51 +0100
changeset 797724 ab07b109ba54c9dc9e52bea33295d02c31ec87d0
parent 797566 000309d44abb81084276c9fa977c57aee7126053
push id110548
push userpaolo.mozmail@amadzone.org
push dateMon, 21 May 2018 13:45:21 +0000
reviewersGijs
bugs1450816
milestone62.0a1
Bug 1450816 - Combine the "toolbarpaletteitem" bindings in the "browser" folder. r=Gijs MozReview-Commit-ID: BW4kDvP13Tj
browser/base/content/browser.css
browser/components/customizableui/CustomizeMode.jsm
browser/components/customizableui/content/toolbar.xml
toolkit/content/widgets/toolbar.xml
toolkit/content/xul.css
--- a/browser/base/content/browser.css
+++ b/browser/base/content/browser.css
@@ -1243,38 +1243,47 @@ toolbarpaletteitem[dragover] {
   flex-shrink: 0;
   flex-wrap: wrap;
 }
 
 #customization-toolbar-visibility-button > .box-inherit > .button-menu-dropmarker {
   display: -moz-box;
 }
 
+toolbarpaletteitem {
+  -moz-binding: url("chrome://browser/content/customizableui/toolbar.xml#toolbarpaletteitem");
+}
+
 toolbarpaletteitem[place="palette"] {
-  -moz-binding: url("chrome://global/content/bindings/toolbar.xml#toolbarpaletteitem-palette-wrapping-label");
+  -moz-box-orient: vertical;
   width: 7em;
   /* icon (16) + margin (9 + 12) + 3 lines of text: */
   height: calc(39px + 3em);
   margin-bottom: 5px;
   margin-inline-end: 24px;
   overflow: visible;
   display: inline-block;
   vertical-align: top;
 }
 
+toolbarpaletteitem:not([place="palette"]) > .toolbarpaletteitem-label,
 toolbarpaletteitem[place="palette"][hidden] {
   display: none;
 }
 
-#customization-palette .toolbarpaletteitem-box {
+toolbarpaletteitem[place="palette"] > .toolbarpaletteitem-box {
   -moz-box-pack: center;
   width: 7em;
   max-width: 7em;
 }
 
+toolbarpaletteitem:not([place="palette"]) > .toolbarpaletteitem-box {
+  -moz-box-flex: 1;
+}
+
 #main-window[customizing=true] .addon-banner-item,
 #main-window[customizing=true] .panel-banner-item {
   display: none;
 }
 
 /* UI Tour */
 
 @keyframes uitour-wobble {
--- a/browser/components/customizableui/CustomizeMode.jsm
+++ b/browser/components/customizableui/CustomizeMode.jsm
@@ -814,19 +814,17 @@ CustomizeMode.prototype = {
 
   createOrUpdateWrapper(aNode, aPlace, aIsUpdate) {
     let wrapper;
     if (aIsUpdate && aNode.parentNode && aNode.parentNode.localName == "toolbarpaletteitem") {
       wrapper = aNode.parentNode;
       aPlace = wrapper.getAttribute("place");
     } else {
       wrapper = this.document.createElement("toolbarpaletteitem");
-      // "place" is used by toolkit to add the toolbarpaletteitem-palette
-      // binding to a toolbarpaletteitem, which gives it a label node for when
-      // it's sitting in the palette.
+      // "place" is used to show the label when it's sitting in the palette.
       wrapper.setAttribute("place", aPlace);
     }
 
 
     // Ensure the wrapped item doesn't look like it's in any special state, and
     // can't be interactved with when in the customization palette.
     // Note that some buttons opt out of this with the
     // keepbroadcastattributeswhencustomizing attribute.
--- a/browser/components/customizableui/content/toolbar.xml
+++ b/browser/components/customizableui/content/toolbar.xml
@@ -317,9 +317,18 @@
             draggableThis.mouseDownCheck = function(e) {
               return this._dragBindingAlive;
             };
           } catch (e) {}
         }
       ]]></constructor>
     </implementation>
   </binding>
+
+  <binding id="toolbarpaletteitem" extends="xul:button">
+    <content>
+      <xul:hbox class="toolbarpaletteitem-box">
+        <children/>
+      </xul:hbox>
+      <xul:label class="toolbarpaletteitem-label" xbl:inherits="xbl:text=title"/>
+    </content>
+  </binding>
 </bindings>
--- a/toolkit/content/widgets/toolbar.xml
+++ b/toolkit/content/widgets/toolbar.xml
@@ -119,36 +119,9 @@
               return this._dragBindingAlive &&
                      this.getAttribute("customizing") != "true";
             };
           } catch (e) {}
         }
       ]]></constructor>
     </implementation>
   </binding>
-
-  <binding id="toolbarpaletteitem" extends="xul:button">
-    <content>
-      <xul:hbox class="toolbarpaletteitem-box" flex="1" xbl:inherits="type,place">
-        <children/>
-      </xul:hbox>
-    </content>
-  </binding>
-
-  <binding id="toolbarpaletteitem-palette" extends="chrome://global/content/bindings/toolbar.xml#toolbarpaletteitem">
-    <content>
-      <xul:hbox class="toolbarpaletteitem-box" xbl:inherits="type,place">
-        <children/>
-      </xul:hbox>
-      <xul:label xbl:inherits="value=title"/>
-    </content>
-  </binding>
-
-  <binding id="toolbarpaletteitem-palette-wrapping-label" extends="chrome://global/content/bindings/toolbar.xml#toolbarpaletteitem">
-    <content>
-      <xul:hbox class="toolbarpaletteitem-box" xbl:inherits="type,place">
-        <children/>
-      </xul:hbox>
-      <xul:label xbl:inherits="xbl:text=title"/>
-    </content>
-  </binding>
-
 </bindings>
--- a/toolkit/content/xul.css
+++ b/toolkit/content/xul.css
@@ -301,25 +301,16 @@ toolbar[type="menubar"][autohide="true"]
   border-style: none !important;
 }
 %endif
 
 toolbarspring {
   -moz-box-flex: 1000;
 }
 
-toolbarpaletteitem {
-  -moz-binding: url("chrome://global/content/bindings/toolbar.xml#toolbarpaletteitem");
-}
-
-toolbarpaletteitem[place="palette"] {
-  -moz-box-orient: vertical;
-  -moz-binding: url("chrome://global/content/bindings/toolbar.xml#toolbarpaletteitem-palette");
-}
-
 /********* menu ***********/
 
 menubar > menu {
   -moz-binding: url("chrome://global/content/bindings/menu.xml#menu-menubar");
 }
 
 menubar > menu.menu-iconic {
   -moz-binding: url("chrome://global/content/bindings/menu.xml#menu-menubar-iconic");