Bug 1480541 - Remove em-dash from search string dropdown text when the search query is empty. r=mak
authorDrew Willcoxon <adw@mozilla.com>
Wed, 08 Aug 2018 19:52:59 +0000
changeset 430571 36642e9b970a0fd70fe765485195f8a1c556d4e7
parent 430570 9d267b4bd26889fe936dff2c7b05d3b9415ccb44
child 430572 6344fa18f0ce42e42bfb507827e032f6f146aaf5
push id34409
push usertoros@mozilla.com
push dateThu, 09 Aug 2018 10:00:05 +0000
treeherdermozilla-central@eb9ff7de69ef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs1480541
milestone63.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 1480541 - Remove em-dash from search string dropdown text when the search query is empty. r=mak Differential Revision: https://phabricator.services.mozilla.com/D2898
browser/base/content/browser.css
toolkit/content/widgets/autocomplete.xml
--- a/browser/base/content/browser.css
+++ b/browser/base/content/browser.css
@@ -648,16 +648,25 @@ html|input.urlbar-input[textoverflow="st
 }
 
 /* Only show the "Search with" label on hover or selection. */
 #PopupAutoCompleteRichResult > richlistbox > richlistitem:not([selected]):not(:hover) > .ac-action[actiontype=searchengine],
 #PopupAutoCompleteRichResult > richlistbox > richlistitem:not([selected]):not(:hover) > .ac-separator[actiontype=searchengine] {
   display: none;
 }
 
+/* Hide the em-dash separator between the search query description (.ac-title)
+   and the "Search with Foo" description (.ac-url) if the search query is the
+   empty string.  Also hide .ac-title itself because it has a margin-inline-end;
+   alternatively we would need to remove that margin in this case. */
+#PopupAutoCompleteRichResult > richlistbox > richlistitem.emptySearchQuery > .ac-separator,
+#PopupAutoCompleteRichResult > richlistbox > richlistitem.emptySearchQuery > .ac-title {
+  display: none;
+}
+
 #PopupAutoCompleteRichResult > richlistbox > richlistitem > .ac-site-icon {
   margin-inline-start: 0;
 }
 
 /* For action items in a noactions popup, show the URL text and hide the action
    text and type icon. */
 #PopupAutoCompleteRichResult[noactions] > richlistbox > richlistitem.overridable-action > .ac-url {
   display: -moz-box;
--- a/toolkit/content/widgets/autocomplete.xml
+++ b/toolkit/content/widgets/autocomplete.xml
@@ -1788,17 +1788,17 @@
             // Treat autofills as visiturl actions.
             action = {
               type: "visiturl",
               params: { url: title },
             };
           }
 
           this.removeAttribute("actiontype");
-          this.classList.remove("overridable-action");
+          this.classList.remove("overridable-action", "emptySearchQuery");
 
           // If the type includes an action, set up the item appropriately.
           if (initialTypes.has("action") || action) {
             action = action || this._parseActionUrl(originalUrl);
             this.setAttribute("actiontype", action.type);
 
             switch (action.type) {
             case "switchtab": {
@@ -1855,16 +1855,21 @@
                     [searchSuggestion.substring(idx + searchQuery.length), ""],
                   ];
                 } else {
                   pairs = [
                     [searchSuggestion, ""],
                   ];
                 }
               } else {
+                // Add the emptySearchQuery class if the search query is the
+                // empty string.  We use it to hide .ac-separator in CSS.
+                if (!searchQuery) {
+                  this.classList.add("emptySearchQuery");
+                }
                 pairs = [
                   [searchQuery, ""],
                 ];
               }
               let interpStr = pairs.map((pair, i) => `%${i + 1}$S`).join("");
               title = this._generateEmphasisPairs(interpStr, pairs);
 
               // If this is a default search match, we remove the image so we