Bug 1475165 - Show inspector search results from top to bottom; r=gl.
authorNicolas Chevobbe <nchevobbe@mozilla.com>
Tue, 17 Jul 2018 10:05:04 +0200
changeset 427139 8d94737176d6faff446b88c57b693952a5c185f7
parent 427138 68e7023725b4e5bfa317ac7093cc0af50b9a0a02
child 427140 69e53775fd5cabcab8c87c72466eb39ab542b4bf
push id34294
push usershindli@mozilla.com
push dateWed, 18 Jul 2018 21:44:46 +0000
treeherdermozilla-central@7ad45eaf20ca [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgl
bugs1475165
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 1475165 - Show inspector search results from top to bottom; r=gl. For some reason, we were flipping the search result, which was not ideal in the inspector. This patch changes this to show results in the same order the server return them. MozReview-Commit-ID: Ak9FnrrW8z5
devtools/client/inspector/inspector-search.js
--- a/devtools/client/inspector/inspector-search.js
+++ b/devtools/client/inspector/inspector-search.js
@@ -406,17 +406,17 @@ SelectorAutocompleter.prototype = {
   },
 
   /**
    * Populates the suggestions list and show the suggestion popup.
    *
    * @return {Promise} promise that will resolve when the autocomplete popup is fully
    * displayed or hidden.
    */
-  _showPopup: function(list, firstPart, popupState) {
+  _showPopup: function(list, popupState) {
     let total = 0;
     const query = this.searchBox.value;
     const items = [];
 
     for (let [value, , state] of list) {
       if (query.match(/[\s>+]$/)) {
         // for cases like 'div ' or 'div >' or 'div+'
         value = query + value;
@@ -443,17 +443,17 @@ SelectorAutocompleter.prototype = {
       // adjust the preLabel
       if (popupState === this.States.TAG && state === this.States.CLASS) {
         item.preLabel = "." + item.preLabel;
       }
       if (popupState === this.States.TAG && state === this.States.ID) {
         item.preLabel = "#" + item.preLabel;
       }
 
-      items.unshift(item);
+      items.push(item);
       if (++total > MAX_SUGGESTIONS - 1) {
         break;
       }
     }
 
     if (total > 0) {
       const onPopupOpened = this.searchPopup.once("popup-opened");
       this.searchPopup.once("popup-closed", () => {
@@ -533,12 +533,12 @@ SelectorAutocompleter.prototype = {
       // don't need to show a popup.
       if (result.suggestions.length === 1 &&
           result.suggestions[0][0] === firstPart) {
         result.suggestions = [];
       }
 
       // Wait for the autocomplete-popup to fire its popup-opened event, to make sure
       // the autoSelect item has been selected.
-      return this._showPopup(result.suggestions, firstPart, state);
+      return this._showPopup(result.suggestions, state);
     });
   }
 };