Bug 1037859 - Applications tree column and children is not aligned draft
authorFischer.json <fischer.json@gmail.com>
Tue, 06 Sep 2016 17:34:30 +0800
changeset 410203 a02efd1ec1a477c49c9c79cb8f6efdd0b869ee67
parent 410066 8c9c4e816e86f903c1d820f3f29715dc070a5a4a
child 530522 ea58dbfaa3187818202f283bbb56cabc1a33b427
push id28673
push userbmo:fliu@mozilla.com
push dateTue, 06 Sep 2016 11:24:36 +0000
bugs1037859
milestone51.0a1
Bug 1037859 - Applications tree column and children is not aligned MozReview-Commit-ID: 12R1OW6Wric
browser/components/preferences/in-content/applications.js
browser/components/preferences/in-content/applications.xul
--- a/browser/components/preferences/in-content/applications.js
+++ b/browser/components/preferences/in-content/applications.js
@@ -1179,33 +1179,37 @@ var gApplicationsPane = {
       this._list.removeChild(this._list.lastChild);
 
     var visibleTypes = this._visibleTypes;
 
     // If the user is filtering the list, then only show matching types.
     if (this._filter.value)
       visibleTypes = visibleTypes.filter(this._matchesFilter, this);
 
+    let item;
     for (let visibleType of visibleTypes) {
-      let item = document.createElement("richlistitem");
+      item = document.createElement("richlistitem");
       item.setAttribute("type", visibleType.type);
       item.setAttribute("typeDescription", this._describeType(visibleType));
       if (visibleType.smallIcon)
         item.setAttribute("typeIcon", visibleType.smallIcon);
       item.setAttribute("actionDescription",
                         this._describePreferredAction(visibleType));
 
       if (!this._setIconClassForPreferredAction(visibleType, item)) {
         item.setAttribute("actionIcon",
                           this._getIconURLForPreferredAction(visibleType));
       }
 
       this._list.appendChild(item);
     }
 
+    item = gApplicationsPane._list.querySelector("richlistitem");
+    this._list.querySelector("#typeColumn").style.width = item.getBoundingClientRect().width / 2 + "px";
+
     this._selectLastSelectedType();
   },
 
   _matchesFilter: function(aType) {
     var filterValue = this._filter.value.toLowerCase();
     return this._describeType(aType).toLowerCase().indexOf(filterValue) != -1 ||
            this._describePreferredAction(aType).toLowerCase().indexOf(filterValue) != -1;
   },
--- a/browser/components/preferences/in-content/applications.xul
+++ b/browser/components/preferences/in-content/applications.xul
@@ -80,16 +80,14 @@
 
   <separator class="thin"/>
 
   <richlistbox id="handlersView" orient="vertical" persist="lastSelectedType"
                preference="pref.downloads.disable_button.edit_actions"
                flex="1">
     <listheader equalsize="always">
         <treecol id="typeColumn" label="&typeColumn.label;" value="type"
-                 accesskey="&typeColumn.accesskey;" persist="sortDirection"
-                 flex="1" sortDirection="ascending"/>
+                 accesskey="&typeColumn.accesskey;" persist="sortDirection" sortDirection="ascending"/>
         <treecol id="actionColumn" label="&actionColumn2.label;" value="action"
-                 accesskey="&actionColumn2.accesskey;" persist="sortDirection"
-                 flex="1"/>
+                 accesskey="&actionColumn2.accesskey;" persist="sortDirection" flex="1" />
     </listheader>
   </richlistbox>
 </vbox>