| 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) |
| 11 { | 11 { |
| 12 WebInspector.SearchResultsPane.call(this, searchConfig); | 12 WebInspector.SearchResultsPane.call(this, searchConfig); |
| 13 | 13 |
| 14 this._searchResults = []; | 14 this._searchResults = []; |
| 15 this._treeOutline = new TreeOutlineInShadow(); | 15 this._treeOutline = new TreeOutlineInShadow(); |
| 16 this._treeOutline.registerRequiredCSS("sources/fileBasedSearchResultsPane.cs
s"); | 16 this._treeOutline.registerRequiredCSS("sources/fileBasedSearchResultsPane.cs
s"); |
| 17 this.element.appendChild(this._treeOutline.element); | 17 this.element.appendChild(this._treeOutline.element); |
| 18 | 18 |
| 19 this._matchesExpandedCount = 0; | 19 this._matchesExpandedCount = 0; |
| 20 } | 20 }; |
| 21 | 21 |
| 22 WebInspector.FileBasedSearchResultsPane.matchesExpandedByDefaultCount = 20; | 22 WebInspector.FileBasedSearchResultsPane.matchesExpandedByDefaultCount = 20; |
| 23 WebInspector.FileBasedSearchResultsPane.fileMatchesShownAtOnce = 20; | 23 WebInspector.FileBasedSearchResultsPane.fileMatchesShownAtOnce = 20; |
| 24 | 24 |
| 25 WebInspector.FileBasedSearchResultsPane.prototype = { | 25 WebInspector.FileBasedSearchResultsPane.prototype = { |
| 26 /** | 26 /** |
| 27 * @override | 27 * @override |
| 28 * @param {!WebInspector.FileBasedSearchResult} searchResult | 28 * @param {!WebInspector.FileBasedSearchResult} searchResult |
| 29 */ | 29 */ |
| 30 addSearchResult: function(searchResult) | 30 addSearchResult: function(searchResult) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 43 { | 43 { |
| 44 var fileTreeElement = new WebInspector.FileBasedSearchResultsPane.FileTr
eeElement(this._searchConfig, searchResult); | 44 var fileTreeElement = new WebInspector.FileBasedSearchResultsPane.FileTr
eeElement(this._searchConfig, searchResult); |
| 45 this._treeOutline.appendChild(fileTreeElement); | 45 this._treeOutline.appendChild(fileTreeElement); |
| 46 // Expand until at least a certain number of matches is expanded. | 46 // Expand until at least a certain number of matches is expanded. |
| 47 if (this._matchesExpandedCount < WebInspector.FileBasedSearchResultsPane
.matchesExpandedByDefaultCount) | 47 if (this._matchesExpandedCount < WebInspector.FileBasedSearchResultsPane
.matchesExpandedByDefaultCount) |
| 48 fileTreeElement.expand(); | 48 fileTreeElement.expand(); |
| 49 this._matchesExpandedCount += searchResult.searchMatches.length; | 49 this._matchesExpandedCount += searchResult.searchMatches.length; |
| 50 }, | 50 }, |
| 51 | 51 |
| 52 __proto__: WebInspector.SearchResultsPane.prototype | 52 __proto__: WebInspector.SearchResultsPane.prototype |
| 53 } | 53 }; |
| 54 | 54 |
| 55 /** | 55 /** |
| 56 * @constructor | 56 * @constructor |
| 57 * @extends {TreeElement} | 57 * @extends {TreeElement} |
| 58 * @param {!WebInspector.ProjectSearchConfig} searchConfig | 58 * @param {!WebInspector.ProjectSearchConfig} searchConfig |
| 59 * @param {!WebInspector.FileBasedSearchResult} searchResult | 59 * @param {!WebInspector.FileBasedSearchResult} searchResult |
| 60 */ | 60 */ |
| 61 WebInspector.FileBasedSearchResultsPane.FileTreeElement = function(searchConfig,
searchResult) | 61 WebInspector.FileBasedSearchResultsPane.FileTreeElement = function(searchConfig,
searchResult) |
| 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 onexpand: function() | 72 onexpand: function() |
| 73 { | 73 { |
| 74 if (this._initialized) | 74 if (this._initialized) |
| 75 return; | 75 return; |
| 76 | 76 |
| 77 this._updateMatchesUI(); | 77 this._updateMatchesUI(); |
| 78 this._initialized = true; | 78 this._initialized = true; |
| 79 }, | 79 }, |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 * @return {boolean} | 217 * @return {boolean} |
| 218 */ | 218 */ |
| 219 _showMoreMatchesElementSelected: function(startMatchIndex) | 219 _showMoreMatchesElementSelected: function(startMatchIndex) |
| 220 { | 220 { |
| 221 this.removeChild(this._showMoreMatchesTreeElement); | 221 this.removeChild(this._showMoreMatchesTreeElement); |
| 222 this._appendSearchMatches(startMatchIndex, this._searchResult.searchMatc
hes.length); | 222 this._appendSearchMatches(startMatchIndex, this._searchResult.searchMatc
hes.length); |
| 223 return false; | 223 return false; |
| 224 }, | 224 }, |
| 225 | 225 |
| 226 __proto__: TreeElement.prototype | 226 __proto__: TreeElement.prototype |
| 227 } | 227 }; |
| OLD | NEW |