Chromium Code Reviews| 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 15 matching lines...) Expand all Loading... | |
| 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 * @constructor | 33 * @constructor |
| 34 * @extends {WebInspector.VBox} | 34 * @extends {WebInspector.VBox} |
| 35 * @param {!WebInspector.Searchable} searchable | 35 * @param {!WebInspector.Searchable} searchable |
| 36 * @param {string=} settingName | |
| 36 */ | 37 */ |
| 37 WebInspector.SearchableView = function(searchable) | 38 WebInspector.SearchableView = function(searchable, settingName) |
| 38 { | 39 { |
| 39 WebInspector.VBox.call(this); | 40 WebInspector.VBox.call(this); |
| 40 | 41 |
| 41 this._searchProvider = searchable; | 42 this._searchProvider = searchable; |
| 43 this._settingName = settingName; | |
| 44 | |
| 42 this.element.addEventListener("keydown", this._onKeyDown.bind(this), false); | 45 this.element.addEventListener("keydown", this._onKeyDown.bind(this), false); |
| 43 | 46 |
| 44 this._footerElementContainer = this.element.createChild("div", "search-bar s tatus-bar hidden"); | 47 this._footerElementContainer = this.element.createChild("div", "search-bar s tatus-bar hidden"); |
| 45 this._footerElementContainer.style.order = 100; | 48 this._footerElementContainer.style.order = 100; |
| 46 | 49 |
| 47 this._footerElement = this._footerElementContainer.createChild("table", "too lbar-search"); | 50 this._footerElement = this._footerElementContainer.createChild("table", "too lbar-search"); |
| 48 this._footerElement.cellSpacing = 0; | 51 this._footerElement.cellSpacing = 0; |
| 49 | 52 |
| 50 this._firstRowElement = this._footerElement.createChild("tr"); | 53 this._firstRowElement = this._footerElement.createChild("tr"); |
| 51 this._secondRowElement = this._footerElement.createChild("tr", "hidden"); | 54 this._secondRowElement = this._footerElement.createChild("tr", "hidden"); |
| 52 | 55 |
| 56 if (this._searchProvider.supportsCaseSensitiveSearch() || this._searchProvid er.supportsRegexSearch()) { | |
| 57 var searchSettingsPrefixColumn = this._firstRowElement.createChild("td") ; | |
| 58 searchSettingsPrefixColumn.createChild("div", "search-settings-prefix") | |
| 59 this._secondRowElement.createChild("td"); | |
| 60 } | |
| 61 | |
| 62 if (this._searchProvider.supportsCaseSensitiveSearch()) { | |
| 63 var caseSensitiveColumn = this._firstRowElement.createChild("td"); | |
| 64 this._caseSensitiveButton = new WebInspector.StatusBarTextButton("Case s ensitive", "case-sensitive-search", "Aa", 2); | |
|
lushnikov
2014/10/20 13:09:19
missing WebInspector.UIString two times here and a
| |
| 65 this._caseSensitiveButton.addEventListener("click", this._toggleCaseSens itiveSearch, this); | |
| 66 caseSensitiveColumn.appendChild(this._caseSensitiveButton.element); | |
| 67 this._secondRowElement.createChild("td"); | |
| 68 } | |
| 69 | |
| 70 if (this._searchProvider.supportsRegexSearch()) { | |
| 71 var regexColumn = this._firstRowElement.createChild("td"); | |
| 72 this._regexButton = new WebInspector.StatusBarTextButton("Regex", "regex -search", ".*", 2); | |
| 73 this._regexButton.addEventListener("click", this._toggleRegexSearch, thi s); | |
| 74 regexColumn.appendChild(this._regexButton.element); | |
| 75 this._secondRowElement.createChild("td"); | |
| 76 } | |
| 77 | |
| 53 // Column 1 | 78 // Column 1 |
| 54 var searchControlElementColumn = this._firstRowElement.createChild("td"); | 79 var searchControlElementColumn = this._firstRowElement.createChild("td"); |
| 55 this._searchControlElement = searchControlElementColumn.createChild("span", "toolbar-search-control"); | 80 this._searchControlElement = searchControlElementColumn.createChild("span", "toolbar-search-control"); |
| 56 this._searchInputElement = this._searchControlElement.createChild("input", " search-replace"); | 81 this._searchInputElement = this._searchControlElement.createChild("input", " search-replace"); |
| 57 this._searchInputElement.id = "search-input-field"; | 82 this._searchInputElement.id = "search-input-field"; |
| 58 this._searchInputElement.placeholder = WebInspector.UIString("Find"); | 83 this._searchInputElement.placeholder = WebInspector.UIString("Find"); |
| 59 | 84 |
| 60 this._matchesElement = this._searchControlElement.createChild("label", "sear ch-results-matches"); | 85 this._matchesElement = this._searchControlElement.createChild("label", "sear ch-results-matches"); |
| 61 this._matchesElement.setAttribute("for", "search-input-field"); | 86 this._matchesElement.setAttribute("for", "search-input-field"); |
| 62 | 87 |
| 63 this._searchNavigationElement = this._searchControlElement.createChild("div" , "toolbar-search-navigation-controls"); | 88 this._searchNavigationElement = this._searchControlElement.createChild("div" , "toolbar-search-navigation-controls"); |
| 64 | 89 |
| 65 this._searchNavigationPrevElement = this._searchNavigationElement.createChil d("div", "toolbar-search-navigation toolbar-search-navigation-prev"); | 90 this._searchNavigationPrevElement = this._searchNavigationElement.createChil d("div", "toolbar-search-navigation toolbar-search-navigation-prev"); |
| 66 this._searchNavigationPrevElement.addEventListener("click", this._onPrevButt onSearch.bind(this), false); | 91 this._searchNavigationPrevElement.addEventListener("click", this._onPrevButt onSearch.bind(this), false); |
| 67 this._searchNavigationPrevElement.title = WebInspector.UIString("Search Prev ious"); | 92 this._searchNavigationPrevElement.title = WebInspector.UIString("Search Prev ious"); |
| 68 | 93 |
| 69 this._searchNavigationNextElement = this._searchNavigationElement.createChil d("div", "toolbar-search-navigation toolbar-search-navigation-next"); | 94 this._searchNavigationNextElement = this._searchNavigationElement.createChil d("div", "toolbar-search-navigation toolbar-search-navigation-next"); |
| 70 this._searchNavigationNextElement.addEventListener("click", this._onNextButt onSearch.bind(this), false); | 95 this._searchNavigationNextElement.addEventListener("click", this._onNextButt onSearch.bind(this), false); |
| 71 this._searchNavigationNextElement.title = WebInspector.UIString("Search Next "); | 96 this._searchNavigationNextElement.title = WebInspector.UIString("Search Next "); |
| 72 | 97 |
| 73 this._searchInputElement.addEventListener("mousedown", this._onSearchFieldMa nualFocus.bind(this), false); // when the search field is manually selected | 98 this._searchInputElement.addEventListener("mousedown", this._onSearchFieldMa nualFocus.bind(this), false); // when the search field is manually selected |
| 74 this._searchInputElement.addEventListener("keydown", this._onSearchKeyDown.b ind(this), true); | 99 this._searchInputElement.addEventListener("keydown", this._onSearchKeyDown.b ind(this), true); |
| 75 this._searchInputElement.addEventListener("input", this._onInput.bind(this), false); | 100 this._searchInputElement.addEventListener("input", this._onInput.bind(this), false); |
| 76 | 101 |
| 77 this._replaceInputElement = this._secondRowElement.createChild("td").createC hild("input", "search-replace toolbar-replace-control"); | 102 this._replaceInputElement = this._secondRowElement.createChild("td").createC hild("input", "search-replace toolbar-replace-control"); |
| 78 this._replaceInputElement.addEventListener("keydown", this._onReplaceKeyDown .bind(this), true); | 103 this._replaceInputElement.addEventListener("keydown", this._onReplaceKeyDown .bind(this), true); |
| 79 this._replaceInputElement.placeholder = WebInspector.UIString("Replace"); | 104 this._replaceInputElement.placeholder = WebInspector.UIString("Replace"); |
| 80 | 105 |
| 81 // Column 2 | 106 // Column 2 |
| 82 this._findButtonElement = this._firstRowElement.createChild("td").createChil d("button", "hidden"); | 107 this._findButtonElement = this._firstRowElement.createChild("td").createChil d("button", "search-action-button hidden"); |
| 83 this._findButtonElement.textContent = WebInspector.UIString("Find"); | 108 this._findButtonElement.textContent = WebInspector.UIString("Find"); |
| 84 this._findButtonElement.tabIndex = -1; | 109 this._findButtonElement.tabIndex = -1; |
| 85 this._findButtonElement.addEventListener("click", this._onFindClick.bind(thi s), false); | 110 this._findButtonElement.addEventListener("click", this._onFindClick.bind(thi s), false); |
| 86 | 111 |
| 87 this._replaceButtonElement = this._secondRowElement.createChild("td").create Child("button"); | 112 this._replaceButtonElement = this._secondRowElement.createChild("td").create Child("button", "search-action-button"); |
| 88 this._replaceButtonElement.textContent = WebInspector.UIString("Replace"); | 113 this._replaceButtonElement.textContent = WebInspector.UIString("Replace"); |
| 89 this._replaceButtonElement.disabled = true; | 114 this._replaceButtonElement.disabled = true; |
| 90 this._replaceButtonElement.tabIndex = -1; | 115 this._replaceButtonElement.tabIndex = -1; |
| 91 this._replaceButtonElement.addEventListener("click", this._replace.bind(this ), false); | 116 this._replaceButtonElement.addEventListener("click", this._replace.bind(this ), false); |
| 92 | 117 |
| 93 // Column 3 | 118 // Column 3 |
| 94 this._prevButtonElement = this._firstRowElement.createChild("td").createChil d("button", "hidden"); | 119 this._prevButtonElement = this._firstRowElement.createChild("td").createChil d("button", "search-action-button hidden"); |
| 95 this._prevButtonElement.textContent = WebInspector.UIString("Previous"); | 120 this._prevButtonElement.textContent = WebInspector.UIString("Previous"); |
| 96 this._prevButtonElement.tabIndex = -1; | 121 this._prevButtonElement.tabIndex = -1; |
| 97 this._prevButtonElement.addEventListener("click", this._onPreviousClick.bind (this), false); | 122 this._prevButtonElement.addEventListener("click", this._onPreviousClick.bind (this), false); |
| 98 | 123 |
| 99 this._replaceAllButtonElement = this._secondRowElement.createChild("td").cre ateChild("button"); | 124 this._replaceAllButtonElement = this._secondRowElement.createChild("td").cre ateChild("button", "search-action-button"); |
| 100 this._replaceAllButtonElement.textContent = WebInspector.UIString("Replace A ll"); | 125 this._replaceAllButtonElement.textContent = WebInspector.UIString("Replace A ll"); |
| 101 this._replaceAllButtonElement.addEventListener("click", this._replaceAll.bin d(this), false); | 126 this._replaceAllButtonElement.addEventListener("click", this._replaceAll.bin d(this), false); |
| 102 | 127 |
| 103 // Column 4 | 128 // Column 4 |
| 104 this._replaceElement = this._firstRowElement.createChild("td").createChild(" span"); | 129 this._replaceElement = this._firstRowElement.createChild("td").createChild(" span"); |
| 105 | 130 |
| 106 this._replaceCheckboxElement = this._replaceElement.createChild("input"); | 131 this._replaceCheckboxElement = this._replaceElement.createChild("input"); |
| 107 this._replaceCheckboxElement.type = "checkbox"; | 132 this._replaceCheckboxElement.type = "checkbox"; |
| 108 this._uniqueId = ++WebInspector.SearchableView._lastUniqueId; | 133 this._uniqueId = ++WebInspector.SearchableView._lastUniqueId; |
| 109 var replaceCheckboxId = "search-replace-trigger" + this._uniqueId; | 134 var replaceCheckboxId = "search-replace-trigger" + this._uniqueId; |
| 110 this._replaceCheckboxElement.id = replaceCheckboxId; | 135 this._replaceCheckboxElement.id = replaceCheckboxId; |
| 111 this._replaceCheckboxElement.addEventListener("change", this._updateSecondRo wVisibility.bind(this), false); | 136 this._replaceCheckboxElement.addEventListener("change", this._updateSecondRo wVisibility.bind(this), false); |
| 112 | 137 |
| 113 this._replaceLabelElement = this._replaceElement.createChild("label"); | 138 this._replaceLabelElement = this._replaceElement.createChild("label"); |
| 114 this._replaceLabelElement.textContent = WebInspector.UIString("Replace"); | 139 this._replaceLabelElement.textContent = WebInspector.UIString("Replace"); |
| 115 this._replaceLabelElement.setAttribute("for", replaceCheckboxId); | 140 this._replaceLabelElement.setAttribute("for", replaceCheckboxId); |
| 116 | 141 |
| 117 // Column 5 | 142 // Column 5 |
| 118 var cancelButtonElement = this._firstRowElement.createChild("td").createChil d("button"); | 143 var cancelButtonElement = this._firstRowElement.createChild("td").createChil d("button", "search-action-button"); |
| 119 cancelButtonElement.textContent = WebInspector.UIString("Cancel"); | 144 cancelButtonElement.textContent = WebInspector.UIString("Cancel"); |
| 120 cancelButtonElement.tabIndex = -1; | 145 cancelButtonElement.tabIndex = -1; |
| 121 cancelButtonElement.addEventListener("click", this.closeSearch.bind(this), f alse); | 146 cancelButtonElement.addEventListener("click", this.closeSearch.bind(this), f alse); |
| 122 this._minimalSearchQuerySize = 3; | 147 this._minimalSearchQuerySize = 3; |
| 123 | 148 |
| 124 this._registerShortcuts(); | 149 this._registerShortcuts(); |
| 150 this._loadSetting(); | |
| 125 } | 151 } |
| 126 | 152 |
| 127 WebInspector.SearchableView._lastUniqueId = 0; | 153 WebInspector.SearchableView._lastUniqueId = 0; |
| 128 | 154 |
| 129 /** | 155 /** |
| 130 * @return {!Array.<!WebInspector.KeyboardShortcut.Descriptor>} | 156 * @return {!Array.<!WebInspector.KeyboardShortcut.Descriptor>} |
| 131 */ | 157 */ |
| 132 WebInspector.SearchableView.findShortcuts = function() | 158 WebInspector.SearchableView.findShortcuts = function() |
| 133 { | 159 { |
| 134 if (WebInspector.SearchableView._findShortcuts) | 160 if (WebInspector.SearchableView._findShortcuts) |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 170 { | 196 { |
| 171 if (WebInspector.SearchableView._findPreviousShortcuts) | 197 if (WebInspector.SearchableView._findPreviousShortcuts) |
| 172 return WebInspector.SearchableView._findPreviousShortcuts; | 198 return WebInspector.SearchableView._findPreviousShortcuts; |
| 173 WebInspector.SearchableView._findPreviousShortcuts = []; | 199 WebInspector.SearchableView._findPreviousShortcuts = []; |
| 174 if (WebInspector.isMac()) | 200 if (WebInspector.isMac()) |
| 175 WebInspector.SearchableView._findPreviousShortcuts.push(WebInspector.Key boardShortcut.makeDescriptor("g", WebInspector.KeyboardShortcut.Modifiers.Meta | WebInspector.KeyboardShortcut.Modifiers.Shift)); | 201 WebInspector.SearchableView._findPreviousShortcuts.push(WebInspector.Key boardShortcut.makeDescriptor("g", WebInspector.KeyboardShortcut.Modifiers.Meta | WebInspector.KeyboardShortcut.Modifiers.Shift)); |
| 176 return WebInspector.SearchableView._findPreviousShortcuts; | 202 return WebInspector.SearchableView._findPreviousShortcuts; |
| 177 } | 203 } |
| 178 | 204 |
| 179 WebInspector.SearchableView.prototype = { | 205 WebInspector.SearchableView.prototype = { |
| 206 _toggleCaseSensitiveSearch: function() | |
| 207 { | |
| 208 this._caseSensitiveButton.toggled = !this._caseSensitiveButton.toggled; | |
| 209 this._saveSetting(); | |
| 210 this._performSearch(true, true); | |
| 211 }, | |
| 212 | |
| 213 _toggleRegexSearch: function() | |
| 214 { | |
| 215 this._regexButton.toggled = !this._regexButton.toggled; | |
| 216 this._saveSetting(); | |
| 217 this._performSearch(true, true); | |
| 218 }, | |
| 219 | |
| 220 /** | |
| 221 * @return {?WebInspector.Setting} | |
| 222 */ | |
| 223 _setting: function() | |
| 224 { | |
| 225 if (!this._settingName) | |
| 226 return null; | |
| 227 if (!WebInspector.settings[this._settingName]) | |
| 228 WebInspector.settings[this._settingName] = WebInspector.settings.cre ateSetting(this._settingName, {}); | |
| 229 return WebInspector.settings[this._settingName]; | |
| 230 }, | |
| 231 | |
| 232 _saveSetting: function() | |
| 233 { | |
| 234 var setting = this._setting(); | |
| 235 if (!setting) | |
| 236 return; | |
| 237 var settingValue = setting.get() || {}; | |
| 238 settingValue.caseSensitive = this._caseSensitiveButton.toggled; | |
| 239 settingValue.isRegex = this._regexButton.toggled; | |
| 240 setting.set(settingValue); | |
| 241 }, | |
| 242 | |
| 243 _loadSetting: function() | |
| 244 { | |
| 245 var settingValue = this._setting() ? (this._setting().get() || {}) : {}; | |
| 246 if (this._searchProvider.supportsCaseSensitiveSearch()) | |
| 247 this._caseSensitiveButton.toggled = !!settingValue.caseSensitive; | |
| 248 if (this._searchProvider.supportsRegexSearch()) | |
| 249 this._regexButton.toggled = !!settingValue.isRegex; | |
| 250 }, | |
| 251 | |
| 180 /** | 252 /** |
| 181 * @return {!Element} | 253 * @return {!Element} |
| 182 */ | 254 */ |
| 183 defaultFocusedElement: function() | 255 defaultFocusedElement: function() |
| 184 { | 256 { |
| 185 var children = this.children(); | 257 var children = this.children(); |
| 186 for (var i = 0; i < children.length; ++i) { | 258 for (var i = 0; i < children.length; ++i) { |
| 187 var element = children[i].defaultFocusedElement(); | 259 var element = children[i].defaultFocusedElement(); |
| 188 if (element) | 260 if (element) |
| 189 return element; | 261 return element; |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 495 _performSearch: function(forceSearch, shouldJump, jumpBackwards) | 567 _performSearch: function(forceSearch, shouldJump, jumpBackwards) |
| 496 { | 568 { |
| 497 var query = this._searchInputElement.value; | 569 var query = this._searchInputElement.value; |
| 498 if (!query || (!forceSearch && query.length < this._minimalSearchQuerySi ze && !this._currentQuery)) { | 570 if (!query || (!forceSearch && query.length < this._minimalSearchQuerySi ze && !this._currentQuery)) { |
| 499 this._clearSearch(); | 571 this._clearSearch(); |
| 500 return; | 572 return; |
| 501 } | 573 } |
| 502 | 574 |
| 503 this._currentQuery = query; | 575 this._currentQuery = query; |
| 504 this._searchProvider.currentQuery = query; | 576 this._searchProvider.currentQuery = query; |
| 505 this._searchProvider.performSearch(query, shouldJump, jumpBackwards); | 577 |
| 578 var caseSensitive = this._caseSensitiveButton.toggled; | |
| 579 var isRegex = this._regexButton.toggled; | |
| 580 var searchConfig = new WebInspector.SearchableView.SearchConfig(query, c aseSensitive, isRegex); | |
| 581 this._searchProvider.performSearch(searchConfig, shouldJump, jumpBackwar ds); | |
| 506 }, | 582 }, |
| 507 | 583 |
| 508 _updateSecondRowVisibility: function() | 584 _updateSecondRowVisibility: function() |
| 509 { | 585 { |
| 510 var secondRowVisible = this._replaceCheckboxElement.checked; | 586 var secondRowVisible = this._replaceCheckboxElement.checked; |
| 511 this._footerElementContainer.classList.toggle("replaceable", secondRowVi sible); | 587 this._footerElementContainer.classList.toggle("replaceable", secondRowVi sible); |
| 512 this._footerElement.classList.toggle("toolbar-search-replace", secondRow Visible); | 588 this._footerElement.classList.toggle("toolbar-search-replace", secondRow Visible); |
| 513 this._secondRowElement.classList.toggle("hidden", !secondRowVisible); | 589 this._secondRowElement.classList.toggle("hidden", !secondRowVisible); |
| 514 this._prevButtonElement.classList.toggle("hidden", !secondRowVisible); | 590 this._prevButtonElement.classList.toggle("hidden", !secondRowVisible); |
| 515 this._findButtonElement.classList.toggle("hidden", !secondRowVisible); | 591 this._findButtonElement.classList.toggle("hidden", !secondRowVisible); |
| 516 this._replaceCheckboxElement.tabIndex = secondRowVisible ? -1 : 0; | 592 this._replaceCheckboxElement.tabIndex = secondRowVisible ? -1 : 0; |
| 517 | 593 |
| 518 if (secondRowVisible) | 594 if (secondRowVisible) |
| 519 this._replaceInputElement.focus(); | 595 this._replaceInputElement.focus(); |
| 520 else | 596 else |
| 521 this._searchInputElement.focus(); | 597 this._searchInputElement.focus(); |
| 522 this.doResize(); | 598 this.doResize(); |
| 523 }, | 599 }, |
| 524 | 600 |
| 525 _replace: function() | 601 _replace: function() |
| 526 { | 602 { |
| 527 /** @type {!WebInspector.Replaceable} */ (this._searchProvider).replaceS electionWith(this._replaceInputElement.value); | 603 /** @type {!WebInspector.Replaceable} */ (this._searchProvider).replaceS electionWith(this._replaceInputElement.value); |
| 528 delete this._currentQuery; | 604 delete this._currentQuery; |
| 529 this._performSearch(true, true); | 605 this._performSearch(true, true); |
| 530 }, | 606 }, |
| 531 | 607 |
| 532 _replaceAll: function() | 608 _replaceAll: function() |
| 533 { | 609 { |
| 534 /** @type {!WebInspector.Replaceable} */ (this._searchProvider).replaceA llWith(this._searchInputElement.value, this._replaceInputElement.value); | 610 var query = this._searchInputElement.value; |
| 611 var caseSensitive = this._caseSensitiveButton.toggled; | |
| 612 var isRegex = this._regexButton.toggled; | |
| 613 var searchConfig = new WebInspector.SearchableView.SearchConfig(query, c aseSensitive, isRegex); | |
| 614 /** @type {!WebInspector.Replaceable} */ (this._searchProvider).replaceA llWith(searchConfig, this._replaceInputElement.value); | |
| 535 }, | 615 }, |
| 536 | 616 |
| 537 _onInput: function(event) | 617 _onInput: function(event) |
| 538 { | 618 { |
| 539 this._onValueChanged(); | 619 this._onValueChanged(); |
| 540 }, | 620 }, |
| 541 | 621 |
| 542 _onValueChanged: function() | 622 _onValueChanged: function() |
| 543 { | 623 { |
| 544 this._performSearch(false, true); | 624 this._performSearch(false, true); |
| 545 }, | 625 }, |
| 546 | 626 |
| 547 __proto__: WebInspector.VBox.prototype | 627 __proto__: WebInspector.VBox.prototype |
| 548 } | 628 } |
| 549 | 629 |
| 550 /** | 630 /** |
| 551 * @interface | 631 * @interface |
| 552 */ | 632 */ |
| 553 WebInspector.Searchable = function() | 633 WebInspector.Searchable = function() |
| 554 { | 634 { |
| 555 } | 635 } |
| 556 | 636 |
| 557 WebInspector.Searchable.prototype = { | 637 WebInspector.Searchable.prototype = { |
| 558 searchCanceled: function() { }, | 638 searchCanceled: function() { }, |
| 559 | 639 |
| 560 /** | 640 /** |
| 561 * @param {string} query | 641 * @param {!WebInspector.SearchableView.SearchConfig} searchConfig |
| 562 * @param {boolean} shouldJump | 642 * @param {boolean} shouldJump |
| 563 * @param {boolean=} jumpBackwards | 643 * @param {boolean=} jumpBackwards |
| 564 */ | 644 */ |
| 565 performSearch: function(query, shouldJump, jumpBackwards) { }, | 645 performSearch: function(searchConfig, shouldJump, jumpBackwards) { }, |
| 566 | 646 |
| 567 jumpToNextSearchResult: function() { }, | 647 jumpToNextSearchResult: function() { }, |
| 568 | 648 |
| 569 jumpToPreviousSearchResult: function() { } | 649 jumpToPreviousSearchResult: function() { }, |
| 650 | |
| 651 /** | |
| 652 * @return {boolean} | |
| 653 */ | |
| 654 supportsCaseSensitiveSearch: function() { }, | |
| 655 | |
| 656 /** | |
| 657 * @return {boolean} | |
| 658 */ | |
| 659 supportsRegexSearch: function() { } | |
| 570 } | 660 } |
| 571 | 661 |
| 572 /** | 662 /** |
| 573 * @interface | 663 * @interface |
| 574 */ | 664 */ |
| 575 WebInspector.Replaceable = function() | 665 WebInspector.Replaceable = function() |
| 576 { | 666 { |
| 577 } | 667 } |
| 578 | 668 |
| 579 WebInspector.Replaceable.prototype = { | 669 WebInspector.Replaceable.prototype = { |
| 580 /** | 670 /** |
| 581 * @param {string} text | 671 * @param {string} replacement |
| 582 */ | 672 */ |
| 583 replaceSelectionWith: function(text) { }, | 673 replaceSelectionWith: function(replacement) { }, |
| 584 | 674 |
| 585 /** | 675 /** |
| 586 * @param {string} query | 676 * @param {!WebInspector.SearchableView.SearchConfig} searchConfig |
| 587 * @param {string} replacement | 677 * @param {string} replacement |
| 588 */ | 678 */ |
| 589 replaceAllWith: function(query, replacement) { } | 679 replaceAllWith: function(searchConfig, replacement) { } |
| 590 } | 680 } |
| 681 | |
| 682 /** | |
| 683 * @constructor | |
| 684 * @param {string} query | |
| 685 * @param {boolean} caseSensitive | |
| 686 * @param {boolean} isRegex | |
| 687 */ | |
| 688 WebInspector.SearchableView.SearchConfig = function(query, caseSensitive, isRege x) | |
| 689 { | |
| 690 this.query = query; | |
| 691 this.caseSensitive = caseSensitive; | |
| 692 this.isRegex = isRegex; | |
| 693 } | |
| OLD | NEW |