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

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: Remove unnecessary style rule Created 4 years, 8 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 21
22 this._searchResultsElement = this.contentElement.createChild("div"); 22 this._searchResultsElement = this.contentElement.createChild("div");
23 this._searchResultsElement.className = "search-results"; 23 this._searchResultsElement.className = "search-results";
24 24
25 this._search = WebInspector.HistoryInput.create(); 25 this._search = WebInspector.HistoryInput.create();
26 this._searchPanelElement.appendChild(this._search); 26 this._searchPanelElement.appendChild(this._search);
27 this._search.placeholder = WebInspector.UIString("Enter query, use `file:` t o filter by path"); 27 this._search.placeholder = WebInspector.UIString("Search all sources (use \" path:\" to filter by path)");
lushnikov 2016/04/22 19:19:08 Should be "Use "file:" to filter by path
luoe 2016/04/23 00:01:57 Done.
28 this._search.setAttribute("type", "text"); 28 this._search.setAttribute("type", "text");
29 this._search.classList.add("search-config-search"); 29 this._search.classList.add("search-config-search");
30 this._search.setAttribute("results", "0"); 30 this._search.setAttribute("results", "0");
31 this._search.setAttribute("size", 42); 31 this._search.setAttribute("size", 42);
32 32
33 this._searchPanelElement.createChild("div", "search-icon");
34 this._searchClearQueryElement = this._searchPanelElement.createChild("div", "search-cancel-button");
35 this._searchClearQueryElement.classList.add("hidden");
lushnikov 2016/04/22 19:19:08 this._searchClearQueryElemen.hidden = true
luoe 2016/04/23 00:01:57 Done.
36 this._searchClearQueryElement.addEventListener("click", this._onSearchClearQ uery.bind(this), false);
37
33 this._ignoreCaseLabel = createCheckboxLabel(WebInspector.UIString("Ignore ca se")); 38 this._ignoreCaseLabel = createCheckboxLabel(WebInspector.UIString("Ignore ca se"));
34 this._ignoreCaseLabel.classList.add("search-config-label"); 39 this._ignoreCaseLabel.classList.add("search-config-label");
35 this._searchPanelElement.appendChild(this._ignoreCaseLabel); 40 this._searchPanelElement.appendChild(this._ignoreCaseLabel);
36 this._ignoreCaseCheckbox = this._ignoreCaseLabel.checkboxElement; 41 this._ignoreCaseCheckbox = this._ignoreCaseLabel.checkboxElement;
37 this._ignoreCaseCheckbox.classList.add("search-config-checkbox"); 42 this._ignoreCaseCheckbox.classList.add("search-config-checkbox");
38 43
39 this._regexLabel = createCheckboxLabel(WebInspector.UIString("Regular expres sion")); 44 this._regexLabel = createCheckboxLabel(WebInspector.UIString("Regular expres sion"));
40 this._regexLabel.classList.add("search-config-label"); 45 this._regexLabel.classList.add("search-config-label");
41 this._searchPanelElement.appendChild(this._regexLabel); 46 this._searchPanelElement.appendChild(this._regexLabel);
42 this._regexCheckbox = this._regexLabel.checkboxElement; 47 this._regexCheckbox = this._regexLabel.checkboxElement;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 { 99 {
95 this._isIndexing = true; 100 this._isIndexing = true;
96 if (this._progressIndicator) 101 if (this._progressIndicator)
97 this._progressIndicator.done(); 102 this._progressIndicator.done();
98 this._progressIndicator = new WebInspector.ProgressIndicator(); 103 this._progressIndicator = new WebInspector.ProgressIndicator();
99 this._searchMessageElement.textContent = WebInspector.UIString("Indexing \u2026"); 104 this._searchMessageElement.textContent = WebInspector.UIString("Indexing \u2026");
100 this._progressIndicator.show(this._searchProgressPlaceholderElement); 105 this._progressIndicator.show(this._searchProgressPlaceholderElement);
101 this._searchScope.performIndexing(new WebInspector.ProgressProxy(this._p rogressIndicator, this._onIndexingFinished.bind(this))); 106 this._searchScope.performIndexing(new WebInspector.ProgressProxy(this._p rogressIndicator, this._onIndexingFinished.bind(this)));
102 }, 107 },
103 108
109 _onSearchClearQuery: function()
110 {
111 this._search.value = "";
112 },
113
104 /** 114 /**
105 * @param {number} searchId 115 * @param {number} searchId
106 * @param {!WebInspector.FileBasedSearchResult} searchResult 116 * @param {!WebInspector.FileBasedSearchResult} searchResult
107 */ 117 */
108 _onSearchResult: function(searchId, searchResult) 118 _onSearchResult: function(searchId, searchResult)
109 { 119 {
110 if (searchId !== this._searchId || !this._progressIndicator) 120 if (searchId !== this._searchId || !this._progressIndicator)
111 return; 121 return;
112 if (this._progressIndicator && this._progressIndicator.isCanceled()) { 122 if (this._progressIndicator && this._progressIndicator.isCanceled()) {
113 this._onIndexingFinished(); 123 this._onIndexingFinished();
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 /** 265 /**
256 * @param {boolean} finished 266 * @param {boolean} finished
257 */ 267 */
258 _searchFinished: function(finished) 268 _searchFinished: function(finished)
259 { 269 {
260 this._searchMessageElement.textContent = finished ? WebInspector.UIStrin g("Search finished.") : WebInspector.UIString("Search interrupted."); 270 this._searchMessageElement.textContent = finished ? WebInspector.UIStrin g("Search finished.") : WebInspector.UIString("Search interrupted.");
261 }, 271 },
262 272
263 focus: function() 273 focus: function()
264 { 274 {
275 this._searchClearQueryElement.classList.remove("hidden");
lushnikov 2016/04/22 19:19:08 when do you want to show this button? Only for foc
luoe 2016/04/23 00:01:57 In patch 4, it only shows up when there is text in
265 WebInspector.setCurrentFocusElement(this._search); 276 WebInspector.setCurrentFocusElement(this._search);
266 this._search.select(); 277 this._search.select();
267 }, 278 },
268 279
269 willHide: function() 280 willHide: function()
270 { 281 {
271 this._stopSearch(); 282 this._stopSearch();
272 }, 283 },
273 284
274 /** 285 /**
(...skipping 12 matching lines...) Expand all
287 { 298 {
288 this._advancedSearchConfig.set(this._buildSearchConfig().toPlainObject() ); 299 this._advancedSearchConfig.set(this._buildSearchConfig().toPlainObject() );
289 }, 300 },
290 301
291 _load: function() 302 _load: function()
292 { 303 {
293 var searchConfig = WebInspector.SearchConfig.fromPlainObject(this._advan cedSearchConfig.get()); 304 var searchConfig = WebInspector.SearchConfig.fromPlainObject(this._advan cedSearchConfig.get());
294 this._search.value = searchConfig.query(); 305 this._search.value = searchConfig.query();
295 this._ignoreCaseCheckbox.checked = searchConfig.ignoreCase(); 306 this._ignoreCaseCheckbox.checked = searchConfig.ignoreCase();
296 this._regexCheckbox.checked = searchConfig.isRegex(); 307 this._regexCheckbox.checked = searchConfig.isRegex();
308 if (this._search.value && this._search.value.length)
309 this._searchClearQueryElement.classList.remove("hidden");
297 }, 310 },
298 311
299 _onAction: function() 312 _onAction: function()
300 { 313 {
301 var searchConfig = this._buildSearchConfig(); 314 var searchConfig = this._buildSearchConfig();
302 if (!searchConfig.query() || !searchConfig.query().length) 315 if (!searchConfig.query() || !searchConfig.query().length)
303 return; 316 return;
304 317
305 this._save(); 318 this._save();
306 this._startSearch(searchConfig); 319 this._startSearch(searchConfig);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 performIndexing: function(progress) { }, 440 performIndexing: function(progress) { },
428 441
429 stopSearch: function() { }, 442 stopSearch: function() { },
430 443
431 /** 444 /**
432 * @param {!WebInspector.ProjectSearchConfig} searchConfig 445 * @param {!WebInspector.ProjectSearchConfig} searchConfig
433 * @return {!WebInspector.SearchResultsPane} 446 * @return {!WebInspector.SearchResultsPane}
434 */ 447 */
435 createSearchResultsPane: function(searchConfig) { } 448 createSearchResultsPane: function(searchConfig) { }
436 } 449 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698