| 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(WebInsp
ector.UIString("Case sensitive"), "case-sensitive-search", "Aa", 2); |
| 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(WebInspector.UI
String("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 searchConfig = this._currentSearchConfig(); |
| 579 this._searchProvider.performSearch(searchConfig, shouldJump, jumpBackwar
ds); |
| 506 }, | 580 }, |
| 507 | 581 |
| 582 /** |
| 583 * @return {!WebInspector.SearchableView.SearchConfig} |
| 584 */ |
| 585 _currentSearchConfig: function() |
| 586 { |
| 587 var query = this._searchInputElement.value; |
| 588 var caseSensitive = this._caseSensitiveButton ? this._caseSensitiveButto
n.toggled : false; |
| 589 var isRegex = this._regexButton ? this._regexButton.toggled : false; |
| 590 return new WebInspector.SearchableView.SearchConfig(query, caseSensitive
, isRegex); |
| 591 }, |
| 592 |
| 508 _updateSecondRowVisibility: function() | 593 _updateSecondRowVisibility: function() |
| 509 { | 594 { |
| 510 var secondRowVisible = this._replaceCheckboxElement.checked; | 595 var secondRowVisible = this._replaceCheckboxElement.checked; |
| 511 this._footerElementContainer.classList.toggle("replaceable", secondRowVi
sible); | 596 this._footerElementContainer.classList.toggle("replaceable", secondRowVi
sible); |
| 512 this._footerElement.classList.toggle("toolbar-search-replace", secondRow
Visible); | 597 this._footerElement.classList.toggle("toolbar-search-replace", secondRow
Visible); |
| 513 this._secondRowElement.classList.toggle("hidden", !secondRowVisible); | 598 this._secondRowElement.classList.toggle("hidden", !secondRowVisible); |
| 514 this._prevButtonElement.classList.toggle("hidden", !secondRowVisible); | 599 this._prevButtonElement.classList.toggle("hidden", !secondRowVisible); |
| 515 this._findButtonElement.classList.toggle("hidden", !secondRowVisible); | 600 this._findButtonElement.classList.toggle("hidden", !secondRowVisible); |
| 516 this._replaceCheckboxElement.tabIndex = secondRowVisible ? -1 : 0; | 601 this._replaceCheckboxElement.tabIndex = secondRowVisible ? -1 : 0; |
| 517 | 602 |
| 518 if (secondRowVisible) | 603 if (secondRowVisible) |
| 519 this._replaceInputElement.focus(); | 604 this._replaceInputElement.focus(); |
| 520 else | 605 else |
| 521 this._searchInputElement.focus(); | 606 this._searchInputElement.focus(); |
| 522 this.doResize(); | 607 this.doResize(); |
| 523 }, | 608 }, |
| 524 | 609 |
| 525 _replace: function() | 610 _replace: function() |
| 526 { | 611 { |
| 527 /** @type {!WebInspector.Replaceable} */ (this._searchProvider).replaceS
electionWith(this._replaceInputElement.value); | 612 /** @type {!WebInspector.Replaceable} */ (this._searchProvider).replaceS
electionWith(this._replaceInputElement.value); |
| 528 delete this._currentQuery; | 613 delete this._currentQuery; |
| 529 this._performSearch(true, true); | 614 this._performSearch(true, true); |
| 530 }, | 615 }, |
| 531 | 616 |
| 532 _replaceAll: function() | 617 _replaceAll: function() |
| 533 { | 618 { |
| 534 /** @type {!WebInspector.Replaceable} */ (this._searchProvider).replaceA
llWith(this._searchInputElement.value, this._replaceInputElement.value); | 619 var searchConfig = this._currentSearchConfig(); |
| 620 /** @type {!WebInspector.Replaceable} */ (this._searchProvider).replaceA
llWith(searchConfig, this._replaceInputElement.value); |
| 535 }, | 621 }, |
| 536 | 622 |
| 537 _onInput: function(event) | 623 _onInput: function(event) |
| 538 { | 624 { |
| 539 this._onValueChanged(); | 625 this._onValueChanged(); |
| 540 }, | 626 }, |
| 541 | 627 |
| 542 _onValueChanged: function() | 628 _onValueChanged: function() |
| 543 { | 629 { |
| 544 this._performSearch(false, true); | 630 this._performSearch(false, true); |
| 545 }, | 631 }, |
| 546 | 632 |
| 547 __proto__: WebInspector.VBox.prototype | 633 __proto__: WebInspector.VBox.prototype |
| 548 } | 634 } |
| 549 | 635 |
| 550 /** | 636 /** |
| 551 * @interface | 637 * @interface |
| 552 */ | 638 */ |
| 553 WebInspector.Searchable = function() | 639 WebInspector.Searchable = function() |
| 554 { | 640 { |
| 555 } | 641 } |
| 556 | 642 |
| 557 WebInspector.Searchable.prototype = { | 643 WebInspector.Searchable.prototype = { |
| 558 searchCanceled: function() { }, | 644 searchCanceled: function() { }, |
| 559 | 645 |
| 560 /** | 646 /** |
| 561 * @param {string} query | 647 * @param {!WebInspector.SearchableView.SearchConfig} searchConfig |
| 562 * @param {boolean} shouldJump | 648 * @param {boolean} shouldJump |
| 563 * @param {boolean=} jumpBackwards | 649 * @param {boolean=} jumpBackwards |
| 564 */ | 650 */ |
| 565 performSearch: function(query, shouldJump, jumpBackwards) { }, | 651 performSearch: function(searchConfig, shouldJump, jumpBackwards) { }, |
| 566 | 652 |
| 567 jumpToNextSearchResult: function() { }, | 653 jumpToNextSearchResult: function() { }, |
| 568 | 654 |
| 569 jumpToPreviousSearchResult: function() { } | 655 jumpToPreviousSearchResult: function() { }, |
| 656 |
| 657 /** |
| 658 * @return {boolean} |
| 659 */ |
| 660 supportsCaseSensitiveSearch: function() { }, |
| 661 |
| 662 /** |
| 663 * @return {boolean} |
| 664 */ |
| 665 supportsRegexSearch: function() { } |
| 570 } | 666 } |
| 571 | 667 |
| 572 /** | 668 /** |
| 573 * @interface | 669 * @interface |
| 574 */ | 670 */ |
| 575 WebInspector.Replaceable = function() | 671 WebInspector.Replaceable = function() |
| 576 { | 672 { |
| 577 } | 673 } |
| 578 | 674 |
| 579 WebInspector.Replaceable.prototype = { | 675 WebInspector.Replaceable.prototype = { |
| 580 /** | 676 /** |
| 581 * @param {string} text | 677 * @param {string} replacement |
| 582 */ | 678 */ |
| 583 replaceSelectionWith: function(text) { }, | 679 replaceSelectionWith: function(replacement) { }, |
| 584 | 680 |
| 585 /** | 681 /** |
| 586 * @param {string} query | 682 * @param {!WebInspector.SearchableView.SearchConfig} searchConfig |
| 587 * @param {string} replacement | 683 * @param {string} replacement |
| 588 */ | 684 */ |
| 589 replaceAllWith: function(query, replacement) { } | 685 replaceAllWith: function(searchConfig, replacement) { } |
| 590 } | 686 } |
| 687 |
| 688 /** |
| 689 * @constructor |
| 690 * @param {string} query |
| 691 * @param {boolean} caseSensitive |
| 692 * @param {boolean} isRegex |
| 693 */ |
| 694 WebInspector.SearchableView.SearchConfig = function(query, caseSensitive, isRege
x) |
| 695 { |
| 696 this.query = query; |
| 697 this.caseSensitive = caseSensitive; |
| 698 this.isRegex = isRegex; |
| 699 } |
| OLD | NEW |