Bug 1265066 - Hide the separator em dash in bookmark keyword awesomebar results. r?mak draft
authorDrew Willcoxon <adw@mozilla.com>
Fri, 15 Apr 2016 14:56:31 -0700
changeset 352198 7eb066f660c7c765e6751952e9f84c341cb5be8f
parent 352108 009d7df1ba6d97a5abd2ed417a3464a8e948742c
child 518607 deb91e2f3b28009303a4ef02bca32c151d8de98e
push id15645
push userdwillcoxon@mozilla.com
push dateFri, 15 Apr 2016 21:56:42 +0000
reviewersmak
bugs1265066
milestone48.0a1
Bug 1265066 - Hide the separator em dash in bookmark keyword awesomebar results. r?mak MozReview-Commit-ID: ExEPu6cKYGf
browser/base/content/test/general/browser_action_keyword.js
browser/base/content/test/general/browser_autocomplete_a11y_label.js
browser/base/content/test/general/browser_autocomplete_tag_star_visibility.js
browser/base/content/test/general/browser_search_favicon.js
browser/base/content/test/general/browser_urlbarDecode.js
toolkit/content/autocomplete.css
toolkit/content/widgets/autocomplete.xml
--- a/browser/base/content/test/general/browser_action_keyword.js
+++ b/browser/base/content/test/general/browser_action_keyword.js
@@ -34,17 +34,16 @@ add_task(function*() {
                                                 title: "test" });
   yield PlacesUtils.keywords.insert({ keyword: "keyword",
                                       url: "http://example.com/?q=%s" });
 
   let result = yield promise_first_result("keyword something");
   isnot(result, null, "Expect a keyword result");
 
   let types = new Set(result.getAttribute("type").split(/\s+/));
-  Assert.ok(types.has("action"));
   Assert.ok(types.has("keyword"));
   is(result.getAttribute("actiontype"), "keyword", "Expect correct `actiontype` attribute");
   is(result.getAttribute("title"), "example.com", "Expect correct title");
 
   // We need to make a real URI out of this to ensure it's normalised for
   // comparison.
   let uri = NetUtil.newURI(result.getAttribute("url"));
   is(uri.spec, makeActionURI("keyword", {url: "http://example.com/?q=something", input: "keyword something"}).spec, "Expect correct url");
--- a/browser/base/content/test/general/browser_autocomplete_a11y_label.js
+++ b/browser/base/content/test/general/browser_autocomplete_a11y_label.js
@@ -18,17 +18,17 @@ add_task(function* switchToTab() {
   let tab = gBrowser.addTab("about:about");
   yield promiseTabLoaded(tab);
 
   let actionURL = makeActionURI("switchtab", {url: "about:about"}).spec;
   yield promiseAutocompleteResultPopup("% about");
 
   ok(gURLBar.popup.richlistbox.children.length > 1, "Should get at least 2 results");
   let result = gURLBar.popup.richlistbox.children[1];
-  is(result.getAttribute("type"), "action switchtab", "Expect right type attribute");
+  is(result.getAttribute("type"), "switchtab", "Expect right type attribute");
   is(result.label, "about:about about:about Tab", "Result a11y label should be: <title> <url> Tab");
 
   gURLBar.popup.hidePopup();
   yield promisePopupHidden(gURLBar.popup);
   gBrowser.removeTab(tab);
 });
 
 add_task(function* searchSuggestions() {
--- a/browser/base/content/test/general/browser_autocomplete_tag_star_visibility.js
+++ b/browser/base/content/test/general/browser_autocomplete_tag_star_visibility.js
@@ -25,17 +25,17 @@ add_task(function*() {
   let testcases = [{
     description: "Test with suggest.bookmark=true",
     tagName: "tagtest1",
     prefs: {
       "suggest.bookmark": true,
     },
     input: "tagtest1",
     expected: {
-      type: "bookmark-tag",
+      type: "bookmark",
       typeImageVisible: true,
     },
   }, {
     description: "Test with suggest.bookmark=false",
     tagName: "tagtest2",
     prefs: {
       "suggest.bookmark": false,
     },
@@ -47,28 +47,28 @@ add_task(function*() {
   }, {
     description: "Test with suggest.bookmark=true (again)",
     tagName: "tagtest3",
     prefs: {
       "suggest.bookmark": true,
     },
     input: "tagtest3",
     expected: {
-      type: "bookmark-tag",
+      type: "bookmark",
       typeImageVisible: true,
     },
   }, {
     description: "Test with bookmark restriction token",
     tagName: "tagtest4",
     prefs: {
       "suggest.bookmark": true,
     },
     input: "* tagtest4",
     expected: {
-      type: "bookmark-tag",
+      type: "bookmark",
       typeImageVisible: true,
     },
   }, {
     description: "Test with history restriction token",
     tagName: "tagtest5",
     prefs: {
       "suggest.bookmark": true,
     },
--- a/browser/base/content/test/general/browser_search_favicon.js
+++ b/browser/base/content/test/general/browser_search_favicon.js
@@ -35,17 +35,17 @@ add_task(function*() {
   yield promiseTabLoaded(gBrowser.selectedTab);
 
   // The first autocomplete result has the action searchengine, while
   // the second result is the "search favicon" element.
   yield promiseAutocompleteResultPopup("foo");
   let result = gURLBar.popup.richlistbox.children[1];
 
   isnot(result, null, "Expect a search result");
-  is(result.getAttribute("type"), "action searchengine favicon", "Expect correct `type` attribute");
+  is(result.getAttribute("type"), "searchengine", "Expect correct `type` attribute");
 
   let titleHbox = result._titleText.parentNode.parentNode;
   ok(titleHbox.classList.contains("ac-title"), "Title hbox sanity check");
   is_element_visible(titleHbox, "Title element should be visible");
 
   let urlHbox = result._urlText.parentNode.parentNode;
   ok(urlHbox.classList.contains("ac-url"), "URL hbox sanity check");
   is_element_hidden(urlHbox, "URL element should be hidden");
--- a/browser/base/content/test/general/browser_urlbarDecode.js
+++ b/browser/base/content/test/general/browser_urlbarDecode.js
@@ -82,17 +82,14 @@ function* checkInput(inputStr) {
     params[key] = encodeURIComponent(params[key]);
   }
   let expectedURL = "moz-action:" + type + "," + JSON.stringify(params);
   Assert.equal(item.getAttribute("url"), expectedURL, "url");
 
   Assert.equal(item.getAttribute("title"), inputStr.replace("\\","/"), "title");
   Assert.equal(item.getAttribute("text"), inputStr, "text");
 
-  let itemTypeStr = item.getAttribute("type");
-  let itemTypes = itemTypeStr.split(" ").sort();
-  Assert.equal(itemTypes.toString(),
-               ["action", "heuristic", "visiturl"].toString(),
-               "type");
+  let itemType = item.getAttribute("type");
+  Assert.equal(itemType, "visiturl");
 
   Assert.equal(item._titleText.textContent, inputStr.replace("\\","/"), "Visible title");
   Assert.equal(item._actionText.textContent, "Visit", "Visible action");
 }
--- a/toolkit/content/autocomplete.css
+++ b/toolkit/content/autocomplete.css
@@ -29,8 +29,12 @@ richlistitem {
 .ac-tags[empty] {
   display: none;
 }
 
 .ac-action[actiontype=searchengine]:not([selected]),
 .ac-separator[actiontype=searchengine]:not([selected]) {
   display: none;
 }
+
+.ac-separator[type=keyword] {
+  display: none;
+}
--- a/toolkit/content/widgets/autocomplete.xml
+++ b/toolkit/content/widgets/autocomplete.xml
@@ -1363,20 +1363,20 @@ extends="chrome://global/content/binding
 
   <binding id="autocomplete-richlistitem" extends="chrome://global/content/bindings/richlistbox.xml#richlistitem">
 
     <content align="center"
              onoverflow="this._onOverflow();"
              onunderflow="this._onUnderflow();">
       <xul:image anonid="type-icon"
                  class="ac-type-icon"
-                 xbl:inherits="selected,current"/>
+                 xbl:inherits="selected,current,type"/>
       <xul:image anonid="site-icon"
                  class="ac-site-icon"
-                 xbl:inherits="src=image,selected"/>
+                 xbl:inherits="src=image,selected,type"/>
       <xul:hbox class="ac-title"
                 align="center"
                 xbl:inherits="selected">
         <xul:description class="ac-text-overflow-container">
           <xul:description anonid="title-text"
                            class="ac-title-text"
                            xbl:inherits="selected"/>
         </xul:description>
@@ -1389,17 +1389,17 @@ extends="chrome://global/content/binding
           <xul:description anonid="tags-text"
                            class="ac-tags-text"
                            xbl:inherits="selected"/>
         </xul:description>
       </xul:hbox>
       <xul:hbox anonid="separator"
                 class="ac-separator"
                 align="center"
-                xbl:inherits="selected,actiontype">
+                xbl:inherits="selected,actiontype,type">
         <xul:description class="ac-separator-text">—</xul:description>
       </xul:hbox>
       <xul:hbox class="ac-url"
                 align="center"
                 xbl:inherits="selected,actiontype">
         <xul:description class="ac-text-overflow-container">
           <xul:description anonid="url-text"
                            class="ac-url-text"
@@ -1996,18 +1996,17 @@ extends="chrome://global/content/binding
               title = this._generateEmphasisPairs(interpStr, pairs);
               // The action box will be visible since this is a moz-action, but
               // we want it to appear as if it were not visible, so set its text
               // to the empty string.
               this._setUpDescription(this._actionText, "", false);
             }
           }
 
-          this._typeIcon.setAttribute("type", type);
-          this._siteIcon.setAttribute("type", type);
+          this.setAttribute("type", type);
 
           if (Array.isArray(title)) {
             this._setUpEmphasisedSections(this._titleText, title);
           } else {
             this._setUpDescription(this._titleText, title, false);
           }
           this._setUpDescription(this._urlText, displayUrl, !emphasiseUrl);