Bug 944947 - label truncation is not fully supported in Australis menu widgets, r=Enn,MattN
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Fri, 17 Jan 2014 18:51:02 +0100
changeset 164545 993ee55e02cb5dba3c07a10e07366c9cd0ad113f
parent 164544 b5bd8c4bd16361b3ca0607c77a58a5061cf821ed
child 164546 5f84d2973b05e11929bcf01f6562f5819fe85ceb
push id4490
push usergijskruitbosch@gmail.com
push dateWed, 22 Jan 2014 12:50:42 +0000
treeherderfx-team@228214210aa5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersEnn, MattN
bugs944947
milestone29.0a1
Bug 944947 - label truncation is not fully supported in Australis menu widgets, r=Enn,MattN
browser/components/customizableui/content/panelUI.inc.xul
browser/components/customizableui/src/CustomizableUI.jsm
browser/components/downloads/content/download.xml
browser/themes/shared/customizableui/panelUIOverlay.inc.css
toolkit/content/widgets/toolbarbutton.xml
toolkit/content/xul.css
--- a/browser/components/customizableui/content/panelUI.inc.xul
+++ b/browser/components/customizableui/content/panelUI.inc.xul
@@ -6,17 +6,17 @@
        role="group"
        type="arrow"
        hidden="true"
        flip="slide"
        noautofocus="true">
   <panelmultiview id="PanelUI-multiView" mainViewId="PanelUI-mainView">
     <panelview id="PanelUI-mainView" context="customizationPanelContextMenu">
       <vbox id="PanelUI-contents-scroller">
-        <vbox id="PanelUI-contents"/>
+        <vbox id="PanelUI-contents" class="panelUI-grid"/>
       </vbox>
 
       <footer id="PanelUI-footer">
         <!-- The parentNode is used so that the footer is presented as the anchor
              instead of just the button being the anchor. -->
         <toolbarbutton id="PanelUI-customize" label="&appMenuCustomize.label;"
                        exitLabel="&appMenuCustomizeExit.label;" tabindex="0"
                        oncommand="gCustomizeMode.toggle();"/>
--- a/browser/components/customizableui/src/CustomizableUI.jsm
+++ b/browser/components/customizableui/src/CustomizableUI.jsm
@@ -474,19 +474,17 @@ let CustomizableUIInternal = {
           if (!widget.showInPrivateBrowsing && inPrivateWindow) {
             continue;
           }
         }
 
         this.ensureButtonContextMenu(node, aAreaNode);
         if (node.localName == "toolbarbutton" && aArea == CustomizableUI.AREA_PANEL) {
           node.setAttribute("tabindex", "0");
-          if (!node.hasAttribute("type")) {
-            node.setAttribute("type", "wrap");
-          }
+          node.setAttribute("wrap", "true");
         }
 
         this.insertWidgetBefore(node, currentNode, container, aArea);
         if (gResetting) {
           this.notifyListeners("onWidgetReset", node, container);
         }
       }
 
@@ -653,19 +651,17 @@ let CustomizableUIInternal = {
       if (child.localName != "toolbarbutton") {
         if (child.localName == "toolbaritem") {
           this.ensureButtonContextMenu(child, aPanel);
         }
         continue;
       }
       this.ensureButtonContextMenu(child, aPanel);
       child.setAttribute("tabindex", "0");
-      if (!child.hasAttribute("type")) {
-        child.setAttribute("type", "wrap");
-      }
+      child.setAttribute("wrap", "true");
     }
 
     this.registerBuildArea(CustomizableUI.AREA_PANEL, aPanel);
   },
 
   onWidgetAdded: function(aWidgetId, aArea, aPosition) {
     this.insertNode(aWidgetId, aArea, aPosition, true);
   },
@@ -704,19 +700,17 @@ let CustomizableUIInternal = {
 
       // We remove location attributes here to make sure they're gone too when a
       // widget is removed from a toolbar to the palette. See bug 930950.
       this.removeLocationAttributes(widgetNode);
       if (gPalette.has(aWidgetId) || this.isSpecialWidget(aWidgetId)) {
         container.removeChild(widgetNode);
       } else {
         widgetNode.removeAttribute("tabindex");
-        if (widgetNode.getAttribute("type") == "wrap") {
-          widgetNode.removeAttribute("type");
-        }
+        widgetNode.removeAttribute("wrap");
         areaNode.toolbox.palette.appendChild(widgetNode);
       }
       this.notifyListeners("onWidgetAfterDOMChange", widgetNode, null, container, true);
 
       if (isToolbar) {
         areaNode.setAttribute("currentset", gPlacements.get(aArea).join(','));
       }
 
@@ -856,19 +850,17 @@ let CustomizableUIInternal = {
       return;
     }
 
     let areaId = aAreaNode.id;
     if (isNew) {
       this.ensureButtonContextMenu(widgetNode, aAreaNode);
       if (widgetNode.localName == "toolbarbutton" && areaId == CustomizableUI.AREA_PANEL) {
         widgetNode.setAttribute("tabindex", "0");
-        if (!widgetNode.hasAttribute("type")) {
-          widgetNode.setAttribute("type", "wrap");
-        }
+        widgetNode.setAttribute("wrap", "true");
       }
     }
 
     let container = aAreaNode.customizationTarget;
     let [insertionContainer, nextNode] = this.findInsertionPoints(widgetNode, aNextNodeId, aAreaNode);
     this.insertWidgetBefore(widgetNode, nextNode, insertionContainer, areaId);
 
     if (gAreas.get(areaId).get("type") == CustomizableUI.TYPE_TOOLBAR) {
--- a/browser/components/downloads/content/download.xml
+++ b/browser/components/downloads/content/download.xml
@@ -109,11 +109,13 @@
 
   <binding id="download-toolbarbutton"
            extends="chrome://global/content/bindings/toolbarbutton.xml#toolbarbutton">
     <content>
       <children />
       <xul:image class="toolbarbutton-icon" xbl:inherits="validate,src=image,label"/>
       <xul:label class="toolbarbutton-text" crop="right" flex="1"
                  xbl:inherits="value=label,accesskey,crop"/>
+      <xul:label class="toolbarbutton-multiline-text" flex="1"
+                 xbl:inherits="xbl:text=label,accesskey"/>
     </content>
   </binding>
 </bindings>
--- a/browser/themes/shared/customizableui/panelUIOverlay.inc.css
+++ b/browser/themes/shared/customizableui/panelUIOverlay.inc.css
@@ -63,24 +63,29 @@
   box-shadow: none;
 }
 
 #PanelUI-contents {
   padding: .5em 0;
 }
 
 toolbaritem[cui-areatype="menu-panel"][sdkstylewidget="true"]:not(.panel-wide-item) > .toolbarbutton-text,
-#bookmarks-menu-button > toolbarbutton > .toolbarbutton-text,
-:-moz-any(#PanelUI-contents,#widget-overflow-list) > toolbarpaletteitem > toolbaritem > toolbarbutton > .toolbarbutton-text,
-:-moz-any(#PanelUI-contents,#widget-overflow-list) > toolbaritem > toolbarbutton > .toolbarbutton-text,
-:-moz-any(#PanelUI-contents,#widget-overflow-list) > toolbarpaletteitem > toolbarbutton > .toolbarbutton-text,
-:-moz-any(#PanelUI-contents,#widget-overflow-list) > toolbarbutton > .toolbarbutton-text {
+.panelUI-grid .panel-combined-button > .toolbarbutton-text,
+.widget-overflow-list .toolbarbutton-menubutton-button > .toolbarbutton-text,
+.widget-overflow-list .toolbarbutton-1 > .toolbarbutton-text {
   font-size: @panelTextSize@;
 }
 
+.panelUI-grid .toolbarbutton-menubutton-button > .toolbarbutton-multiline-text,
+.panelUI-grid .toolbarbutton-1 > .toolbarbutton-multiline-text {
+  font-size: @panelTextSize@;
+  margin: 2px 0 0;
+  text-align: center;
+}
+
 #wrapper-edit-controls:-moz-any([place="palette"],[place="panel"]) > #edit-controls,
 #wrapper-zoom-controls:-moz-any([place="palette"],[place="panel"]) > #zoom-controls {
   -moz-margin-start: 0;
 }
 
 #PanelUI-contents,
 .panel-mainview:not([panelid="PanelUI-popup"]) {
   max-width: @menuPanelWidth@;
--- a/toolkit/content/widgets/toolbarbutton.xml
+++ b/toolkit/content/widgets/toolbarbutton.xml
@@ -15,72 +15,67 @@
       <stylesheet src="chrome://global/skin/toolbarbutton.css"/>
     </resources>
     
     <content>
       <children includes="observes|template|menupopup|panel|tooltip"/>
       <xul:image class="toolbarbutton-icon" xbl:inherits="validate,src=image,label"/>
       <xul:label class="toolbarbutton-text" crop="right" flex="1"
                  xbl:inherits="value=label,accesskey,crop"/>
+      <xul:label class="toolbarbutton-multiline-text" flex="1"
+                 xbl:inherits="xbl:text=label,accesskey"/>
     </content>
   </binding>
 
   <binding id="menu" display="xul:menu" 
            extends="chrome://global/content/bindings/toolbarbutton.xml#toolbarbutton">
     <content>
       <children includes="observes|template|menupopup|panel|tooltip"/>
       <xul:image class="toolbarbutton-icon" xbl:inherits="validate,src=image,label,type"/>
       <xul:label class="toolbarbutton-text" crop="right" flex="1"
                  xbl:inherits="value=label,accesskey,crop,dragover-top"/>
+      <xul:label class="toolbarbutton-multiline-text" flex="1"
+                 xbl:inherits="xbl:text=label,accesskey"/>
       <xul:dropmarker type="menu" class="toolbarbutton-menu-dropmarker" xbl:inherits="disabled,label"/>
     </content>
   </binding>
   
   <binding id="menu-vertical" display="xul:menu"
            extends="chrome://global/content/bindings/toolbarbutton.xml#toolbarbutton">
     <content>
       <children includes="observes|template|menupopup|panel|tooltip"/>
       <xul:hbox flex="1" align="center">
         <xul:vbox flex="1" align="center">
           <xul:image class="toolbarbutton-icon" xbl:inherits="validate,src=image,label"/>
           <xul:label class="toolbarbutton-text" crop="right" flex="1"
-                    xbl:inherits="value=label,accesskey,crop,dragover-top"/>
+                     xbl:inherits="value=label,accesskey,crop,dragover-top"/>
+          <xul:label class="toolbarbutton-multiline-text" flex="1"
+                     xbl:inherits="xbl:text=label,accesskey"/>
         </xul:vbox>
         <xul:dropmarker type="menu" class="toolbarbutton-menu-dropmarker" xbl:inherits="disabled,label"/>
       </xul:hbox>
     </content>
   </binding>
   
   <binding id="menu-button" display="xul:menu" 
            extends="chrome://global/content/bindings/button.xml#menu-button-base">
     <resources>
       <stylesheet src="chrome://global/skin/toolbarbutton.css"/>
     </resources>
 
     <content>
       <children includes="observes|template|menupopup|panel|tooltip"/>
       <xul:toolbarbutton class="box-inherit toolbarbutton-menubutton-button"
                          anonid="button" flex="1" allowevents="true"
-                         xbl:inherits="disabled,crop,image,label,accesskey,command,
+                         xbl:inherits="disabled,crop,image,label,accesskey,command,wrap,
                                        align,dir,pack,orient,tooltiptext=buttontooltiptext"/>
       <xul:dropmarker type="menu-button" class="toolbarbutton-menubutton-dropmarker"
                       xbl:inherits="align,dir,pack,orient,disabled,label,open"/>
     </content>
   </binding>
 
   <binding id="toolbarbutton-image"
            extends="chrome://global/content/bindings/toolbarbutton.xml#toolbarbutton">
     <content>
       <xul:image class="toolbarbutton-icon" xbl:inherits="src=image"/>
     </content>
   </binding>
-
-  <binding id="toolbarbutton-wrapping-label"
-           extends="chrome://global/content/bindings/toolbarbutton.xml#toolbarbutton">
-    <content>
-      <children includes="observes|template|menupopup|panel|tooltip"/>
-      <xul:image class="toolbarbutton-icon" xbl:inherits="validate,src=image,label"/>
-      <xul:label class="toolbarbutton-text toolbarbutton-label" flex="1"
-                 xbl:inherits="xbl:text=label,accesskey"/>
-    </content>
-  </binding>
-    
 </bindings>
--- a/toolkit/content/xul.css
+++ b/toolkit/content/xul.css
@@ -152,22 +152,23 @@ toolbarbutton[type="menu"],
 toolbarbutton[type="panel"] {
   -moz-binding: url("chrome://global/content/bindings/toolbarbutton.xml#menu");
 }
 
 toolbarbutton[type="menu-button"] {
   -moz-binding: url("chrome://global/content/bindings/toolbarbutton.xml#menu-button");
 }
 
-toolbarbutton[type="wrap"] {
-  -moz-binding: url("chrome://global/content/bindings/toolbarbutton.xml#toolbarbutton-wrapping-label");
+toolbar[mode="icons"] .toolbarbutton-text,
+toolbar[mode="text"] .toolbarbutton-icon {
+  display: none;
 }
 
-toolbar[mode="icons"] .toolbarbutton-text,
-toolbar[mode="text"] .toolbarbutton-icon {
+toolbarbutton:not([wrap="true"]) > .toolbarbutton-multiline-text,
+toolbarbutton[wrap="true"] > .toolbarbutton-text {
   display: none;
 }
 
 /******** browser, editor, iframe ********/
 
 browser,
 editor,
 iframe {
@@ -689,17 +690,17 @@ label {
   -moz-binding: url("chrome://global/content/bindings/text.xml#text-label");
 }
 
 label.text-link, label[onclick] {
   -moz-binding: url("chrome://global/content/bindings/text.xml#text-link");
   -moz-user-focus: normal;
 }
 
-label[control], label.radio-label, label.checkbox-label, label.toolbarbutton-label {
+label[control], label.radio-label, label.checkbox-label, label.toolbarbutton-multiline-text {
   -moz-binding: url("chrome://global/content/bindings/text.xml#label-control");
 }
 
 html|span.accesskey {
   text-decoration: underline;
 }
 
 /********** textbox **********/