Bug 1652720 - fix extra login autocomplete items;r=mak
authorSeverin <srudie@mozilla.com>
Thu, 23 Jul 2020 18:20:37 +0000
changeset 541815 b1aa825d8c531f81f8945ab5a5da290987a22ccc
parent 541814 f8e83f5b68e0e151df25cf6021fc3ab985a6a012
child 541816 e36facc5b1f4989d63a6efc97cf69e84a0abded1
push id37633
push userccoroiu@mozilla.com
push dateFri, 24 Jul 2020 09:32:06 +0000
treeherdermozilla-central@141543043270 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs1652720
milestone80.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1652720 - fix extra login autocomplete items;r=mak Root cause: `currentHeight` is returning a smaller than expected number, because it does not include anything below a scroll bar, and by this point the popup has not expanded to fit its contents. This problem is mitigated in existing login autofill code because LoginAutoComplete emits popup opened/closed events, which cause this to be called with `height === 0`, thus collapsing all items. Since _collapseUnusedItems only affects items beyond the match count, I do not anticipate this producing any extra work from a performance perspective. Differential Revision: https://phabricator.services.mozilla.com/D84632
toolkit/content/widgets/autocomplete-popup.js
--- a/toolkit/content/widgets/autocomplete-popup.js
+++ b/toolkit/content/widgets/autocomplete-popup.js
@@ -341,20 +341,18 @@
           }
         }
 
         let lastRowRect = rows[numRows - 1].getBoundingClientRect();
         // Calculate the height to have the first row to last row shown
         height = lastRowRect.bottom - firstRowRect.top + this._rlbPadding;
       }
 
-      let currentHeight = this.richlistbox.getBoundingClientRect().height;
-      if (height <= currentHeight) {
-        this._collapseUnusedItems();
-      }
+      this._collapseUnusedItems();
+
       this.richlistbox.style.removeProperty("height");
       // We need to get the ceiling of the calculated value to ensure that the box fully contains
       // all of its contents and doesn't cause a scrollbar since nsIBoxObject only expects a
       // `long`. e.g. if `height` is 99.5 the richlistbox would render at height 99px with a
       // scrollbar for the extra 0.5px.
       this.richlistbox.height = Math.ceil(height);
     }