Bug 1402178 - Address bar title and urls get cropped at strange places when matches are reused. r=adw

MozReview-Commit-ID: 9chh6RiHu8n

--HG--
extra : rebase_source : 7c996f8b4cf82fca938207d3232b69e098b5466e
This commit is contained in:
Marco Bonardo 2017-09-22 18:33:30 +02:00
parent fd2dae9a66
commit 32f9f91e09

View File

@ -2139,12 +2139,6 @@ extends="chrome://global/content/bindings/popup.xml#popup">
this.setAttribute("text", this.getAttribute("ac-text"));
let popup = this.parentNode.parentNode;
if (!popup.popupOpen) {
// Removing the max-width and resetting it later when overflow is
// handled is jarring when the item is visible, so skip this when
// the popup is open.
this._removeMaxWidths();
}
let title = this.getAttribute("title");
let titleLooksLikeUrl = false;
@ -2356,7 +2350,15 @@ extends="chrome://global/content/bindings/popup.xml#popup">
}
this._setUpDescription(this._urlText, displayUrl, !emphasiseUrl);
if (this._inOverflow) {
// Removing the max-width may be jarring when the item is visible, but
// we have no other choice to properly crop the text.
// Removing max-widths may cause overflow or underflow events, that
// will set the _inOverflow property. In case both the old and the new
// text are overflowing, the overflow event won't happen, and we must
// enforce an _handleOverflow() call to update the max-widths.
let wasInOverflow = this._inOverflow;
this._removeMaxWidths();
if (wasInOverflow && this._inOverflow) {
this._handleOverflow();
}
]]>
@ -2366,10 +2368,13 @@ extends="chrome://global/content/bindings/popup.xml#popup">
<method name="_removeMaxWidths">
<body>
<![CDATA[
this._titleText.style.removeProperty("max-width");
this._tagsText.style.removeProperty("max-width");
this._urlText.style.removeProperty("max-width");
this._actionText.style.removeProperty("max-width");
if (this._hasMaxWidths) {
this._titleText.style.removeProperty("max-width");
this._tagsText.style.removeProperty("max-width");
this._urlText.style.removeProperty("max-width");
this._actionText.style.removeProperty("max-width");
this._hasMaxWidths = false;
}
]]>
</body>
</method>
@ -2475,6 +2480,7 @@ extends="chrome://global/content/bindings/popup.xml#popup">
urlActionMaxWidth -= separatorRect.width;
this._urlText.style.maxWidth = urlActionMaxWidth + "px";
this._actionText.style.maxWidth = urlActionMaxWidth + "px";
this._hasMaxWidths = true;
}
]]></body>
</method>