Bug 1325695 - Handle Overflow and OverUnderflow cases when adjusting the height of autocomplete popup.; r=adw a=jcristau
authorSean Lee <selee@mozilla.com>
Sat, 24 Dec 2016 06:14:41 +0800
changeset 368753 086c474cfefbe660922ce3d588dea7213559b24a
parent 368752 dc33d7851ba557007fc49819d80320f9bf9f613e
child 368754 2d482631e0f14763a95ab18680d154cd267b775b
push id1369
push userjlorenzo@mozilla.com
push dateMon, 27 Feb 2017 14:59:41 +0000
treeherdermozilla-release@d75a1dba431f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersadw, jcristau
bugs1325695
milestone52.0a2
Bug 1325695 - Handle Overflow and OverUnderflow cases when adjusting the height of autocomplete popup.; r=adw a=jcristau 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";
@@ -1508,18 +1517,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();"