Bug 1313067 - Make extra padding in autocomplete popup richlistitem opt-in. r?mak
MozReview-Commit-ID: 1nTKHSQzy7b
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -152,17 +152,18 @@
<panel type="autocomplete" id="PopupSearchAutoComplete" noautofocus="true" hidden="true"/>
<!-- for url bar autocomplete -->
<panel type="autocomplete-richlistbox"
id="PopupAutoCompleteRichResult"
noautofocus="true"
hidden="true"
flip="none"
- level="parent"/>
+ level="parent"
+ overflowpadding="30" />
<panel id="DateTimePickerPanel"
type="arrow"
hidden="true"
orient="vertical"
noautofocus="true"
consumeoutsideclicks="false"
level="parent">
--- a/toolkit/content/widgets/autocomplete.xml
+++ b/toolkit/content/widgets/autocomplete.xml
@@ -1402,16 +1402,20 @@ extends="chrome://global/content/binding
}
}
}
return val;
]]>
</setter>
</property>
+ <property name="overflowPadding"
+ onget="return Number(this.getAttribute('overflowpadding'))"
+ readonly="true" />
+
<method name="selectBy">
<parameter name="aReverse"/>
<parameter name="aPage"/>
<body>
<![CDATA[
try {
var amount = aPage ? 5 : 1;
@@ -2194,24 +2198,25 @@ extends="chrome://global/content/binding
let tagsRect = this._tagsText.getBoundingClientRect();
let separatorRect = this._separator.getBoundingClientRect();
let urlRect = this._urlText.getBoundingClientRect();
let actionRect = this._actionText.getBoundingClientRect();
let separatorURLActionWidth =
separatorRect.width + Math.max(urlRect.width, actionRect.width);
// Total width for the title and URL/action is the width of the item
- // minus the start of the title text minus a little extra padding.
+ // minus the start of the title text minus a little optional extra padding.
// This extra padding amount is basically arbitrary but keeps the text
// from getting too close to the popup's edge.
- let extraPadding = 30;
let dir = this.getAttribute("dir");
let titleStart = dir == "rtl" ? itemRect.right - titleRect.right
: titleRect.left - itemRect.left;
- let itemWidth = itemRect.width - titleStart - extraPadding;
+
+ let popup = this.parentNode.parentNode;
+ let itemWidth = itemRect.width - titleStart - popup.overflowPadding;
if (this._tags.hasAttribute("empty")) {
// The tags box is not displayed in this case.
tagsRect.width = 0;
}
let titleTagsWidth = titleRect.width + tagsRect.width;
if (titleTagsWidth + separatorURLActionWidth > itemWidth) {