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 {!boolean} supportRegex | |
eustas
2014/10/06 08:16:07
If you make this parameter optional, then you can
robwu
2014/10/06 08:30:21
After looking over the rest, I'm not sure if this
aknudsen
2014/10/07 19:39:56
Done.
| |
36 */ | 37 */ |
37 WebInspector.SearchableView = function(searchable) | 38 WebInspector.SearchableView = function(searchable, supportRegex) |
38 { | 39 { |
40 var self = this; | |
eustas
2014/10/06 08:16:07
We usually don't do that way.
robwu
2014/10/06 08:30:21
Remove this and use "this" instead of "self".
aknudsen
2014/10/07 19:39:56
Done.
aknudsen
2014/10/07 19:39:57
Done.
| |
39 WebInspector.VBox.call(this); | 41 WebInspector.VBox.call(this); |
40 | 42 |
41 this._searchProvider = searchable; | 43 this._searchProvider = searchable; |
42 this.element.addEventListener("keydown", this._onKeyDown.bind(this), false); | 44 this.element.addEventListener("keydown", this._onKeyDown.bind(this), false); |
43 | 45 |
44 this._footerElementContainer = this.element.createChild("div", "search-bar s tatus-bar hidden"); | 46 this._footerElementContainer = this.element.createChild("div", "search-bar s tatus-bar hidden"); |
45 this._footerElementContainer.style.order = 100; | 47 this._footerElementContainer.style.order = 100; |
46 | 48 |
47 this._footerElement = this._footerElementContainer.createChild("table", "too lbar-search"); | 49 this._footerElement = this._footerElementContainer.createChild("table", "too lbar-search"); |
48 this._footerElement.cellSpacing = 0; | 50 this._footerElement.cellSpacing = 0; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
107 this._replaceCheckboxElement.type = "checkbox"; | 109 this._replaceCheckboxElement.type = "checkbox"; |
108 this._uniqueId = ++WebInspector.SearchableView._lastUniqueId; | 110 this._uniqueId = ++WebInspector.SearchableView._lastUniqueId; |
109 var replaceCheckboxId = "search-replace-trigger" + this._uniqueId; | 111 var replaceCheckboxId = "search-replace-trigger" + this._uniqueId; |
110 this._replaceCheckboxElement.id = replaceCheckboxId; | 112 this._replaceCheckboxElement.id = replaceCheckboxId; |
111 this._replaceCheckboxElement.addEventListener("change", this._updateSecondRo wVisibility.bind(this), false); | 113 this._replaceCheckboxElement.addEventListener("change", this._updateSecondRo wVisibility.bind(this), false); |
112 | 114 |
113 this._replaceLabelElement = this._replaceElement.createChild("label"); | 115 this._replaceLabelElement = this._replaceElement.createChild("label"); |
114 this._replaceLabelElement.textContent = WebInspector.UIString("Replace"); | 116 this._replaceLabelElement.textContent = WebInspector.UIString("Replace"); |
115 this._replaceLabelElement.setAttribute("for", replaceCheckboxId); | 117 this._replaceLabelElement.setAttribute("for", replaceCheckboxId); |
116 | 118 |
119 if (supportRegex) { | |
120 self._regexElement = self._firstRowElement.createChild("td").createChild(" span"); | |
121 | |
122 self._regexCheckboxElement = self._regexElement.createChild("input"); | |
123 self._regexCheckboxElement.type = "checkbox"; | |
124 var regexCheckboxId = "search-regex-trigger" + self._uniqueId; | |
125 self._regexCheckboxElement.id = regexCheckboxId; | |
126 self.enableRegex = false; | |
127 self._regexCheckboxElement.addEventListener("change", function (event) { | |
eustas
2014/10/06 08:16:07
Don't inline function and bind it to this.
aknudsen
2014/10/07 19:39:56
Done.
| |
128 self.enableRegex = event.target.checked; | |
129 self._performSearch(true, true, true); | |
130 }, false); | |
robwu
2014/10/06 08:30:21
Move the contents of this function to a separate m
aknudsen
2014/10/07 19:39:56
Done.
| |
131 | |
132 self._regexLabelElement = self._regexElement.createChild("label"); | |
133 self._regexLabelElement.textContent = WebInspector.UIString("Regex"); | |
134 self._regexElement.setAttribute("for", regexCheckboxId); | |
robwu
2014/10/06 08:30:21
Change to
this._regexLabelElement.setAttribute("f
aknudsen
2014/10/07 19:39:56
Done.
| |
135 } | |
136 | |
117 // Column 5 | 137 // Column 5 |
118 var cancelButtonElement = this._firstRowElement.createChild("td").createChil d("button"); | 138 var cancelButtonElement = this._firstRowElement.createChild("td").createChil d("button"); |
119 cancelButtonElement.textContent = WebInspector.UIString("Cancel"); | 139 cancelButtonElement.textContent = WebInspector.UIString("Cancel"); |
120 cancelButtonElement.tabIndex = -1; | 140 cancelButtonElement.tabIndex = -1; |
121 cancelButtonElement.addEventListener("click", this.closeSearch.bind(this), f alse); | 141 cancelButtonElement.addEventListener("click", this.closeSearch.bind(this), f alse); |
122 this._minimalSearchQuerySize = 3; | 142 this._minimalSearchQuerySize = 3; |
123 | 143 |
124 this._registerShortcuts(); | 144 this._registerShortcuts(); |
125 } | 145 } |
126 | 146 |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
581 * @param {string} text | 601 * @param {string} text |
582 */ | 602 */ |
583 replaceSelectionWith: function(text) { }, | 603 replaceSelectionWith: function(text) { }, |
584 | 604 |
585 /** | 605 /** |
586 * @param {string} query | 606 * @param {string} query |
587 * @param {string} replacement | 607 * @param {string} replacement |
588 */ | 608 */ |
589 replaceAllWith: function(query, replacement) { } | 609 replaceAllWith: function(query, replacement) { } |
590 } | 610 } |
OLD | NEW |