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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/ui/SearchableView.js

Issue 2829433002: DevTools: hide the replace input when it replace is disabled (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). 3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com).
4 * Copyright (C) 2009 Joseph Pecoraro 4 * Copyright (C) 2009 Joseph Pecoraro
5 * Copyright (C) 2011 Google Inc. All rights reserved. 5 * Copyright (C) 2011 Google Inc. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 10 *
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 this._searchNavigationPrevElement.title = Common.UIString('Search Previous') ; 88 this._searchNavigationPrevElement.title = Common.UIString('Search Previous') ;
89 89
90 this._searchNavigationNextElement = 90 this._searchNavigationNextElement =
91 searchNavigationElement.createChild('div', 'toolbar-search-navigation to olbar-search-navigation-next'); 91 searchNavigationElement.createChild('div', 'toolbar-search-navigation to olbar-search-navigation-next');
92 this._searchNavigationNextElement.addEventListener('click', this._onNextButt onSearch.bind(this), false); 92 this._searchNavigationNextElement.addEventListener('click', this._onNextButt onSearch.bind(this), false);
93 this._searchNavigationNextElement.title = Common.UIString('Search Next'); 93 this._searchNavigationNextElement.title = Common.UIString('Search Next');
94 94
95 this._searchInputElement.addEventListener('keydown', this._onSearchKeyDown.b ind(this), true); 95 this._searchInputElement.addEventListener('keydown', this._onSearchKeyDown.b ind(this), true);
96 this._searchInputElement.addEventListener('input', this._onInput.bind(this), false); 96 this._searchInputElement.addEventListener('input', this._onInput.bind(this), false);
97 97
98 this._replaceInputElement = searchInputElements.createChild('input', 'search -replace toolbar-replace-control'); 98 this._replaceInputElement =
99 searchInputElements.createChild('input', 'search-replace toolbar-replace -control hidden');
99 this._replaceInputElement.addEventListener('keydown', this._onReplaceKeyDown .bind(this), true); 100 this._replaceInputElement.addEventListener('keydown', this._onReplaceKeyDown .bind(this), true);
100 this._replaceInputElement.placeholder = Common.UIString('Replace'); 101 this._replaceInputElement.placeholder = Common.UIString('Replace');
101 102
102 // Build the buttons (Find, Previous, Replace, Replace All). 103 // Build the buttons (Find, Previous, Replace, Replace All).
103 this._buttonsContainer = this._footerElement.createChild('div', 'toolbar-sea rch-buttons hidden'); 104 this._buttonsContainer = this._footerElement.createChild('div', 'toolbar-sea rch-buttons hidden');
104 105
105 var findButtonElement = this._buttonsContainer.createChild('button', 'search -action-button'); 106 var findButtonElement = this._buttonsContainer.createChild('button', 'search -action-button');
106 findButtonElement.textContent = Common.UIString('Find'); 107 findButtonElement.textContent = Common.UIString('Find');
107 findButtonElement.tabIndex = -1; 108 findButtonElement.tabIndex = -1;
108 findButtonElement.addEventListener('click', this._onFindClick.bind(this), fa lse); 109 findButtonElement.addEventListener('click', this._onFindClick.bind(this), fa lse);
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 var query = this._searchInputElement.value; 462 var query = this._searchInputElement.value;
462 var caseSensitive = this._caseSensitiveButton ? this._caseSensitiveButton.to ggled() : false; 463 var caseSensitive = this._caseSensitiveButton ? this._caseSensitiveButton.to ggled() : false;
463 var isRegex = this._regexButton ? this._regexButton.toggled() : false; 464 var isRegex = this._regexButton ? this._regexButton.toggled() : false;
464 return new UI.SearchableView.SearchConfig(query, caseSensitive, isRegex); 465 return new UI.SearchableView.SearchConfig(query, caseSensitive, isRegex);
465 } 466 }
466 467
467 _updateSecondRowVisibility() { 468 _updateSecondRowVisibility() {
468 var secondRowVisible = this._replaceCheckboxElement.checked; 469 var secondRowVisible = this._replaceCheckboxElement.checked;
469 this._footerElementContainer.classList.toggle('replaceable', secondRowVisibl e); 470 this._footerElementContainer.classList.toggle('replaceable', secondRowVisibl e);
470 this._buttonsContainer.classList.toggle('hidden', !secondRowVisible); 471 this._buttonsContainer.classList.toggle('hidden', !secondRowVisible);
472 this._replaceInputElement.classList.toggle('hidden', !secondRowVisible);
471 this._replaceCheckboxElement.tabIndex = secondRowVisible ? -1 : 0; 473 this._replaceCheckboxElement.tabIndex = secondRowVisible ? -1 : 0;
472 474
473 if (secondRowVisible) 475 if (secondRowVisible)
474 this._replaceInputElement.focus(); 476 this._replaceInputElement.focus();
475 else 477 else
476 this._searchInputElement.focus(); 478 this._searchInputElement.focus();
477 this.doResize(); 479 this.doResize();
478 } 480 }
479 481
480 _replace() { 482 _replace() {
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 // Silent catch. 601 // Silent catch.
600 } 602 }
601 603
602 // Otherwise just do a plain text search. 604 // Otherwise just do a plain text search.
603 if (!regex) 605 if (!regex)
604 regex = createPlainTextSearchRegex(query, modifiers); 606 regex = createPlainTextSearchRegex(query, modifiers);
605 607
606 return regex; 608 return regex;
607 } 609 }
608 }; 610 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698