Bug 1311189 - Put back the separator between form history and datalist entries in the autocomplete popup. r=MattN
authorMike Conley <mconley@mozilla.com>
Wed, 19 Oct 2016 13:55:06 -0400
changeset 319317 e3f252dc20b5339465ffd54e74b380abf71bc4eb
parent 319316 7bc2c36d07d4aaac8cbc5384f50b3beb4f27c66e
child 319318 7854c40a579705adb28c70eb2f5466d0e8e02a32
push id30869
push userphilringnalda@gmail.com
push dateWed, 26 Oct 2016 04:57:48 +0000
treeherdermozilla-central@9471b3c49b2c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN
bugs1311189
milestone52.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1311189 - Put back the separator between form history and datalist entries in the autocomplete popup. r=MattN MozReview-Commit-ID: 2lRauTr9EQA
browser/themes/linux/browser.css
browser/themes/osx/browser.css
browser/themes/shared/autocomplete.inc.css
browser/themes/windows/browser.css
toolkit/components/satchel/nsFormAutoComplete.js
toolkit/components/satchel/nsFormAutoCompleteResult.jsm
--- a/browser/themes/linux/browser.css
+++ b/browser/themes/linux/browser.css
@@ -913,16 +913,20 @@ notification[value="translation"] button
 notification[value="translation"] menulist > .menulist-dropmarker {
   display: block;
 }
 
 /* AutoComplete */
 
 %include ../shared/autocomplete.inc.css
 
+#PopupAutoComplete > richlistbox > richlistitem[originaltype~="datalist-first"] {
+  border-top: 1px solid ThreeDShadow;
+}
+
 #treecolAutoCompleteImage {
   max-width : 36px;
 }
 
 .autocomplete-richlistbox {
   padding: 4px;
 }
 
--- a/browser/themes/osx/browser.css
+++ b/browser/themes/osx/browser.css
@@ -1747,16 +1747,20 @@ toolbar .toolbarbutton-1 > .toolbarbutto
 }
 
 %include ../shared/urlbarSearchSuggestionsNotification.inc.css
 
 /* ----- AUTOCOMPLETE ----- */
 
 %include ../shared/autocomplete.inc.css
 
+#PopupAutoComplete > richlistbox > richlistitem[originaltype~="datalist-first"] {
+  border-top: 1px solid #C7C7C7;
+}
+
 #treecolAutoCompleteImage {
   max-width: 36px;
 }
 
 .autocomplete-richlistbox {
   padding: 4px;
 }
 
--- a/browser/themes/shared/autocomplete.inc.css
+++ b/browser/themes/shared/autocomplete.inc.css
@@ -2,17 +2,19 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 %endif
 
 #PopupAutoComplete > richlistbox > richlistitem {
   height: 20px;
   min-height: 20px;
+  border: 0;
   border-radius: 0;
+  padding: 0px 1px 0px 1px;
 }
 
 #PopupAutoComplete > richlistbox > richlistitem > .ac-title {
   font: icon;
   margin-inline-start: 6px;
 }
 
 #PopupAutoComplete > richlistbox {
--- a/browser/themes/windows/browser.css
+++ b/browser/themes/windows/browser.css
@@ -1529,16 +1529,20 @@ html|*.urlbar-input:-moz-lwtheme::placeh
 /* page proxy icon */
 
 %include ../shared/identity-block/identity-block.inc.css
 
 /* autocomplete */
 
 %include ../shared/autocomplete.inc.css
 
+#PopupAutoComplete > richlistbox > richlistitem[originaltype~="datalist-first"] {
+  border-top: 1px solid ThreeDShadow;
+}
+
 #treecolAutoCompleteImage {
   max-width: 36px;
 }
 
 .autocomplete-richlistbox {
   padding: 4px;
 }
 
--- a/toolkit/components/satchel/nsFormAutoComplete.js
+++ b/toolkit/components/satchel/nsFormAutoComplete.js
@@ -445,22 +445,16 @@ FormAutoComplete.prototype = {
         let comments = new Array(values.length).fill("");
 
         // historyResult will be null if form autocomplete is disabled. We
         // still want the list values to display.
         let entries = historyResult.wrappedJSObject.entries;
         let historyResults = entries.map(entry => entry.text);
         let historyComments = new Array(entries.length).fill("");
 
-        // fill out the comment column for the suggestions
-        // if we have any suggestions, put a label at the top
-        if (values.length) {
-            comments[0] = "separator";
-        }
-
         // now put the history results above the datalist suggestions
         let finalValues = historyResults.concat(values);
         let finalLabels = historyResults.concat(labels);
         let finalComments = historyComments.concat(comments);
 
         // This is ugly: there are two FormAutoCompleteResult classes in the
         // tree, one in a module and one in this file. Datalist results need to
         // use the one defined in the module but the rest of this file assumes
--- a/toolkit/components/satchel/nsFormAutoCompleteResult.jsm
+++ b/toolkit/components/satchel/nsFormAutoCompleteResult.jsm
@@ -130,25 +130,23 @@ FormAutoCompleteResult.prototype = {
    */
   getStyleAt: function(index) {
     this._checkIndexBounds(index);
 
     if (this._formHistResult && index < this._formHistResult.matchCount) {
       return "fromhistory";
     }
 
-    if (!this._comments[index]) {
-      return null;  // not a category label, so no special styling
+    if (this._formHistResult &&
+        this._formHistResult.matchCount > 0 &&
+        index == this._formHistResult.matchCount) {
+      return "datalist-first";
     }
 
-    if (index == 0) {
-      return "suggestfirst";  // category label on first line of results
-    }
-
-    return "suggesthint";   // category label on any other line of results
+    return null;
   },
 
   /**
    * Retrieves an image url.
    * @param  index    the index of the image url requested
    * @return          the image url at the specified index
    */
   getImageAt: function(index) {