Bug 1311189 - Put back the separator between form history and datalist entries in the autocomplete popup. r?MattN draft
authorMike Conley <mconley@mozilla.com>
Wed, 19 Oct 2016 13:55:06 -0400
changeset 429299 bfcf9a6b00e24d29204060f1fe6571fd99f43969
parent 429179 c6ccd71126ff514bfc44b53e2217562e29a0cc38
child 429315 6f307263bb848c511494f6a8b07ad9c0ea9d02c0
push id33528
push usermconley@mozilla.com
push dateTue, 25 Oct 2016 15:57:04 +0000
reviewersMattN
bugs1311189
milestone52.0a1
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) {