Chromium Code Reviews| 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.VBox} | 7 * @extends {WebInspector.VBox} |
| 8 */ | 8 */ |
| 9 WebInspector.AdvancedSearchView = function() | 9 WebInspector.AdvancedSearchView = function() |
| 10 { | 10 { |
| 11 WebInspector.VBox.call(this, true); | 11 WebInspector.VBox.call(this, true); |
| 12 this.setMinimumSize(0, 40); | 12 this.setMinimumSize(0, 40); |
| 13 this.registerRequiredCSS("sources/sourcesSearch.css"); | 13 this.registerRequiredCSS("sources/sourcesSearch.css"); |
| 14 | 14 |
| 15 this._searchId = 0; | 15 this._searchId = 0; |
| 16 | 16 |
| 17 this.contentElement.classList.add("search-view"); | 17 this.contentElement.classList.add("search-view"); |
| 18 | 18 |
| 19 this._searchPanelElement = this.contentElement.createChild("div", "search-dr awer-header"); | 19 this._searchPanelElement = this.contentElement.createChild("div", "search-dr awer-header"); |
| 20 this._searchPanelElement.addEventListener("keydown", this._onKeyDown.bind(th is), false); | 20 this._searchPanelElement.addEventListener("keydown", this._onKeyDown.bind(th is), false); |
| 21 this._searchPanelElement.addEventListener("keyup", this._onKeyUp.bind(this), false); | 21 this._searchPanelElement.addEventListener("keyup", this._textChanged.bind(th is), false); |
|
lushnikov
2016/05/02 18:43:41
why would you need a keyup listener here? input sh
luoe
2016/05/02 19:18:52
You're right!
| |
| 22 this._searchPanelElement.addEventListener("input", this._textChanged.bind(th is), false); | |
| 22 | 23 |
| 23 this._searchResultsElement = this.contentElement.createChild("div"); | 24 this._searchResultsElement = this.contentElement.createChild("div"); |
| 24 this._searchResultsElement.className = "search-results"; | 25 this._searchResultsElement.className = "search-results"; |
| 25 | 26 |
| 26 this._search = WebInspector.HistoryInput.create(); | 27 this._search = WebInspector.HistoryInput.create(); |
| 27 this._searchPanelElement.appendChild(this._search); | 28 this._searchPanelElement.appendChild(this._search); |
| 28 this._search.placeholder = WebInspector.UIString("Search all sources (use \" file:\" to filter by path)\u200e"); | 29 this._search.placeholder = WebInspector.UIString("Search all sources (use \" file:\" to filter by path)\u200e"); |
| 29 this._search.setAttribute("type", "text"); | 30 this._search.setAttribute("type", "text"); |
| 30 this._search.classList.add("search-config-search"); | 31 this._search.classList.add("search-config-search"); |
| 31 this._search.setAttribute("results", "0"); | 32 this._search.setAttribute("results", "0"); |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 289 */ | 290 */ |
| 290 _onKeyDown: function(event) | 291 _onKeyDown: function(event) |
| 291 { | 292 { |
| 292 switch (event.keyCode) { | 293 switch (event.keyCode) { |
| 293 case WebInspector.KeyboardShortcut.Keys.Enter.code: | 294 case WebInspector.KeyboardShortcut.Keys.Enter.code: |
| 294 this._onAction(); | 295 this._onAction(); |
| 295 break; | 296 break; |
| 296 } | 297 } |
| 297 }, | 298 }, |
| 298 | 299 |
| 299 _onKeyUp: function() | 300 _textChanged: function() |
| 300 { | 301 { |
| 301 if (this._search.value && this._search.value.length) | 302 if (this._search.value && this._search.value.length) |
| 302 this._searchInputClearElement.hidden = false; | 303 this._searchInputClearElement.hidden = false; |
| 303 else | 304 else |
| 304 this._searchInputClearElement.hidden = true; | 305 this._searchInputClearElement.hidden = true; |
| 305 }, | 306 }, |
| 306 | 307 |
| 307 _save: function() | 308 _save: function() |
| 308 { | 309 { |
| 309 this._advancedSearchConfig.set(this._buildSearchConfig().toPlainObject() ); | 310 this._advancedSearchConfig.set(this._buildSearchConfig().toPlainObject() ); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 450 performIndexing: function(progress) { }, | 451 performIndexing: function(progress) { }, |
| 451 | 452 |
| 452 stopSearch: function() { }, | 453 stopSearch: function() { }, |
| 453 | 454 |
| 454 /** | 455 /** |
| 455 * @param {!WebInspector.ProjectSearchConfig} searchConfig | 456 * @param {!WebInspector.ProjectSearchConfig} searchConfig |
| 456 * @return {!WebInspector.SearchResultsPane} | 457 * @return {!WebInspector.SearchResultsPane} |
| 457 */ | 458 */ |
| 458 createSearchResultsPane: function(searchConfig) { } | 459 createSearchResultsPane: function(searchConfig) { } |
| 459 } | 460 } |
| OLD | NEW |