Bug 1325695 - Handle Overflow and OverUnderflow cases when adjusting the height of autocomplete popup.; r=adw
authorSean Lee <selee@mozilla.com>
Sat, 24 Dec 2016 06:14:41 +0800
changeset 328787 b30209ce54bc18a0590a589e4544bc15cfa2bfc8
parent 328786 a271a9a042013cc1bbb5036f396159aee79df983
child 328788 a38fae269e2790c8031a1527a57b8c3b42e48500
push id85546
push userkwierso@gmail.com
push dateWed, 11 Jan 2017 02:36:30 +0000
treeherdermozilla-inbound@c5bce4cd684a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersadw
bugs1325695
milestone53.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 1325695 - Handle Overflow and OverUnderflow cases when adjusting the height of autocomplete popup.; r=adw MozReview-Commit-ID: 2U0di120coT
toolkit/content/widgets/autocomplete.xml
--- a/toolkit/content/widgets/autocomplete.xml
+++ b/toolkit/content/widgets/autocomplete.xml
@@ -1245,16 +1245,25 @@ extends="chrome://global/content/binding
             if (numRows > this.maxRows) {
               // Set a fixed max-height to avoid flicker when growing the panel.
               let lastVisibleRowRect = rows[this.maxRows - 1].getBoundingClientRect();
               let visibleHeight = lastVisibleRowRect.bottom - firstRowRect.top;
               this.richlistbox.style.maxHeight =
                 visibleHeight + this._rlbPadding + "px";
             }
 
+            // The class `forceHandleUnderflow` is for the item might need to
+            // handle OverUnderflow or Overflow when the height of an item will
+            // be changed dynamically.
+            for (let i = 0; i < numRows; i++) {
+              if (rows[i].classList.contains("forceHandleUnderflow")) {
+                rows[i].handleOverUnderflow();
+              }
+            }
+
             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 animate = this._rlbAnimated &&
                         this.getAttribute("dontanimate") != "true";
@@ -1506,18 +1515,19 @@ extends="chrome://global/content/binding
                            class="ac-action-text"
                            xbl:inherits="selected"/>
         </xul:description>
       </xul:hbox>
     </content>
     <implementation>
       <constructor><![CDATA[
         // Unlike other autocomplete items, the height of the insecure warning
-        // increases by wrapping.
-        this._handleOverflow();
+        // increases by wrapping. So "forceHandleUnderflow" is for container to
+        // recalculate an item's height and width.
+        this.classList.add("forceHandleUnderflow");
       ]]></constructor>
     </implementation>
   </binding>
 
   <binding id="autocomplete-richlistitem" extends="chrome://global/content/bindings/richlistbox.xml#richlistitem">
 
     <content align="center"
              onoverflow="this._onOverflow();"