Bug 1400117 - Initialize Application handlers after pageshow to avoid delaying painting of Preferences page r?jaws,florian draft
authorRicky Chien <ricky060709@gmail.com>
Fri, 15 Sep 2017 12:06:08 +0800
changeset 666617 f2d01e228df4a06af47ca104d26d1e71f0e75046
parent 666127 ae39864562c6048fdc2950c5dfedb48e247c3300
child 732168 9785af3a6b335a69f4eac54043dee89aff41de9d
push id80473
push userbmo:rchien@mozilla.com
push dateTue, 19 Sep 2017 01:58:40 +0000
reviewersjaws, florian
bugs1400117
milestone57.0a1
Bug 1400117 - Initialize Application handlers after pageshow to avoid delaying painting of Preferences page r?jaws,florian MozReview-Commit-ID: Cla3vz3YF38
browser/components/preferences/in-content/main.js
browser/themes/shared/incontentprefs/preferences.inc.css
--- a/browser/components/preferences/in-content/main.js
+++ b/browser/components/preferences/in-content/main.js
@@ -431,29 +431,24 @@ var gMainPane = {
       // from the xul file was used.  If we are sorting on the other
       // column, we should remove it.
       document.getElementById("typeColumn").removeAttribute("sortDirection");
     } else {
       this._sortColumn = document.getElementById("typeColumn");
     }
 
     // Load the data and build the list of handlers.
-    // By doing this in a timeout, we let the preferences dialog resize itself
-    // to an appropriate size before we add a bunch of items to the list.
-    // Otherwise, if there are many items, and the Applications prefpane
-    // is the one that gets displayed when the user first opens the dialog,
-    // the dialog might stretch too much in an attempt to fit them all in.
-    // XXX Shouldn't we perhaps just set a max-height on the richlistbox?
-    var _delayedPaneLoad = function(self) {
-      self._loadData();
-      self._rebuildVisibleTypes();
-      self._sortVisibleTypes();
-      self._rebuildView();
-    }
-    setTimeout(_delayedPaneLoad, 0, this);
+    // By doing this after pageshow, we ensure it doesn't delay painting
+    // of the preferences page.
+    window.addEventListener("pageshow", () => {
+      this._loadData();
+      this._rebuildVisibleTypes();
+      this._sortVisibleTypes();
+      this._rebuildView();
+    });
 
     let browserBundle = document.getElementById("browserBundle");
     appendSearchKeywords("browserContainersSettings", [
       browserBundle.getString("userContextPersonal.label"),
       browserBundle.getString("userContextWork.label"),
       browserBundle.getString("userContextBanking.label"),
       browserBundle.getString("userContextShopping.label"),
     ]);
--- a/browser/themes/shared/incontentprefs/preferences.inc.css
+++ b/browser/themes/shared/incontentprefs/preferences.inc.css
@@ -218,17 +218,24 @@ separator.thin:not([orient="vertical"]) 
 }
 
 #handlersView {
   height: 25em;
   margin-inline-end: 0;
 }
 
 #handlersView > richlistitem {
-  min-height: 36px !important;
+  min-height: 30px !important;
+}
+
+#handlersView > richlistitem > hbox > hbox > menulist {
+  margin-top: 0;
+  margin-bottom: 0;
+  margin-inline-end: 0;
+  min-height: 0;
 }
 
 .typeIcon {
   margin-inline-start: 10px !important;
   margin-inline-end: 9px !important;
 }
 
 .actionIcon {