| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @constructor | 6 * @constructor |
| 7 * @extends {WebInspector.SearchResultsPane} | 7 * @extends {WebInspector.SearchResultsPane} |
| 8 * @param {!WebInspector.ProjectSearchConfig} searchConfig | 8 * @param {!WebInspector.ProjectSearchConfig} searchConfig |
| 9 */ | 9 */ |
| 10 WebInspector.FileBasedSearchResultsPane = function(searchConfig) | 10 WebInspector.FileBasedSearchResultsPane = function(searchConfig) |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 { | 62 { |
| 63 TreeElement.call(this, "", true); | 63 TreeElement.call(this, "", true); |
| 64 this._searchConfig = searchConfig; | 64 this._searchConfig = searchConfig; |
| 65 this._searchResult = searchResult; | 65 this._searchResult = searchResult; |
| 66 | 66 |
| 67 this.toggleOnClick = true; | 67 this.toggleOnClick = true; |
| 68 this.selectable = false; | 68 this.selectable = false; |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 WebInspector.FileBasedSearchResultsPane.FileTreeElement.prototype = { | 71 WebInspector.FileBasedSearchResultsPane.FileTreeElement.prototype = { |
| 72 /** |
| 73 * @override |
| 74 */ |
| 72 onexpand: function() | 75 onexpand: function() |
| 73 { | 76 { |
| 74 if (this._initialized) | 77 if (this._initialized) |
| 75 return; | 78 return; |
| 76 | 79 |
| 77 this._updateMatchesUI(); | 80 this._updateMatchesUI(); |
| 78 this._initialized = true; | 81 this._initialized = true; |
| 79 }, | 82 }, |
| 80 | 83 |
| 81 _updateMatchesUI: function() | 84 _updateMatchesUI: function() |
| 82 { | 85 { |
| 83 this.removeChildren(); | 86 this.removeChildren(); |
| 84 var toIndex = Math.min(this._searchResult.searchMatches.length, WebInspe
ctor.FileBasedSearchResultsPane.fileMatchesShownAtOnce); | 87 var toIndex = Math.min(this._searchResult.searchMatches.length, WebInspe
ctor.FileBasedSearchResultsPane.fileMatchesShownAtOnce); |
| 85 if (toIndex < this._searchResult.searchMatches.length) { | 88 if (toIndex < this._searchResult.searchMatches.length) { |
| 86 this._appendSearchMatches(0, toIndex - 1); | 89 this._appendSearchMatches(0, toIndex - 1); |
| 87 this._appendShowMoreMatchesElement(toIndex - 1); | 90 this._appendShowMoreMatchesElement(toIndex - 1); |
| 88 } else { | 91 } else { |
| 89 this._appendSearchMatches(0, toIndex); | 92 this._appendSearchMatches(0, toIndex); |
| 90 } | 93 } |
| 91 }, | 94 }, |
| 92 | 95 |
| 96 /** |
| 97 * @override |
| 98 */ |
| 93 onattach: function() | 99 onattach: function() |
| 94 { | 100 { |
| 95 this._updateSearchMatches(); | 101 this._updateSearchMatches(); |
| 96 }, | 102 }, |
| 97 | 103 |
| 98 _updateSearchMatches: function() | 104 _updateSearchMatches: function() |
| 99 { | 105 { |
| 100 this.listItemElement.classList.add("search-result"); | 106 this.listItemElement.classList.add("search-result"); |
| 101 | 107 |
| 102 var fileNameSpan = createElement("span"); | 108 var fileNameSpan = createElement("span"); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 */ | 224 */ |
| 219 _showMoreMatchesElementSelected: function(startMatchIndex) | 225 _showMoreMatchesElementSelected: function(startMatchIndex) |
| 220 { | 226 { |
| 221 this.removeChild(this._showMoreMatchesTreeElement); | 227 this.removeChild(this._showMoreMatchesTreeElement); |
| 222 this._appendSearchMatches(startMatchIndex, this._searchResult.searchMatc
hes.length); | 228 this._appendSearchMatches(startMatchIndex, this._searchResult.searchMatc
hes.length); |
| 223 return false; | 229 return false; |
| 224 }, | 230 }, |
| 225 | 231 |
| 226 __proto__: TreeElement.prototype | 232 __proto__: TreeElement.prototype |
| 227 }; | 233 }; |
| OLD | NEW |