| OLD | NEW |
| 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 14 matching lines...) Expand all Loading... |
| 25 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 25 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 26 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 26 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 27 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 */ | 30 */ |
| 31 | 31 |
| 32 /** | 32 /** |
| 33 * @unrestricted | 33 * @unrestricted |
| 34 */ | 34 */ |
| 35 WebInspector.SearchableView = class extends WebInspector.VBox { | 35 UI.SearchableView = class extends UI.VBox { |
| 36 /** | 36 /** |
| 37 * @param {!WebInspector.Searchable} searchable | 37 * @param {!UI.Searchable} searchable |
| 38 * @param {string=} settingName | 38 * @param {string=} settingName |
| 39 */ | 39 */ |
| 40 constructor(searchable, settingName) { | 40 constructor(searchable, settingName) { |
| 41 super(true); | 41 super(true); |
| 42 this.registerRequiredCSS('ui/searchableView.css'); | 42 this.registerRequiredCSS('ui/searchableView.css'); |
| 43 this.element[WebInspector.SearchableView._symbol] = this; | 43 this.element[UI.SearchableView._symbol] = this; |
| 44 | 44 |
| 45 this._searchProvider = searchable; | 45 this._searchProvider = searchable; |
| 46 this._setting = settingName ? WebInspector.settings.createSetting(settingNam
e, {}) : null; | 46 this._setting = settingName ? Common.settings.createSetting(settingName, {})
: null; |
| 47 | 47 |
| 48 this.contentElement.createChild('content'); | 48 this.contentElement.createChild('content'); |
| 49 this._footerElementContainer = this.contentElement.createChild('div', 'searc
h-bar hidden'); | 49 this._footerElementContainer = this.contentElement.createChild('div', 'searc
h-bar hidden'); |
| 50 this._footerElementContainer.style.order = 100; | 50 this._footerElementContainer.style.order = 100; |
| 51 | 51 |
| 52 var toolbar = new WebInspector.Toolbar('search-toolbar', this._footerElement
Container); | 52 var toolbar = new UI.Toolbar('search-toolbar', this._footerElementContainer)
; |
| 53 | 53 |
| 54 if (this._searchProvider.supportsCaseSensitiveSearch()) { | 54 if (this._searchProvider.supportsCaseSensitiveSearch()) { |
| 55 this._caseSensitiveButton = new WebInspector.ToolbarToggle(WebInspector.UI
String('Case sensitive'), ''); | 55 this._caseSensitiveButton = new UI.ToolbarToggle(Common.UIString('Case sen
sitive'), ''); |
| 56 this._caseSensitiveButton.setText('Aa'); | 56 this._caseSensitiveButton.setText('Aa'); |
| 57 this._caseSensitiveButton.addEventListener('click', this._toggleCaseSensit
iveSearch, this); | 57 this._caseSensitiveButton.addEventListener('click', this._toggleCaseSensit
iveSearch, this); |
| 58 toolbar.appendToolbarItem(this._caseSensitiveButton); | 58 toolbar.appendToolbarItem(this._caseSensitiveButton); |
| 59 } | 59 } |
| 60 | 60 |
| 61 if (this._searchProvider.supportsRegexSearch()) { | 61 if (this._searchProvider.supportsRegexSearch()) { |
| 62 this._regexButton = new WebInspector.ToolbarToggle(WebInspector.UIString('
Regex'), ''); | 62 this._regexButton = new UI.ToolbarToggle(Common.UIString('Regex'), ''); |
| 63 this._regexButton.setText('.*'); | 63 this._regexButton.setText('.*'); |
| 64 this._regexButton.addEventListener('click', this._toggleRegexSearch, this)
; | 64 this._regexButton.addEventListener('click', this._toggleRegexSearch, this)
; |
| 65 toolbar.appendToolbarItem(this._regexButton); | 65 toolbar.appendToolbarItem(this._regexButton); |
| 66 } | 66 } |
| 67 | 67 |
| 68 this._footerElement = this._footerElementContainer.createChild('table', 'too
lbar-search'); | 68 this._footerElement = this._footerElementContainer.createChild('table', 'too
lbar-search'); |
| 69 this._footerElement.cellSpacing = 0; | 69 this._footerElement.cellSpacing = 0; |
| 70 | 70 |
| 71 this._firstRowElement = this._footerElement.createChild('tr'); | 71 this._firstRowElement = this._footerElement.createChild('tr'); |
| 72 this._secondRowElement = this._footerElement.createChild('tr', 'hidden'); | 72 this._secondRowElement = this._footerElement.createChild('tr', 'hidden'); |
| 73 | 73 |
| 74 // Column 1 | 74 // Column 1 |
| 75 var searchControlElementColumn = this._firstRowElement.createChild('td'); | 75 var searchControlElementColumn = this._firstRowElement.createChild('td'); |
| 76 this._searchControlElement = searchControlElementColumn.createChild('span',
'toolbar-search-control'); | 76 this._searchControlElement = searchControlElementColumn.createChild('span',
'toolbar-search-control'); |
| 77 | 77 |
| 78 this._searchInputElement = WebInspector.HistoryInput.create(); | 78 this._searchInputElement = UI.HistoryInput.create(); |
| 79 this._searchInputElement.classList.add('search-replace'); | 79 this._searchInputElement.classList.add('search-replace'); |
| 80 this._searchControlElement.appendChild(this._searchInputElement); | 80 this._searchControlElement.appendChild(this._searchInputElement); |
| 81 | 81 |
| 82 this._searchInputElement.id = 'search-input-field'; | 82 this._searchInputElement.id = 'search-input-field'; |
| 83 this._searchInputElement.placeholder = WebInspector.UIString('Find'); | 83 this._searchInputElement.placeholder = Common.UIString('Find'); |
| 84 | 84 |
| 85 this._matchesElement = this._searchControlElement.createChild('label', 'sear
ch-results-matches'); | 85 this._matchesElement = this._searchControlElement.createChild('label', 'sear
ch-results-matches'); |
| 86 this._matchesElement.setAttribute('for', 'search-input-field'); | 86 this._matchesElement.setAttribute('for', 'search-input-field'); |
| 87 | 87 |
| 88 this._searchNavigationElement = this._searchControlElement.createChild('div'
, 'toolbar-search-navigation-controls'); | 88 this._searchNavigationElement = this._searchControlElement.createChild('div'
, 'toolbar-search-navigation-controls'); |
| 89 | 89 |
| 90 this._searchNavigationPrevElement = | 90 this._searchNavigationPrevElement = |
| 91 this._searchNavigationElement.createChild('div', 'toolbar-search-navigat
ion toolbar-search-navigation-prev'); | 91 this._searchNavigationElement.createChild('div', 'toolbar-search-navigat
ion toolbar-search-navigation-prev'); |
| 92 this._searchNavigationPrevElement.addEventListener('click', this._onPrevButt
onSearch.bind(this), false); | 92 this._searchNavigationPrevElement.addEventListener('click', this._onPrevButt
onSearch.bind(this), false); |
| 93 this._searchNavigationPrevElement.title = WebInspector.UIString('Search Prev
ious'); | 93 this._searchNavigationPrevElement.title = Common.UIString('Search Previous')
; |
| 94 | 94 |
| 95 this._searchNavigationNextElement = | 95 this._searchNavigationNextElement = |
| 96 this._searchNavigationElement.createChild('div', 'toolbar-search-navigat
ion toolbar-search-navigation-next'); | 96 this._searchNavigationElement.createChild('div', 'toolbar-search-navigat
ion toolbar-search-navigation-next'); |
| 97 this._searchNavigationNextElement.addEventListener('click', this._onNextButt
onSearch.bind(this), false); | 97 this._searchNavigationNextElement.addEventListener('click', this._onNextButt
onSearch.bind(this), false); |
| 98 this._searchNavigationNextElement.title = WebInspector.UIString('Search Next
'); | 98 this._searchNavigationNextElement.title = Common.UIString('Search Next'); |
| 99 | 99 |
| 100 this._searchInputElement.addEventListener('keydown', this._onSearchKeyDown.b
ind(this), true); | 100 this._searchInputElement.addEventListener('keydown', this._onSearchKeyDown.b
ind(this), true); |
| 101 this._searchInputElement.addEventListener('input', this._onInput.bind(this),
false); | 101 this._searchInputElement.addEventListener('input', this._onInput.bind(this),
false); |
| 102 | 102 |
| 103 this._replaceInputElement = | 103 this._replaceInputElement = |
| 104 this._secondRowElement.createChild('td').createChild('input', 'search-re
place toolbar-replace-control'); | 104 this._secondRowElement.createChild('td').createChild('input', 'search-re
place toolbar-replace-control'); |
| 105 this._replaceInputElement.addEventListener('keydown', this._onReplaceKeyDown
.bind(this), true); | 105 this._replaceInputElement.addEventListener('keydown', this._onReplaceKeyDown
.bind(this), true); |
| 106 this._replaceInputElement.placeholder = WebInspector.UIString('Replace'); | 106 this._replaceInputElement.placeholder = Common.UIString('Replace'); |
| 107 | 107 |
| 108 // Column 2 | 108 // Column 2 |
| 109 this._findButtonElement = | 109 this._findButtonElement = |
| 110 this._firstRowElement.createChild('td').createChild('button', 'search-ac
tion-button hidden'); | 110 this._firstRowElement.createChild('td').createChild('button', 'search-ac
tion-button hidden'); |
| 111 this._findButtonElement.textContent = WebInspector.UIString('Find'); | 111 this._findButtonElement.textContent = Common.UIString('Find'); |
| 112 this._findButtonElement.tabIndex = -1; | 112 this._findButtonElement.tabIndex = -1; |
| 113 this._findButtonElement.addEventListener('click', this._onFindClick.bind(thi
s), false); | 113 this._findButtonElement.addEventListener('click', this._onFindClick.bind(thi
s), false); |
| 114 | 114 |
| 115 this._replaceButtonElement = this._secondRowElement.createChild('td').create
Child('button', 'search-action-button'); | 115 this._replaceButtonElement = this._secondRowElement.createChild('td').create
Child('button', 'search-action-button'); |
| 116 this._replaceButtonElement.textContent = WebInspector.UIString('Replace'); | 116 this._replaceButtonElement.textContent = Common.UIString('Replace'); |
| 117 this._replaceButtonElement.disabled = true; | 117 this._replaceButtonElement.disabled = true; |
| 118 this._replaceButtonElement.tabIndex = -1; | 118 this._replaceButtonElement.tabIndex = -1; |
| 119 this._replaceButtonElement.addEventListener('click', this._replace.bind(this
), false); | 119 this._replaceButtonElement.addEventListener('click', this._replace.bind(this
), false); |
| 120 | 120 |
| 121 // Column 3 | 121 // Column 3 |
| 122 this._prevButtonElement = | 122 this._prevButtonElement = |
| 123 this._firstRowElement.createChild('td').createChild('button', 'search-ac
tion-button hidden'); | 123 this._firstRowElement.createChild('td').createChild('button', 'search-ac
tion-button hidden'); |
| 124 this._prevButtonElement.textContent = WebInspector.UIString('Previous'); | 124 this._prevButtonElement.textContent = Common.UIString('Previous'); |
| 125 this._prevButtonElement.tabIndex = -1; | 125 this._prevButtonElement.tabIndex = -1; |
| 126 this._prevButtonElement.addEventListener('click', this._onPreviousClick.bind
(this), false); | 126 this._prevButtonElement.addEventListener('click', this._onPreviousClick.bind
(this), false); |
| 127 | 127 |
| 128 this._replaceAllButtonElement = | 128 this._replaceAllButtonElement = |
| 129 this._secondRowElement.createChild('td').createChild('button', 'search-a
ction-button'); | 129 this._secondRowElement.createChild('td').createChild('button', 'search-a
ction-button'); |
| 130 this._replaceAllButtonElement.textContent = WebInspector.UIString('Replace A
ll'); | 130 this._replaceAllButtonElement.textContent = Common.UIString('Replace All'); |
| 131 this._replaceAllButtonElement.addEventListener('click', this._replaceAll.bin
d(this), false); | 131 this._replaceAllButtonElement.addEventListener('click', this._replaceAll.bin
d(this), false); |
| 132 | 132 |
| 133 // Column 4 | 133 // Column 4 |
| 134 this._replaceElement = this._firstRowElement.createChild('td').createChild('
span'); | 134 this._replaceElement = this._firstRowElement.createChild('td').createChild('
span'); |
| 135 | 135 |
| 136 this._replaceLabelElement = createCheckboxLabel(WebInspector.UIString('Repla
ce')); | 136 this._replaceLabelElement = createCheckboxLabel(Common.UIString('Replace')); |
| 137 this._replaceCheckboxElement = this._replaceLabelElement.checkboxElement; | 137 this._replaceCheckboxElement = this._replaceLabelElement.checkboxElement; |
| 138 this._uniqueId = ++WebInspector.SearchableView._lastUniqueId; | 138 this._uniqueId = ++UI.SearchableView._lastUniqueId; |
| 139 var replaceCheckboxId = 'search-replace-trigger' + this._uniqueId; | 139 var replaceCheckboxId = 'search-replace-trigger' + this._uniqueId; |
| 140 this._replaceCheckboxElement.id = replaceCheckboxId; | 140 this._replaceCheckboxElement.id = replaceCheckboxId; |
| 141 this._replaceCheckboxElement.addEventListener('change', this._updateSecondRo
wVisibility.bind(this), false); | 141 this._replaceCheckboxElement.addEventListener('change', this._updateSecondRo
wVisibility.bind(this), false); |
| 142 | 142 |
| 143 this._replaceElement.appendChild(this._replaceLabelElement); | 143 this._replaceElement.appendChild(this._replaceLabelElement); |
| 144 | 144 |
| 145 // Column 5 | 145 // Column 5 |
| 146 var cancelButtonElement = this._firstRowElement.createChild('td').createChil
d('button', 'search-action-button'); | 146 var cancelButtonElement = this._firstRowElement.createChild('td').createChil
d('button', 'search-action-button'); |
| 147 cancelButtonElement.textContent = WebInspector.UIString('Cancel'); | 147 cancelButtonElement.textContent = Common.UIString('Cancel'); |
| 148 cancelButtonElement.tabIndex = -1; | 148 cancelButtonElement.tabIndex = -1; |
| 149 cancelButtonElement.addEventListener('click', this.closeSearch.bind(this), f
alse); | 149 cancelButtonElement.addEventListener('click', this.closeSearch.bind(this), f
alse); |
| 150 this._minimalSearchQuerySize = 3; | 150 this._minimalSearchQuerySize = 3; |
| 151 | 151 |
| 152 this._loadSetting(); | 152 this._loadSetting(); |
| 153 } | 153 } |
| 154 | 154 |
| 155 /** | 155 /** |
| 156 * @param {?Element} element | 156 * @param {?Element} element |
| 157 * @return {?WebInspector.SearchableView} | 157 * @return {?UI.SearchableView} |
| 158 */ | 158 */ |
| 159 static fromElement(element) { | 159 static fromElement(element) { |
| 160 var view = null; | 160 var view = null; |
| 161 while (element && !view) { | 161 while (element && !view) { |
| 162 view = element[WebInspector.SearchableView._symbol]; | 162 view = element[UI.SearchableView._symbol]; |
| 163 element = element.parentElementOrShadowHost(); | 163 element = element.parentElementOrShadowHost(); |
| 164 } | 164 } |
| 165 return view; | 165 return view; |
| 166 } | 166 } |
| 167 | 167 |
| 168 _toggleCaseSensitiveSearch() { | 168 _toggleCaseSensitiveSearch() { |
| 169 this._caseSensitiveButton.setToggled(!this._caseSensitiveButton.toggled()); | 169 this._caseSensitiveButton.setToggled(!this._caseSensitiveButton.toggled()); |
| 170 this._saveSetting(); | 170 this._saveSetting(); |
| 171 this._performSearch(false, true); | 171 this._performSearch(false, true); |
| 172 } | 172 } |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 } | 322 } |
| 323 | 323 |
| 324 /** | 324 /** |
| 325 * @param {number} matches | 325 * @param {number} matches |
| 326 * @param {number} currentMatchIndex | 326 * @param {number} currentMatchIndex |
| 327 */ | 327 */ |
| 328 _updateSearchMatchesCountAndCurrentMatchIndex(matches, currentMatchIndex) { | 328 _updateSearchMatchesCountAndCurrentMatchIndex(matches, currentMatchIndex) { |
| 329 if (!this._currentQuery) | 329 if (!this._currentQuery) |
| 330 this._matchesElement.textContent = ''; | 330 this._matchesElement.textContent = ''; |
| 331 else if (matches === 0 || currentMatchIndex >= 0) | 331 else if (matches === 0 || currentMatchIndex >= 0) |
| 332 this._matchesElement.textContent = WebInspector.UIString('%d of %d', curre
ntMatchIndex + 1, matches); | 332 this._matchesElement.textContent = Common.UIString('%d of %d', currentMatc
hIndex + 1, matches); |
| 333 else if (matches === 1) | 333 else if (matches === 1) |
| 334 this._matchesElement.textContent = WebInspector.UIString('1 match'); | 334 this._matchesElement.textContent = Common.UIString('1 match'); |
| 335 else | 335 else |
| 336 this._matchesElement.textContent = WebInspector.UIString('%d matches', mat
ches); | 336 this._matchesElement.textContent = Common.UIString('%d matches', matches); |
| 337 this._updateSearchNavigationButtonState(matches > 0); | 337 this._updateSearchNavigationButtonState(matches > 0); |
| 338 } | 338 } |
| 339 | 339 |
| 340 showSearchField() { | 340 showSearchField() { |
| 341 if (this._searchIsVisible) | 341 if (this._searchIsVisible) |
| 342 this.cancelSearch(); | 342 this.cancelSearch(); |
| 343 | 343 |
| 344 var queryCandidate; | 344 var queryCandidate; |
| 345 if (!this._searchInputElement.hasFocus()) { | 345 if (!this._searchInputElement.hasFocus()) { |
| 346 var selection = this._searchInputElement.getComponentSelection(); | 346 var selection = this._searchInputElement.getComponentSelection(); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 } | 457 } |
| 458 | 458 |
| 459 this._currentQuery = query; | 459 this._currentQuery = query; |
| 460 this._searchProvider.currentQuery = query; | 460 this._searchProvider.currentQuery = query; |
| 461 | 461 |
| 462 var searchConfig = this._currentSearchConfig(); | 462 var searchConfig = this._currentSearchConfig(); |
| 463 this._searchProvider.performSearch(searchConfig, shouldJump, jumpBackwards); | 463 this._searchProvider.performSearch(searchConfig, shouldJump, jumpBackwards); |
| 464 } | 464 } |
| 465 | 465 |
| 466 /** | 466 /** |
| 467 * @return {!WebInspector.SearchableView.SearchConfig} | 467 * @return {!UI.SearchableView.SearchConfig} |
| 468 */ | 468 */ |
| 469 _currentSearchConfig() { | 469 _currentSearchConfig() { |
| 470 var query = this._searchInputElement.value; | 470 var query = this._searchInputElement.value; |
| 471 var caseSensitive = this._caseSensitiveButton ? this._caseSensitiveButton.to
ggled() : false; | 471 var caseSensitive = this._caseSensitiveButton ? this._caseSensitiveButton.to
ggled() : false; |
| 472 var isRegex = this._regexButton ? this._regexButton.toggled() : false; | 472 var isRegex = this._regexButton ? this._regexButton.toggled() : false; |
| 473 return new WebInspector.SearchableView.SearchConfig(query, caseSensitive, is
Regex); | 473 return new UI.SearchableView.SearchConfig(query, caseSensitive, isRegex); |
| 474 } | 474 } |
| 475 | 475 |
| 476 _updateSecondRowVisibility() { | 476 _updateSecondRowVisibility() { |
| 477 var secondRowVisible = this._replaceCheckboxElement.checked; | 477 var secondRowVisible = this._replaceCheckboxElement.checked; |
| 478 this._footerElementContainer.classList.toggle('replaceable', secondRowVisibl
e); | 478 this._footerElementContainer.classList.toggle('replaceable', secondRowVisibl
e); |
| 479 this._footerElement.classList.toggle('toolbar-search-replace', secondRowVisi
ble); | 479 this._footerElement.classList.toggle('toolbar-search-replace', secondRowVisi
ble); |
| 480 this._secondRowElement.classList.toggle('hidden', !secondRowVisible); | 480 this._secondRowElement.classList.toggle('hidden', !secondRowVisible); |
| 481 this._prevButtonElement.classList.toggle('hidden', !secondRowVisible); | 481 this._prevButtonElement.classList.toggle('hidden', !secondRowVisible); |
| 482 this._findButtonElement.classList.toggle('hidden', !secondRowVisible); | 482 this._findButtonElement.classList.toggle('hidden', !secondRowVisible); |
| 483 this._replaceCheckboxElement.tabIndex = secondRowVisible ? -1 : 0; | 483 this._replaceCheckboxElement.tabIndex = secondRowVisible ? -1 : 0; |
| 484 | 484 |
| 485 if (secondRowVisible) | 485 if (secondRowVisible) |
| 486 this._replaceInputElement.focus(); | 486 this._replaceInputElement.focus(); |
| 487 else | 487 else |
| 488 this._searchInputElement.focus(); | 488 this._searchInputElement.focus(); |
| 489 this.doResize(); | 489 this.doResize(); |
| 490 } | 490 } |
| 491 | 491 |
| 492 _replace() { | 492 _replace() { |
| 493 var searchConfig = this._currentSearchConfig(); | 493 var searchConfig = this._currentSearchConfig(); |
| 494 /** @type {!WebInspector.Replaceable} */ (this._searchProvider) | 494 /** @type {!UI.Replaceable} */ (this._searchProvider) |
| 495 .replaceSelectionWith(searchConfig, this._replaceInputElement.value); | 495 .replaceSelectionWith(searchConfig, this._replaceInputElement.value); |
| 496 delete this._currentQuery; | 496 delete this._currentQuery; |
| 497 this._performSearch(true, true); | 497 this._performSearch(true, true); |
| 498 } | 498 } |
| 499 | 499 |
| 500 _replaceAll() { | 500 _replaceAll() { |
| 501 var searchConfig = this._currentSearchConfig(); | 501 var searchConfig = this._currentSearchConfig(); |
| 502 /** @type {!WebInspector.Replaceable} */ (this._searchProvider) | 502 /** @type {!UI.Replaceable} */ (this._searchProvider) |
| 503 .replaceAllWith(searchConfig, this._replaceInputElement.value); | 503 .replaceAllWith(searchConfig, this._replaceInputElement.value); |
| 504 } | 504 } |
| 505 | 505 |
| 506 /** | 506 /** |
| 507 * @param {!Event} event | 507 * @param {!Event} event |
| 508 */ | 508 */ |
| 509 _onInput(event) { | 509 _onInput(event) { |
| 510 if (this._valueChangedTimeoutId) | 510 if (this._valueChangedTimeoutId) |
| 511 clearTimeout(this._valueChangedTimeoutId); | 511 clearTimeout(this._valueChangedTimeoutId); |
| 512 var timeout = this._searchInputElement.value.length < 3 ? 200 : 0; | 512 var timeout = this._searchInputElement.value.length < 3 ? 200 : 0; |
| 513 this._valueChangedTimeoutId = setTimeout(this._onValueChanged.bind(this), ti
meout); | 513 this._valueChangedTimeoutId = setTimeout(this._onValueChanged.bind(this), ti
meout); |
| 514 } | 514 } |
| 515 | 515 |
| 516 _onValueChanged() { | 516 _onValueChanged() { |
| 517 if (!this._searchIsVisible) | 517 if (!this._searchIsVisible) |
| 518 return; | 518 return; |
| 519 delete this._valueChangedTimeoutId; | 519 delete this._valueChangedTimeoutId; |
| 520 this._performSearch(false, true); | 520 this._performSearch(false, true); |
| 521 } | 521 } |
| 522 }; | 522 }; |
| 523 | 523 |
| 524 WebInspector.SearchableView._lastUniqueId = 0; | 524 UI.SearchableView._lastUniqueId = 0; |
| 525 | 525 |
| 526 WebInspector.SearchableView._symbol = Symbol('searchableView'); | 526 UI.SearchableView._symbol = Symbol('searchableView'); |
| 527 | 527 |
| 528 | 528 |
| 529 /** | 529 /** |
| 530 * @interface | 530 * @interface |
| 531 */ | 531 */ |
| 532 WebInspector.Searchable = function() {}; | 532 UI.Searchable = function() {}; |
| 533 | 533 |
| 534 WebInspector.Searchable.prototype = { | 534 UI.Searchable.prototype = { |
| 535 searchCanceled: function() {}, | 535 searchCanceled: function() {}, |
| 536 | 536 |
| 537 /** | 537 /** |
| 538 * @param {!WebInspector.SearchableView.SearchConfig} searchConfig | 538 * @param {!UI.SearchableView.SearchConfig} searchConfig |
| 539 * @param {boolean} shouldJump | 539 * @param {boolean} shouldJump |
| 540 * @param {boolean=} jumpBackwards | 540 * @param {boolean=} jumpBackwards |
| 541 */ | 541 */ |
| 542 performSearch: function(searchConfig, shouldJump, jumpBackwards) {}, | 542 performSearch: function(searchConfig, shouldJump, jumpBackwards) {}, |
| 543 | 543 |
| 544 jumpToNextSearchResult: function() {}, | 544 jumpToNextSearchResult: function() {}, |
| 545 | 545 |
| 546 jumpToPreviousSearchResult: function() {}, | 546 jumpToPreviousSearchResult: function() {}, |
| 547 | 547 |
| 548 /** | 548 /** |
| 549 * @return {boolean} | 549 * @return {boolean} |
| 550 */ | 550 */ |
| 551 supportsCaseSensitiveSearch: function() {}, | 551 supportsCaseSensitiveSearch: function() {}, |
| 552 | 552 |
| 553 /** | 553 /** |
| 554 * @return {boolean} | 554 * @return {boolean} |
| 555 */ | 555 */ |
| 556 supportsRegexSearch: function() {} | 556 supportsRegexSearch: function() {} |
| 557 }; | 557 }; |
| 558 | 558 |
| 559 /** | 559 /** |
| 560 * @interface | 560 * @interface |
| 561 */ | 561 */ |
| 562 WebInspector.Replaceable = function() {}; | 562 UI.Replaceable = function() {}; |
| 563 | 563 |
| 564 WebInspector.Replaceable.prototype = { | 564 UI.Replaceable.prototype = { |
| 565 /** | 565 /** |
| 566 * @param {!WebInspector.SearchableView.SearchConfig} searchConfig | 566 * @param {!UI.SearchableView.SearchConfig} searchConfig |
| 567 * @param {string} replacement | 567 * @param {string} replacement |
| 568 */ | 568 */ |
| 569 replaceSelectionWith: function(searchConfig, replacement) {}, | 569 replaceSelectionWith: function(searchConfig, replacement) {}, |
| 570 | 570 |
| 571 /** | 571 /** |
| 572 * @param {!WebInspector.SearchableView.SearchConfig} searchConfig | 572 * @param {!UI.SearchableView.SearchConfig} searchConfig |
| 573 * @param {string} replacement | 573 * @param {string} replacement |
| 574 */ | 574 */ |
| 575 replaceAllWith: function(searchConfig, replacement) {} | 575 replaceAllWith: function(searchConfig, replacement) {} |
| 576 }; | 576 }; |
| 577 | 577 |
| 578 /** | 578 /** |
| 579 * @unrestricted | 579 * @unrestricted |
| 580 */ | 580 */ |
| 581 WebInspector.SearchableView.SearchConfig = class { | 581 UI.SearchableView.SearchConfig = class { |
| 582 /** | 582 /** |
| 583 * @param {string} query | 583 * @param {string} query |
| 584 * @param {boolean} caseSensitive | 584 * @param {boolean} caseSensitive |
| 585 * @param {boolean} isRegex | 585 * @param {boolean} isRegex |
| 586 */ | 586 */ |
| 587 constructor(query, caseSensitive, isRegex) { | 587 constructor(query, caseSensitive, isRegex) { |
| 588 this.query = query; | 588 this.query = query; |
| 589 this.caseSensitive = caseSensitive; | 589 this.caseSensitive = caseSensitive; |
| 590 this.isRegex = isRegex; | 590 this.isRegex = isRegex; |
| 591 } | 591 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 612 // Silent catch. | 612 // Silent catch. |
| 613 } | 613 } |
| 614 | 614 |
| 615 // Otherwise just do a plain text search. | 615 // Otherwise just do a plain text search. |
| 616 if (!regex) | 616 if (!regex) |
| 617 regex = createPlainTextSearchRegex(query, modifiers); | 617 regex = createPlainTextSearchRegex(query, modifiers); |
| 618 | 618 |
| 619 return regex; | 619 return regex; |
| 620 } | 620 } |
| 621 }; | 621 }; |
| OLD | NEW |