Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(602)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sources/AdvancedSearchView.js

Issue 1902283002: DevTools: Update styles for full text search drawer panel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 22
22 this._searchResultsElement = this.contentElement.createChild("div"); 23 this._searchResultsElement = this.contentElement.createChild("div");
23 this._searchResultsElement.className = "search-results"; 24 this._searchResultsElement.className = "search-results";
24 25
25 this._search = WebInspector.HistoryInput.create(); 26 this._search = WebInspector.HistoryInput.create();
26 this._searchPanelElement.appendChild(this._search); 27 this._searchPanelElement.appendChild(this._search);
27 this._search.placeholder = WebInspector.UIString("Enter query, use `file:` t o filter by path"); 28 this._search.placeholder = WebInspector.UIString("Search all sources (use \" file:\" to filter by path)");
28 this._search.setAttribute("type", "text"); 29 this._search.setAttribute("type", "text");
29 this._search.classList.add("search-config-search"); 30 this._search.classList.add("search-config-search");
30 this._search.setAttribute("results", "0"); 31 this._search.setAttribute("results", "0");
31 this._search.setAttribute("size", 42); 32 this._search.setAttribute("size", 42);
32 33
34 this._searchPanelElement.createChild("div", "search-icon");
35 this._searchInputClearElement = this._searchPanelElement.createChild("div", "search-cancel-button");
36 this._searchInputClearElement.hidden = true;
37 this._searchInputClearElement.addEventListener("click", this._onSearchInputC lear.bind(this), false);
38
33 this._ignoreCaseLabel = createCheckboxLabel(WebInspector.UIString("Ignore ca se")); 39 this._ignoreCaseLabel = createCheckboxLabel(WebInspector.UIString("Ignore ca se"));
34 this._ignoreCaseLabel.classList.add("search-config-label"); 40 this._ignoreCaseLabel.classList.add("search-config-label");
35 this._searchPanelElement.appendChild(this._ignoreCaseLabel); 41 this._searchPanelElement.appendChild(this._ignoreCaseLabel);
36 this._ignoreCaseCheckbox = this._ignoreCaseLabel.checkboxElement; 42 this._ignoreCaseCheckbox = this._ignoreCaseLabel.checkboxElement;
37 this._ignoreCaseCheckbox.classList.add("search-config-checkbox"); 43 this._ignoreCaseCheckbox.classList.add("search-config-checkbox");
38 44
39 this._regexLabel = createCheckboxLabel(WebInspector.UIString("Regular expres sion")); 45 this._regexLabel = createCheckboxLabel(WebInspector.UIString("Regular expres sion"));
40 this._regexLabel.classList.add("search-config-label"); 46 this._regexLabel.classList.add("search-config-label");
41 this._searchPanelElement.appendChild(this._regexLabel); 47 this._searchPanelElement.appendChild(this._regexLabel);
42 this._regexCheckbox = this._regexLabel.checkboxElement; 48 this._regexCheckbox = this._regexLabel.checkboxElement;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 { 100 {
95 this._isIndexing = true; 101 this._isIndexing = true;
96 if (this._progressIndicator) 102 if (this._progressIndicator)
97 this._progressIndicator.done(); 103 this._progressIndicator.done();
98 this._progressIndicator = new WebInspector.ProgressIndicator(); 104 this._progressIndicator = new WebInspector.ProgressIndicator();
99 this._searchMessageElement.textContent = WebInspector.UIString("Indexing \u2026"); 105 this._searchMessageElement.textContent = WebInspector.UIString("Indexing \u2026");
100 this._progressIndicator.show(this._searchProgressPlaceholderElement); 106 this._progressIndicator.show(this._searchProgressPlaceholderElement);
101 this._searchScope.performIndexing(new WebInspector.ProgressProxy(this._p rogressIndicator, this._onIndexingFinished.bind(this))); 107 this._searchScope.performIndexing(new WebInspector.ProgressProxy(this._p rogressIndicator, this._onIndexingFinished.bind(this)));
102 }, 108 },
103 109
110 _onSearchInputClear: function()
111 {
112 this._search.value = "";
113 this.focus();
114 this._searchInputClearElement.hidden = true;
115 },
116
104 /** 117 /**
105 * @param {number} searchId 118 * @param {number} searchId
106 * @param {!WebInspector.FileBasedSearchResult} searchResult 119 * @param {!WebInspector.FileBasedSearchResult} searchResult
107 */ 120 */
108 _onSearchResult: function(searchId, searchResult) 121 _onSearchResult: function(searchId, searchResult)
109 { 122 {
110 if (searchId !== this._searchId || !this._progressIndicator) 123 if (searchId !== this._searchId || !this._progressIndicator)
111 return; 124 return;
112 if (this._progressIndicator && this._progressIndicator.isCanceled()) { 125 if (this._progressIndicator && this._progressIndicator.isCanceled()) {
113 this._onIndexingFinished(); 126 this._onIndexingFinished();
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 */ 289 */
277 _onKeyDown: function(event) 290 _onKeyDown: function(event)
278 { 291 {
279 switch (event.keyCode) { 292 switch (event.keyCode) {
280 case WebInspector.KeyboardShortcut.Keys.Enter.code: 293 case WebInspector.KeyboardShortcut.Keys.Enter.code:
281 this._onAction(); 294 this._onAction();
282 break; 295 break;
283 } 296 }
284 }, 297 },
285 298
299 _onKeyUp: function()
300 {
301 if (this._search.value && this._search.value.length)
302 this._searchInputClearElement.hidden = false;
303 else
304 this._searchInputClearElement.hidden = true;
305 },
306
286 _save: function() 307 _save: function()
287 { 308 {
288 this._advancedSearchConfig.set(this._buildSearchConfig().toPlainObject() ); 309 this._advancedSearchConfig.set(this._buildSearchConfig().toPlainObject() );
289 }, 310 },
290 311
291 _load: function() 312 _load: function()
292 { 313 {
293 var searchConfig = WebInspector.SearchConfig.fromPlainObject(this._advan cedSearchConfig.get()); 314 var searchConfig = WebInspector.SearchConfig.fromPlainObject(this._advan cedSearchConfig.get());
294 this._search.value = searchConfig.query(); 315 this._search.value = searchConfig.query();
295 this._ignoreCaseCheckbox.checked = searchConfig.ignoreCase(); 316 this._ignoreCaseCheckbox.checked = searchConfig.ignoreCase();
296 this._regexCheckbox.checked = searchConfig.isRegex(); 317 this._regexCheckbox.checked = searchConfig.isRegex();
318 if (this._search.value && this._search.value.length)
319 this._searchInputClearElement.hidden = false;
297 }, 320 },
298 321
299 _onAction: function() 322 _onAction: function()
300 { 323 {
301 var searchConfig = this._buildSearchConfig(); 324 var searchConfig = this._buildSearchConfig();
302 if (!searchConfig.query() || !searchConfig.query().length) 325 if (!searchConfig.query() || !searchConfig.query().length)
303 return; 326 return;
304 327
305 this._save(); 328 this._save();
306 this._startSearch(searchConfig); 329 this._startSearch(searchConfig);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 performIndexing: function(progress) { }, 450 performIndexing: function(progress) { },
428 451
429 stopSearch: function() { }, 452 stopSearch: function() { },
430 453
431 /** 454 /**
432 * @param {!WebInspector.ProjectSearchConfig} searchConfig 455 * @param {!WebInspector.ProjectSearchConfig} searchConfig
433 * @return {!WebInspector.SearchResultsPane} 456 * @return {!WebInspector.SearchResultsPane}
434 */ 457 */
435 createSearchResultsPane: function(searchConfig) { } 458 createSearchResultsPane: function(searchConfig) { }
436 } 459 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698