Bug 1195054 - The location bar should displays 10 autocomplete suggestions without scrollbar instead of 6. r?mak draft
authorDrew Willcoxon <adw@mozilla.com>
Thu, 07 Apr 2016 11:21:30 -0700
changeset 348543 8c75daafd6f17deadbad8b51bdc11e38fc1b5b4d
parent 347957 061165ac1ff9e076ec51ea268878efa751173511
child 348549 4c3893bb7d6a4ef356d60fcac5a9a970a912d076
push id14844
push userdwillcoxon@mozilla.com
push dateThu, 07 Apr 2016 18:21:43 +0000
reviewersmak
bugs1195054
milestone48.0a1
Bug 1195054 - The location bar should displays 10 autocomplete suggestions without scrollbar instead of 6. r?mak MozReview-Commit-ID: D6rXRg3WrZo
browser/app/profile/firefox.js
browser/base/content/browser.xul
browser/base/content/test/general/browser_autocomplete_autoselect.js
toolkit/components/places/UnifiedComplete.js
toolkit/content/widgets/autocomplete.xml
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -299,17 +299,17 @@ pref("browser.urlbar.unifiedcomplete", t
 // 0: Match anywhere (e.g., middle of words)
 // 1: Match on word boundaries and then try matching anywhere
 // 2: Match only on word boundaries (e.g., after / or .)
 // 3: Match at the beginning of the url or title
 pref("browser.urlbar.matchBehavior", 1);
 pref("browser.urlbar.filter.javascript", true);
 
 // the maximum number of results to show in autocomplete when doing richResults
-pref("browser.urlbar.maxRichResults", 12);
+pref("browser.urlbar.maxRichResults", 10);
 // The amount of time (ms) to wait after the user has stopped typing
 // before starting to perform autocomplete.  50 is the default set in
 // autocomplete.xml.
 pref("browser.urlbar.delay", 50);
 
 // The special characters below can be typed into the urlbar to either restrict
 // the search to visited history, bookmarked, tagged pages; or force a match on
 // just the title text or url.
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -693,17 +693,16 @@
                      autocompletesearchparam="enable-actions"
                      autocompletepopup="PopupAutoCompleteRichResult"
                      completeselectedindex="true"
                      shrinkdelay="250"
                      tabscrolling="true"
                      showcommentcolumn="true"
                      showimagecolumn="true"
                      enablehistory="true"
-                     maxrows="6"
                      newlines="stripsurroundingwhitespace"
                      ontextentered="this.handleCommand(param);"
                      ontextreverted="return this.handleRevert();"
                      pageproxystate="invalid"
                      onfocus="document.getElementById('identity-box').style.MozUserFocus= 'normal'"
                      onblur="setTimeout(() => { document.getElementById('identity-box').style.MozUserFocus = ''; }, 0);">
               <box id="notification-popup-box" hidden="true" align="center">
                 <image id="default-notification-icon" class="notification-anchor-icon" role="button"
--- a/browser/base/content/test/general/browser_autocomplete_autoselect.js
+++ b/browser/base/content/test/general/browser_autocomplete_autoselect.js
@@ -29,36 +29,35 @@ add_task(function*() {
   yield PlacesTestUtils.addVisits(visits);
 
   let tab = gBrowser.selectedTab = gBrowser.addTab("about:mozilla", {animate: false});
   yield promiseTabLoaded(tab);
   yield promiseAutocompleteResultPopup("example.com/autocomplete");
 
   let popup = gURLBar.popup;
   let results = popup.richlistbox.children;
-  // 1 extra for the current search engine match
-  is(results.length, 11, "Should get 11 results");
+  is(results.length, 10, "Should get 10 results");
   is_selected(0);
 
   info("Key Down to select the next item");
   EventUtils.synthesizeKey("VK_DOWN", {});
   is_selected(1);
 
-  info("Key Down 11 times should wrap around all the way around");
-  repeat(11, () => EventUtils.synthesizeKey("VK_DOWN", {}));
+  info("Key Down 10 times should wrap around all the way around");
+  repeat(10, () => EventUtils.synthesizeKey("VK_DOWN", {}));
   is_selected(1);
 
-  info("Key Up 11 times should wrap around the other way");
-  repeat(11, () => EventUtils.synthesizeKey("VK_UP", {}));
+  info("Key Up 10 times should wrap around the other way");
+  repeat(10, () => EventUtils.synthesizeKey("VK_UP", {}));
   is_selected(1);
 
   info("Page Up will go up the list, but not wrap");
   EventUtils.synthesizeKey("VK_PAGE_UP", {})
   is_selected(0);
 
   info("Page Up again will wrap around to the end of the list");
   EventUtils.synthesizeKey("VK_PAGE_UP", {})
-  is_selected(10);
+  is_selected(9);
 
   EventUtils.synthesizeKey("VK_ESCAPE", {});
   yield promisePopupHidden(gURLBar.popup);
   gBrowser.removeTab(tab);
 });
--- a/toolkit/components/places/UnifiedComplete.js
+++ b/toolkit/components/places/UnifiedComplete.js
@@ -56,17 +56,17 @@ const QUERYTYPE_AUTOFILL_URL        = 2;
 
 // This separator is used as an RTL-friendly way to split the title and tags.
 // It can also be used by an nsIAutoCompleteResult consumer to re-split the
 // "comment" back into the title and the tag.
 const TITLE_TAGS_SEPARATOR = " \u2013 ";
 
 // Telemetry probes.
 const TELEMETRY_1ST_RESULT = "PLACES_AUTOCOMPLETE_1ST_RESULT_TIME_MS";
-const TELEMETRY_6_FIRST_RESULTS = "PLACES_AUTOCOMPLETE_6_FIRST_RESULTS_TIME_MS";
+const TELEMETRY_10_FIRST_RESULTS = "PLACES_AUTOCOMPLETE_10_FIRST_RESULTS_TIME_MS";
 // The default frecency value used when inserting matches with unknown frecency.
 const FRECENCY_DEFAULT = 1000;
 
 // Remote matches are appended when local matches are below a given frecency
 // threshold (FRECENCY_DEFAULT) as soon as they arrive.  However we'll
 // always try to have at least MINIMUM_LOCAL_MATCHES local matches.
 const MINIMUM_LOCAL_MATCHES = 6;
 
@@ -848,17 +848,17 @@ Search.prototype = {
    */
   execute: Task.async(function* (conn) {
     // A search might be canceled before it starts.
     if (!this.pending)
       return;
 
     TelemetryStopwatch.start(TELEMETRY_1ST_RESULT, this);
     if (this._searchString)
-      TelemetryStopwatch.start(TELEMETRY_6_FIRST_RESULTS, this);
+      TelemetryStopwatch.start(TELEMETRY_10_FIRST_RESULTS, this);
 
     // Since we call the synchronous parseSubmissionURL function later, we must
     // wait for the initialization of PlacesSearchAutocompleteProvider first.
     yield PlacesSearchAutocompleteProvider.ensureInitialized();
     if (!this.pending)
       return;
 
     // For any given search, we run many queries/heuristics:
@@ -1432,18 +1432,19 @@ Search.prototype = {
 
     this._result.insertMatchAt(this._getInsertIndexForMatch(match),
                                match.value,
                                match.comment,
                                match.icon,
                                match.style,
                                match.finalCompleteValue);
 
-    if (this._result.matchCount == 6)
-      TelemetryStopwatch.finish(TELEMETRY_6_FIRST_RESULTS, this);
+    if (this._result.matchCount == 10) {
+      TelemetryStopwatch.finish(TELEMETRY_10_FIRST_RESULTS, this);
+    }
 
     this.notifyResults(true);
   },
 
   _getInsertIndexForMatch(match) {
     let index = 0;
     if (match.remote) {
       // Append after local matches.
@@ -1952,17 +1953,17 @@ UnifiedComplete.prototype = {
    * Properly cleans up when searching is completed.
    *
    * @param notify [optional]
    *        Indicates if we should notify the AutoComplete listener about our
    *        results or not.
    */
   finishSearch: function (notify=false) {
     TelemetryStopwatch.cancel(TELEMETRY_1ST_RESULT, this);
-    TelemetryStopwatch.cancel(TELEMETRY_6_FIRST_RESULTS, this);
+    TelemetryStopwatch.cancel(TELEMETRY_10_FIRST_RESULTS, this);
     // Clear state now to avoid race conditions, see below.
     let search = this._currentSearch;
     this._lastLowResultsSearchSuggestion = search._lastLowResultsSearchSuggestion;
     delete this._currentSearch;
 
     if (!notify)
       return;
 
--- a/toolkit/content/widgets/autocomplete.xml
+++ b/toolkit/content/widgets/autocomplete.xml
@@ -892,17 +892,17 @@ extends="chrome://global/content/binding
           }
         ]]>
         </body>
       </method>
 
       <!-- This is the default number of rows that we give the autocomplete
            popup when the textbox doesn't have a "maxrows" attribute
            for us to use. -->
-      <field name="defaultMaxRows" readonly="true">6</field>
+      <field name="defaultMaxRows" readonly="true">10</field>
 
       <!-- In some cases (e.g. when the input's dropmarker button is clicked),
            the input wants to display a popup with more rows. In that case, it
            should increase its maxRows property and store the "normal" maxRows
            in this field. When the popup is hidden, we restore the input's
            maxRows to the value stored in this field.
 
            This field is set to -1 between uses so that we can tell when it's