| 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 this._replaceElement.appendChild(this._replaceLabelElement); | 136 this._replaceElement.appendChild(this._replaceLabelElement); |
| 137 | 137 |
| 138 // Column 5 | 138 // Column 5 |
| 139 var cancelButtonElement = this._firstRowElement.createChild("td").createChil
d("button", "search-action-button"); | 139 var cancelButtonElement = this._firstRowElement.createChild("td").createChil
d("button", "search-action-button"); |
| 140 cancelButtonElement.textContent = WebInspector.UIString("Cancel"); | 140 cancelButtonElement.textContent = WebInspector.UIString("Cancel"); |
| 141 cancelButtonElement.tabIndex = -1; | 141 cancelButtonElement.tabIndex = -1; |
| 142 cancelButtonElement.addEventListener("click", this.closeSearch.bind(this), f
alse); | 142 cancelButtonElement.addEventListener("click", this.closeSearch.bind(this), f
alse); |
| 143 this._minimalSearchQuerySize = 3; | 143 this._minimalSearchQuerySize = 3; |
| 144 | 144 |
| 145 this._loadSetting(); | 145 this._loadSetting(); |
| 146 } | 146 }; |
| 147 | 147 |
| 148 WebInspector.SearchableView._lastUniqueId = 0; | 148 WebInspector.SearchableView._lastUniqueId = 0; |
| 149 | 149 |
| 150 WebInspector.SearchableView._symbol = Symbol("searchableView"); | 150 WebInspector.SearchableView._symbol = Symbol("searchableView"); |
| 151 | 151 |
| 152 /** | 152 /** |
| 153 * @param {?Element} element | 153 * @param {?Element} element |
| 154 * @return {?WebInspector.SearchableView} | 154 * @return {?WebInspector.SearchableView} |
| 155 */ | 155 */ |
| 156 WebInspector.SearchableView.fromElement = function(element) | 156 WebInspector.SearchableView.fromElement = function(element) |
| 157 { | 157 { |
| 158 var view = null; | 158 var view = null; |
| 159 while (element && !view) { | 159 while (element && !view) { |
| 160 view = element[WebInspector.SearchableView._symbol]; | 160 view = element[WebInspector.SearchableView._symbol]; |
| 161 element = element.parentElementOrShadowHost(); | 161 element = element.parentElementOrShadowHost(); |
| 162 } | 162 } |
| 163 return view; | 163 return view; |
| 164 } | 164 }; |
| 165 | 165 |
| 166 WebInspector.SearchableView.prototype = { | 166 WebInspector.SearchableView.prototype = { |
| 167 _toggleCaseSensitiveSearch: function() | 167 _toggleCaseSensitiveSearch: function() |
| 168 { | 168 { |
| 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 }, |
| 173 | 173 |
| 174 _toggleRegexSearch: function() | 174 _toggleRegexSearch: function() |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 | 549 |
| 550 _onValueChanged: function() | 550 _onValueChanged: function() |
| 551 { | 551 { |
| 552 if (!this._searchIsVisible) | 552 if (!this._searchIsVisible) |
| 553 return; | 553 return; |
| 554 delete this._valueChangedTimeoutId; | 554 delete this._valueChangedTimeoutId; |
| 555 this._performSearch(false, true); | 555 this._performSearch(false, true); |
| 556 }, | 556 }, |
| 557 | 557 |
| 558 __proto__: WebInspector.VBox.prototype | 558 __proto__: WebInspector.VBox.prototype |
| 559 } | 559 }; |
| 560 | 560 |
| 561 /** | 561 /** |
| 562 * @interface | 562 * @interface |
| 563 */ | 563 */ |
| 564 WebInspector.Searchable = function() | 564 WebInspector.Searchable = function() |
| 565 { | 565 { |
| 566 } | 566 }; |
| 567 | 567 |
| 568 WebInspector.Searchable.prototype = { | 568 WebInspector.Searchable.prototype = { |
| 569 searchCanceled: function() { }, | 569 searchCanceled: function() { }, |
| 570 | 570 |
| 571 /** | 571 /** |
| 572 * @param {!WebInspector.SearchableView.SearchConfig} searchConfig | 572 * @param {!WebInspector.SearchableView.SearchConfig} searchConfig |
| 573 * @param {boolean} shouldJump | 573 * @param {boolean} shouldJump |
| 574 * @param {boolean=} jumpBackwards | 574 * @param {boolean=} jumpBackwards |
| 575 */ | 575 */ |
| 576 performSearch: function(searchConfig, shouldJump, jumpBackwards) { }, | 576 performSearch: function(searchConfig, shouldJump, jumpBackwards) { }, |
| 577 | 577 |
| 578 jumpToNextSearchResult: function() { }, | 578 jumpToNextSearchResult: function() { }, |
| 579 | 579 |
| 580 jumpToPreviousSearchResult: function() { }, | 580 jumpToPreviousSearchResult: function() { }, |
| 581 | 581 |
| 582 /** | 582 /** |
| 583 * @return {boolean} | 583 * @return {boolean} |
| 584 */ | 584 */ |
| 585 supportsCaseSensitiveSearch: function() { }, | 585 supportsCaseSensitiveSearch: function() { }, |
| 586 | 586 |
| 587 /** | 587 /** |
| 588 * @return {boolean} | 588 * @return {boolean} |
| 589 */ | 589 */ |
| 590 supportsRegexSearch: function() { } | 590 supportsRegexSearch: function() { } |
| 591 } | 591 }; |
| 592 | 592 |
| 593 /** | 593 /** |
| 594 * @interface | 594 * @interface |
| 595 */ | 595 */ |
| 596 WebInspector.Replaceable = function() | 596 WebInspector.Replaceable = function() |
| 597 { | 597 { |
| 598 } | 598 }; |
| 599 | 599 |
| 600 WebInspector.Replaceable.prototype = { | 600 WebInspector.Replaceable.prototype = { |
| 601 /** | 601 /** |
| 602 * @param {!WebInspector.SearchableView.SearchConfig} searchConfig | 602 * @param {!WebInspector.SearchableView.SearchConfig} searchConfig |
| 603 * @param {string} replacement | 603 * @param {string} replacement |
| 604 */ | 604 */ |
| 605 replaceSelectionWith: function(searchConfig, replacement) { }, | 605 replaceSelectionWith: function(searchConfig, replacement) { }, |
| 606 | 606 |
| 607 /** | 607 /** |
| 608 * @param {!WebInspector.SearchableView.SearchConfig} searchConfig | 608 * @param {!WebInspector.SearchableView.SearchConfig} searchConfig |
| 609 * @param {string} replacement | 609 * @param {string} replacement |
| 610 */ | 610 */ |
| 611 replaceAllWith: function(searchConfig, replacement) { } | 611 replaceAllWith: function(searchConfig, replacement) { } |
| 612 } | 612 }; |
| 613 | 613 |
| 614 /** | 614 /** |
| 615 * @constructor | 615 * @constructor |
| 616 * @param {string} query | 616 * @param {string} query |
| 617 * @param {boolean} caseSensitive | 617 * @param {boolean} caseSensitive |
| 618 * @param {boolean} isRegex | 618 * @param {boolean} isRegex |
| 619 */ | 619 */ |
| 620 WebInspector.SearchableView.SearchConfig = function(query, caseSensitive, isRege
x) | 620 WebInspector.SearchableView.SearchConfig = function(query, caseSensitive, isRege
x) |
| 621 { | 621 { |
| 622 this.query = query; | 622 this.query = query; |
| 623 this.caseSensitive = caseSensitive; | 623 this.caseSensitive = caseSensitive; |
| 624 this.isRegex = isRegex; | 624 this.isRegex = isRegex; |
| 625 } | 625 }; |
| 626 | 626 |
| 627 WebInspector.SearchableView.SearchConfig.prototype = { | 627 WebInspector.SearchableView.SearchConfig.prototype = { |
| 628 /** | 628 /** |
| 629 * @param {boolean=} global | 629 * @param {boolean=} global |
| 630 * @return {!RegExp} | 630 * @return {!RegExp} |
| 631 */ | 631 */ |
| 632 toSearchRegex: function(global) | 632 toSearchRegex: function(global) |
| 633 { | 633 { |
| 634 var modifiers = this.caseSensitive ? "" : "i"; | 634 var modifiers = this.caseSensitive ? "" : "i"; |
| 635 if (global) | 635 if (global) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 647 } catch (e) { | 647 } catch (e) { |
| 648 // Silent catch. | 648 // Silent catch. |
| 649 } | 649 } |
| 650 | 650 |
| 651 // Otherwise just do a plain text search. | 651 // Otherwise just do a plain text search. |
| 652 if (!regex) | 652 if (!regex) |
| 653 regex = createPlainTextSearchRegex(query, modifiers); | 653 regex = createPlainTextSearchRegex(query, modifiers); |
| 654 | 654 |
| 655 return regex; | 655 return regex; |
| 656 } | 656 } |
| 657 } | 657 }; |
| OLD | NEW |