Bug 1325695 - Handle Overflow and OverUnderflow cases when adjusting the height of autocomplete popup.; r?adw draft
authorSean Lee <selee@mozilla.com>
Sat, 24 Dec 2016 06:14:41 +0800
changeset 457827 0fabf8aae5820d90eee8265d90ef3221e1f03400
parent 457446 d192a99be4b436f2dc839435319f7630d5d8f4b0
child 541603 9cc83f2ca81f94c6fa60b6c6af99545d955847c4
push id40909
push userbmo:selee@mozilla.com
push dateTue, 10 Jan 2017 00:35:48 +0000
reviewersadw
bugs1325695
milestone53.0a1
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();"