Bug 1383707 - Temporarily increase the maxRows for form autofill results in order not to show scrollbar in the popup. r=MattN draft
authorRay Lin <ralin@mozilla.com>
Wed, 26 Jul 2017 15:17:02 +0800
changeset 615672 56813b767fff6955955ddf69b1457911f10f4bf9
parent 615671 b0e1861cdc8879a5ba8b81eb0ca724d0c2c5cec9
child 639238 6c9f8a7ba31c4d286643d78aa0609612325dc9f2
push id70430
push userbmo:ralin@mozilla.com
push dateWed, 26 Jul 2017 07:19:31 +0000
reviewersMattN
bugs1383707
milestone56.0a1
Bug 1383707 - Temporarily increase the maxRows for form autofill results in order not to show scrollbar in the popup. r=MattN MozReview-Commit-ID: 7Fjt7T90GIJ
toolkit/components/satchel/AutoCompletePopup.jsm
--- a/toolkit/components/satchel/AutoCompletePopup.jsm
+++ b/toolkit/components/satchel/AutoCompletePopup.jsm
@@ -147,32 +147,39 @@ this.AutoCompletePopup = {
     let window = browser.ownerGlobal;
     // Also check window top in case this is a sidebar.
     if (Services.focus.activeWindow !== window.top) {
       // We were sent a message from a window or tab that went into the
       // background, so we'll ignore it for now.
       return;
     }
 
+    let firtResultStyle = results[0].style;
     this.weakBrowser = Cu.getWeakReference(browser);
     this.openedPopup = browser.autoCompletePopup;
     // the layout varies according to different result type
-    this.openedPopup.setAttribute("firstresultstyle", results[0].style);
+    this.openedPopup.setAttribute("firstresultstyle", firtResultStyle);
     this.openedPopup.hidden = false;
     // don't allow the popup to become overly narrow
     this.openedPopup.setAttribute("width", Math.max(100, rect.width));
     this.openedPopup.style.direction = dir;
 
     AutoCompleteResultView.setResults(results);
     this.openedPopup.view = AutoCompleteResultView;
     this.openedPopup.selectedIndex = -1;
 
     if (results.length) {
       // Reset fields that were set from the last time the search popup was open
       this.openedPopup.mInput = AutoCompleteResultView;
+      // Temporarily increase the maxRows as we don't want to show
+      // the scrollbar in form autofill popup.
+      if (firtResultStyle == "autofill-profile") {
+        this.openedPopup._normalMaxRows = this.openedPopup.maxRows;
+        this.openedPopup.mInput.maxRows = 100;
+      }
       this.openedPopup.showCommentColumn = false;
       this.openedPopup.showImageColumn = false;
       this.openedPopup.addEventListener("popuphidden", this);
       this.openedPopup.addEventListener("popupshowing", this);
       this.openedPopup.openPopupAtScreenRect("after_start", rect.left, rect.top,
                                              rect.width, rect.height, false,
                                              false);
       this.openedPopup.invalidate();