Bug 1313067 - Make extra padding in autocomplete popup richlistitem opt-in. r?mak draft
authorMike Conley <mconley@mozilla.com>
Fri, 28 Oct 2016 13:11:30 -0400
changeset 433351 9cf45c70ab46c9e7976f239a8961ff728dd53a84
parent 432738 3bfde35a0d18a643485ffd5073f3bc6a79e0ae48
child 535867 cd0107a2b0997f9a8f79943f9ba9b01a03a4cb10
push id34555
push usermconley@mozilla.com
push dateThu, 03 Nov 2016 15:49:54 +0000
reviewersmak
bugs1313067
milestone52.0a1
Bug 1313067 - Make extra padding in autocomplete popup richlistitem opt-in. r?mak MozReview-Commit-ID: 1nTKHSQzy7b
browser/base/content/browser.xul
toolkit/content/widgets/autocomplete.xml
--- 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) {