Bug 1317882 - Make sure contextual warning text wraps before we probe for it's height, r=MattN
MozReview-Commit-ID: 9g1FYyH1tsh
--- a/toolkit/content/widgets/autocomplete.xml
+++ b/toolkit/content/widgets/autocomplete.xml
@@ -1505,16 +1505,25 @@ extends="chrome://global/content/binding
xbl:inherits="selected,actiontype">
<xul:description class="ac-text-overflow-container">
<xul:description anonid="action-text"
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 expands when overflow.
+ // We would need to calculate the overflow at the of the construction here.
+ this._handleOverflow();
+ ]]>
+ </constructor>
+ </implementation>
</binding>
<binding id="autocomplete-richlistitem" extends="chrome://global/content/bindings/richlistbox.xml#richlistitem">
<content align="center"
onoverflow="this._onOverflow();"
onunderflow="this._onUnderflow();">
<xul:image anonid="type-icon"
@@ -2250,17 +2259,18 @@ extends="chrome://global/content/binding
}
let typeIconStart = Number(px.substr(0, px.length - 2));
this._typeIcon.style.marginInlineStart = (typeIconStart + delta) + "px";
return delta > 0;
]]>
</body>
</method>
- <!-- This method truncates the displayed strings as necessary. -->
+ <!-- This method calculates the max-width of the text fields,
+ cause the the displayed strings to truncate or wrap as necessary. -->
<method name="_handleOverflow">
<body><![CDATA[
let itemRect = this.parentNode.getBoundingClientRect();
let titleRect = this._titleText.getBoundingClientRect();
let tagsRect = this._tagsText.getBoundingClientRect();
let separatorRect = this._separator.getBoundingClientRect();
let urlRect = this._urlText.getBoundingClientRect();
let actionRect = this._actionText.getBoundingClientRect();