Back out fba4dc82c929 bug 1162140 for bustage on a CLOSED TREE.
authorDrew Willcoxon <adw@mozilla.com>
Thu, 11 Jun 2015 15:39:49 -0700
changeset 279286 a3399f552e3bb8b671df36456ef9107381279837
parent 279285 ae1d2c1b1d18a1b37b674ea6df3f4f065e7d94bb
child 279287 40dff0df156e88d614c4e1104a1e9e795f3b8543
push id4932
push userjlund@mozilla.com
push dateMon, 10 Aug 2015 18:23:06 +0000
treeherdermozilla-beta@6dd5a4f5f745 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1162140
milestone41.0a1
backs outfba4dc82c9296c0c3abf5bb51c6d42806a02f269
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
Back out fba4dc82c929 bug 1162140 for bustage on a CLOSED TREE.
toolkit/components/places/UnifiedComplete.js
toolkit/content/autocomplete.css
toolkit/content/widgets/autocomplete.xml
toolkit/locales/en-US/chrome/global/autocomplete.properties
--- a/toolkit/components/places/UnifiedComplete.js
+++ b/toolkit/components/places/UnifiedComplete.js
@@ -961,37 +961,36 @@ Search.prototype = {
     let alias = this._searchTokens[0];
     let match = yield PlacesSearchAutocompleteProvider.findMatchByAlias(alias);
     if (!match)
       return false;
 
     match.engineAlias = alias;
     let query = this._searchTokens.slice(1).join(" ");
 
-    this._addSearchEngineMatch(match, query);
+    yield this._addSearchEngineMatch(match, query);
     return true;
   },
 
   _matchCurrentSearchEngine: function* () {
     let match = yield PlacesSearchAutocompleteProvider.getDefaultMatch();
     if (!match)
       return;
 
     let query = this._originalSearchString;
-    this._addSearchEngineMatch(match, query);
+
+    yield this._addSearchEngineMatch(match, query);
   },
 
-  _addSearchEngineMatch(match, query, suggestion) {
+  _addSearchEngineMatch: function* (match, query) {
     let actionURLParams = {
       engineName: match.engineName,
       input: this._originalSearchString,
       searchQuery: query,
     };
-    if (suggestion)
-      actionURLParams.searchSuggestion = suggestion;
     if (match.engineAlias) {
       actionURLParams.alias = match.engineAlias;
     }
     let value = makeActionURL("searchengine", actionURLParams);
 
     this._addMatch({
       value: value,
       comment: match.engineName,
--- a/toolkit/content/autocomplete.css
+++ b/toolkit/content/autocomplete.css
@@ -6,12 +6,8 @@
 @namespace html url("http://www.w3.org/1999/xhtml");
 
 /* Apply crisp rendering for favicons at exactly 2dppx resolution */
 @media (resolution: 2dppx) {
   .ac-site-icon {
     image-rendering: -moz-crisp-edges;
   }
 }
-
-richlistitem > .ac-title-box > .ac-title > .ac-comment:not([selected]) > html|span.ac-selected-text {
-  display: none;
-}
--- a/toolkit/content/widgets/autocomplete.xml
+++ b/toolkit/content/widgets/autocomplete.xml
@@ -1534,20 +1534,21 @@ extends="chrome://global/content/binding
 
               if (match) {
                 // "%S" doesn't have a numerical number in it, but will always
                 // be assumed to be 1. Furthermore, the input string specifies
                 // these with a 1-based index, but we want a 0-based index.
                 let index = (match[1] || 1) - 1;
 
                 if (index >= 0 && index < aReplacements.length) {
-                  pairs.push([...aReplacements[index]]);
+                  let replacement = aReplacements[index];
+                  pairs.push([...replacement]);
                 }
               } else {
-                pairs.push([part]);
+                pairs.push([part, false]);
               }
             }
 
             return pairs;
           ]]>
         </body>
       </method>
 
@@ -1566,25 +1567,18 @@ extends="chrome://global/content/binding
           // Get rid of all previous text
           while (aDescriptionElement.hasChildNodes())
             aDescriptionElement.firstChild.remove();
 
           for (let [text, emphasise] of aTextPairs) {
             if (emphasise) {
               let span = aDescriptionElement.appendChild(
                 document.createElementNS("http://www.w3.org/1999/xhtml", "span"));
+              span.className = "ac-emphasize-text";
               span.textContent = text;
-              switch(emphasise) {
-                case "match":
-                  span.className = "ac-emphasize-text";
-                  break;
-                case "selected":
-                  span.className = "ac-selected-text";
-                  break;
-              }
             } else {
               aDescriptionElement.appendChild(document.createTextNode(text));
             }
           }
           ]]>
         </body>
       </method>
 
@@ -1630,49 +1624,37 @@ extends="chrome://global/content/binding
             if (action.type == "switchtab") {
               this.classList.add("overridable-action");
               displayUrl = action.params.url;
               let desc = this._stringBundle.GetStringFromName("switchToTab");
               this._setUpDescription(this._action, desc, true);
             } else if (action.type == "searchengine") {
               emphasiseUrl = false;
 
-              // The order here is not localizable, we default to appending
-              // "- Search with Engine" to the search string, to be able to
-              // properly generate emphasis pairs. That said, no localization
-              // changed the order while it was possible, so doesn't look like
-              // there's a strong need for that.
-              let {engineName, searchSuggestion, searchQuery} = action.params;
-              let engineStr = "- " +
-                this._stringBundle.formatStringFromName("searchWithEngine",
-                                                        [engineName], 1);
-              let suggestedPart = "";
-              if (searchSuggestion) {
-                suggestedPart = searchSuggestion.substr(searchQuery.length);
-              }
-              title = this._generateEmphasisPairs(`%1$S${suggestedPart} %2$S`, [
-                                                    [searchQuery, "match"],
-                                                    [engineStr, "selected"],
+              let sourceStr = this._stringBundle.GetStringFromName("searchWithEngineForQuery");
+              title = this._generateEmphasisPairs(sourceStr, [
+                                                    [action.params.engineName, false],
+                                                    [action.params.searchQuery, true]
                                                   ]);
               // If this is a default search match, we remove the image so we
               // can style it ourselves with a generic search icon.
               // We don't do this when matching an aliased search engine,
               // because the icon helps with recognising which engine will be
               // used (when using the default engine, we don't need that
               // recognition).
               if (!action.params.alias) {
                 this.removeAttribute("image");
               }
             } else if (action.type == "visiturl") {
               emphasiseUrl = false;
               displayUrl = action.params.url;
 
               let sourceStr = this._stringBundle.GetStringFromName("visitURL");
               title = this._generateEmphasisPairs(sourceStr, [
-                                                    [displayUrl, "match"],
+                                                    [displayUrl, true],
                                                   ]);
             }
 
             // Remove the "action" substring so that the correct style, if any,
             // is applied below.
             types.delete("action");
           }
 
@@ -1692,17 +1674,17 @@ extends="chrome://global/content/binding
           }
 
           // Check if we have an auto-fill URL
           if (types.has("autofill")) {
             emphasiseUrl = false;
 
             let sourceStr = this._stringBundle.GetStringFromName("visitURL");
             title = this._generateEmphasisPairs(sourceStr, [
-                                                 [displayUrl, "match"],
+                                                 [displayUrl, true],
                                                 ]);
 
             types.delete("autofill");
           }
 
           type = [...types].join(" ");
 
           // If we have a tag match, show the tags and icon
--- a/toolkit/locales/en-US/chrome/global/autocomplete.properties
+++ b/toolkit/locales/en-US/chrome/global/autocomplete.properties
@@ -1,12 +1,17 @@
 # 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/.
 
 # LOCALIZATION NOTE (searchWithEngine): %S will be replaced with
 # the search engine provider's name. This format was chosen because
 # the provider can also end with "Search" (e.g.: MSN Search).
 searchWithEngine = Search with %S
+# LOCALIZATION NOTE (searchWithEngineForQuery):
+# %1$S is the search engine's name, %2$S is the search query.
+# This format was chosen because the provider can also end with "Search"
+# (e.g.: MSN Search).
+searchWithEngineForQuery = %2$S — Search with %1$S 
 switchToTab = Switch to tab
 # LOCALIZATION NOTE (visitURL):
 # %S is the URL to visit.
 visitURL = Visit %S