Bug 1325695 - Handle Overflow and OverUnderflow cases when adjusting the height of autocomplete popup.; r?adw
MozReview-Commit-ID: 2U0di120coT
--- 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();"