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

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

Issue 2657743003: DevTools: migrate icons in "search across files" to UI.Icon (Closed)
Patch Set: address comments Created 3 years, 10 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/sources/sourcesSearch.css » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 * @unrestricted 5 * @unrestricted
6 */ 6 */
7 Sources.AdvancedSearchView = class extends UI.VBox { 7 Sources.AdvancedSearchView = class extends UI.VBox {
8 constructor() { 8 constructor() {
9 super(true); 9 super(true);
10 this.setMinimumSize(0, 40); 10 this.setMinimumSize(0, 40);
(...skipping 11 matching lines...) Expand all
22 this._searchResultsElement.className = 'search-results'; 22 this._searchResultsElement.className = 'search-results';
23 23
24 this._search = UI.HistoryInput.create(); 24 this._search = UI.HistoryInput.create();
25 this._searchPanelElement.appendChild(this._search); 25 this._searchPanelElement.appendChild(this._search);
26 this._search.placeholder = Common.UIString('Search all sources (use "file:" to filter by path)\u200e'); 26 this._search.placeholder = Common.UIString('Search all sources (use "file:" to filter by path)\u200e');
27 this._search.setAttribute('type', 'text'); 27 this._search.setAttribute('type', 'text');
28 this._search.classList.add('search-config-search'); 28 this._search.classList.add('search-config-search');
29 this._search.setAttribute('results', '0'); 29 this._search.setAttribute('results', '0');
30 this._search.setAttribute('size', 42); 30 this._search.setAttribute('size', 42);
31 31
32 this._searchPanelElement.createChild('div', 'search-icon'); 32 var searchIcon = UI.Icon.create('smallicon-search', 'search-icon');
33 this._searchInputClearElement = this._searchPanelElement.createChild('div', 'search-cancel-button'); 33 this._searchPanelElement.appendChild(searchIcon);
34 this._searchInputClearElement.hidden = true; 34
35 this._searchInputClearElement = UI.Icon.create('smallicon-clear-input', 'sea rch-cancel-button');
36 this._searchInputClearElement.classList.add('hidden');
35 this._searchInputClearElement.addEventListener('click', this._onSearchInputC lear.bind(this), false); 37 this._searchInputClearElement.addEventListener('click', this._onSearchInputC lear.bind(this), false);
38 var cancelButtonContainer = this._searchPanelElement.createChild('div', 'sea rch-cancel-button-container');
39 cancelButtonContainer.appendChild(this._searchInputClearElement);
36 40
37 this._ignoreCaseLabel = UI.createCheckboxLabel(Common.UIString('Ignore case' )); 41 this._ignoreCaseLabel = UI.createCheckboxLabel(Common.UIString('Ignore case' ));
38 this._ignoreCaseLabel.classList.add('search-config-label'); 42 this._ignoreCaseLabel.classList.add('search-config-label');
39 this._searchPanelElement.appendChild(this._ignoreCaseLabel); 43 this._searchPanelElement.appendChild(this._ignoreCaseLabel);
40 this._ignoreCaseCheckbox = this._ignoreCaseLabel.checkboxElement; 44 this._ignoreCaseCheckbox = this._ignoreCaseLabel.checkboxElement;
41 this._ignoreCaseCheckbox.classList.add('search-config-checkbox'); 45 this._ignoreCaseCheckbox.classList.add('search-config-checkbox');
42 46
43 this._regexLabel = UI.createCheckboxLabel(Common.UIString('Regular expressio n')); 47 this._regexLabel = UI.createCheckboxLabel(Common.UIString('Regular expressio n'));
44 this._regexLabel.classList.add('search-config-label'); 48 this._regexLabel.classList.add('search-config-label');
45 this._searchPanelElement.appendChild(this._regexLabel); 49 this._searchPanelElement.appendChild(this._regexLabel);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 this._progressIndicator = new UI.ProgressIndicator(); 129 this._progressIndicator = new UI.ProgressIndicator();
126 this._searchMessageElement.textContent = Common.UIString('Indexing\u2026'); 130 this._searchMessageElement.textContent = Common.UIString('Indexing\u2026');
127 this._progressIndicator.show(this._searchProgressPlaceholderElement); 131 this._progressIndicator.show(this._searchProgressPlaceholderElement);
128 this._searchScope.performIndexing( 132 this._searchScope.performIndexing(
129 new Common.ProgressProxy(this._progressIndicator, this._onIndexingFinish ed.bind(this))); 133 new Common.ProgressProxy(this._progressIndicator, this._onIndexingFinish ed.bind(this)));
130 } 134 }
131 135
132 _onSearchInputClear() { 136 _onSearchInputClear() {
133 this._search.value = ''; 137 this._search.value = '';
134 this.focus(); 138 this.focus();
135 this._searchInputClearElement.hidden = true; 139 this._searchInputClearElement.classList.add('hidden');
136 } 140 }
137 141
138 /** 142 /**
139 * @param {number} searchId 143 * @param {number} searchId
140 * @param {!Sources.FileBasedSearchResult} searchResult 144 * @param {!Sources.FileBasedSearchResult} searchResult
141 */ 145 */
142 _onSearchResult(searchId, searchResult) { 146 _onSearchResult(searchId, searchResult) {
143 if (searchId !== this._searchId || !this._progressIndicator) 147 if (searchId !== this._searchId || !this._progressIndicator)
144 return; 148 return;
145 if (this._progressIndicator && this._progressIndicator.isCanceled()) { 149 if (this._progressIndicator && this._progressIndicator.isCanceled()) {
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 */ 316 */
313 _onKeyDown(event) { 317 _onKeyDown(event) {
314 switch (event.keyCode) { 318 switch (event.keyCode) {
315 case UI.KeyboardShortcut.Keys.Enter.code: 319 case UI.KeyboardShortcut.Keys.Enter.code:
316 this._onAction(); 320 this._onAction();
317 break; 321 break;
318 } 322 }
319 } 323 }
320 324
321 _onInput() { 325 _onInput() {
322 if (this._search.value && this._search.value.length) 326 var hasText = this._search.value && this._search.value.length;
323 this._searchInputClearElement.hidden = false; 327 this._searchInputClearElement.classList.toggle('hidden', !hasText);
324 else
325 this._searchInputClearElement.hidden = true;
326 } 328 }
327 329
328 _save() { 330 _save() {
329 this._advancedSearchConfig.set(this._buildSearchConfig().toPlainObject()); 331 this._advancedSearchConfig.set(this._buildSearchConfig().toPlainObject());
330 } 332 }
331 333
332 _load() { 334 _load() {
333 var searchConfig = Workspace.SearchConfig.fromPlainObject(this._advancedSear chConfig.get()); 335 var searchConfig = Workspace.SearchConfig.fromPlainObject(this._advancedSear chConfig.get());
334 this._search.value = searchConfig.query(); 336 this._search.value = searchConfig.query();
335 this._ignoreCaseCheckbox.checked = searchConfig.ignoreCase(); 337 this._ignoreCaseCheckbox.checked = searchConfig.ignoreCase();
336 this._regexCheckbox.checked = searchConfig.isRegex(); 338 this._regexCheckbox.checked = searchConfig.isRegex();
337 if (this._search.value && this._search.value.length) 339 if (this._search.value && this._search.value.length)
338 this._searchInputClearElement.hidden = false; 340 this._searchInputClearElement.classList.remove('hidden');
339 } 341 }
340 342
341 _onAction() { 343 _onAction() {
342 var searchConfig = this._buildSearchConfig(); 344 var searchConfig = this._buildSearchConfig();
343 if (!searchConfig.query() || !searchConfig.query().length) 345 if (!searchConfig.query() || !searchConfig.query().length)
344 return; 346 return;
345 347
346 this._save(); 348 this._save();
347 this._startSearch(searchConfig); 349 this._startSearch(searchConfig);
348 } 350 }
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 performIndexing(progress) {}, 436 performIndexing(progress) {},
435 437
436 stopSearch() {}, 438 stopSearch() {},
437 439
438 /** 440 /**
439 * @param {!Workspace.ProjectSearchConfig} searchConfig 441 * @param {!Workspace.ProjectSearchConfig} searchConfig
440 * @return {!Sources.SearchResultsPane} 442 * @return {!Sources.SearchResultsPane}
441 */ 443 */
442 createSearchResultsPane(searchConfig) {} 444 createSearchResultsPane(searchConfig) {}
443 }; 445 };
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/sources/sourcesSearch.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698