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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 cancelButtonElement.textContent = WebInspector.UIString("Cancel"); | 119 cancelButtonElement.textContent = WebInspector.UIString("Cancel"); |
120 cancelButtonElement.tabIndex = -1; | 120 cancelButtonElement.tabIndex = -1; |
121 cancelButtonElement.addEventListener("click", this.closeSearch.bind(this), f
alse); | 121 cancelButtonElement.addEventListener("click", this.closeSearch.bind(this), f
alse); |
122 this._minimalSearchQuerySize = 3; | 122 this._minimalSearchQuerySize = 3; |
123 | 123 |
124 this._registerShortcuts(); | 124 this._registerShortcuts(); |
125 } | 125 } |
126 | 126 |
127 WebInspector.SearchableView._lastUniqueId = 0; | 127 WebInspector.SearchableView._lastUniqueId = 0; |
128 | 128 |
| 129 /** |
| 130 * @return {!Array.<!WebInspector.KeyboardShortcut.Descriptor>} |
| 131 */ |
129 WebInspector.SearchableView.findShortcuts = function() | 132 WebInspector.SearchableView.findShortcuts = function() |
130 { | 133 { |
131 if (WebInspector.SearchableView._findShortcuts) | 134 if (WebInspector.SearchableView._findShortcuts) |
132 return WebInspector.SearchableView._findShortcuts; | 135 return WebInspector.SearchableView._findShortcuts; |
133 WebInspector.SearchableView._findShortcuts = [WebInspector.KeyboardShortcut.
makeDescriptor("f", WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)]; | 136 WebInspector.SearchableView._findShortcuts = [WebInspector.KeyboardShortcut.
makeDescriptor("f", WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)]; |
134 if (!WebInspector.isMac()) | 137 if (!WebInspector.isMac()) |
135 WebInspector.SearchableView._findShortcuts.push(WebInspector.KeyboardSho
rtcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F3)); | 138 WebInspector.SearchableView._findShortcuts.push(WebInspector.KeyboardSho
rtcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F3)); |
136 return WebInspector.SearchableView._findShortcuts; | 139 return WebInspector.SearchableView._findShortcuts; |
137 } | 140 } |
138 | 141 |
| 142 /** |
| 143 * @return {!Array.<!WebInspector.KeyboardShortcut.Descriptor>} |
| 144 */ |
139 WebInspector.SearchableView.cancelSearchShortcuts = function() | 145 WebInspector.SearchableView.cancelSearchShortcuts = function() |
140 { | 146 { |
141 if (WebInspector.SearchableView._cancelSearchShortcuts) | 147 if (WebInspector.SearchableView._cancelSearchShortcuts) |
142 return WebInspector.SearchableView._cancelSearchShortcuts; | 148 return WebInspector.SearchableView._cancelSearchShortcuts; |
143 WebInspector.SearchableView._cancelSearchShortcuts = [WebInspector.KeyboardS
hortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Esc)]; | 149 WebInspector.SearchableView._cancelSearchShortcuts = [WebInspector.KeyboardS
hortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Esc)]; |
144 return WebInspector.SearchableView._cancelSearchShortcuts; | 150 return WebInspector.SearchableView._cancelSearchShortcuts; |
145 } | 151 } |
146 | 152 |
| 153 /** |
| 154 * @return {!Array.<!WebInspector.KeyboardShortcut.Descriptor>} |
| 155 */ |
147 WebInspector.SearchableView.findNextShortcut = function() | 156 WebInspector.SearchableView.findNextShortcut = function() |
148 { | 157 { |
149 if (WebInspector.SearchableView._findNextShortcut) | 158 if (WebInspector.SearchableView._findNextShortcut) |
150 return WebInspector.SearchableView._findNextShortcut; | 159 return WebInspector.SearchableView._findNextShortcut; |
151 WebInspector.SearchableView._findNextShortcut = []; | 160 WebInspector.SearchableView._findNextShortcut = []; |
152 if (WebInspector.isMac()) | 161 if (WebInspector.isMac()) |
153 WebInspector.SearchableView._findNextShortcut.push(WebInspector.Keyboard
Shortcut.makeDescriptor("g", WebInspector.KeyboardShortcut.Modifiers.Meta)); | 162 WebInspector.SearchableView._findNextShortcut.push(WebInspector.Keyboard
Shortcut.makeDescriptor("g", WebInspector.KeyboardShortcut.Modifiers.Meta)); |
154 return WebInspector.SearchableView._findNextShortcut; | 163 return WebInspector.SearchableView._findNextShortcut; |
155 } | 164 } |
156 | 165 |
| 166 /** |
| 167 * @return {!Array.<!WebInspector.KeyboardShortcut.Descriptor>} |
| 168 */ |
157 WebInspector.SearchableView.findPreviousShortcuts = function() | 169 WebInspector.SearchableView.findPreviousShortcuts = function() |
158 { | 170 { |
159 if (WebInspector.SearchableView._findPreviousShortcuts) | 171 if (WebInspector.SearchableView._findPreviousShortcuts) |
160 return WebInspector.SearchableView._findPreviousShortcuts; | 172 return WebInspector.SearchableView._findPreviousShortcuts; |
161 WebInspector.SearchableView._findPreviousShortcuts = []; | 173 WebInspector.SearchableView._findPreviousShortcuts = []; |
162 if (WebInspector.isMac()) | 174 if (WebInspector.isMac()) |
163 WebInspector.SearchableView._findPreviousShortcuts.push(WebInspector.Key
boardShortcut.makeDescriptor("g", WebInspector.KeyboardShortcut.Modifiers.Meta |
WebInspector.KeyboardShortcut.Modifiers.Shift)); | 175 WebInspector.SearchableView._findPreviousShortcuts.push(WebInspector.Key
boardShortcut.makeDescriptor("g", WebInspector.KeyboardShortcut.Modifiers.Meta |
WebInspector.KeyboardShortcut.Modifiers.Shift)); |
164 return WebInspector.SearchableView._findPreviousShortcuts; | 176 return WebInspector.SearchableView._findPreviousShortcuts; |
165 } | 177 } |
166 | 178 |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 _updateReplaceVisibility: function() | 392 _updateReplaceVisibility: function() |
381 { | 393 { |
382 this._replaceElement.classList.toggle("hidden", !this._replaceable); | 394 this._replaceElement.classList.toggle("hidden", !this._replaceable); |
383 if (!this._replaceable) { | 395 if (!this._replaceable) { |
384 this._replaceCheckboxElement.checked = false; | 396 this._replaceCheckboxElement.checked = false; |
385 this._updateSecondRowVisibility(); | 397 this._updateSecondRowVisibility(); |
386 } | 398 } |
387 }, | 399 }, |
388 | 400 |
389 /** | 401 /** |
390 * @param {!Event} event | 402 * @param {?Event} event |
391 */ | 403 */ |
392 _onSearchFieldManualFocus: function(event) | 404 _onSearchFieldManualFocus: function(event) |
393 { | 405 { |
394 WebInspector.setCurrentFocusElement(event.target); | 406 WebInspector.setCurrentFocusElement(event.target); |
395 }, | 407 }, |
396 | 408 |
397 /** | 409 /** |
398 * @param {!KeyboardEvent} event | 410 * @param {?Event} event |
399 */ | 411 */ |
400 _onSearchKeyDown: function(event) | 412 _onSearchKeyDown: function(event) |
401 { | 413 { |
402 if (!isEnterKey(event)) | 414 if (!isEnterKey(event)) |
403 return; | 415 return; |
404 | 416 |
405 if (!this._currentQuery) | 417 if (!this._currentQuery) |
406 this._performSearch(true, true, event.shiftKey); | 418 this._performSearch(true, true, event.shiftKey); |
407 else | 419 else |
408 this._jumpToNextSearchResult(event.shiftKey); | 420 this._jumpToNextSearchResult(event.shiftKey); |
409 }, | 421 }, |
410 | 422 |
411 /** | 423 /** |
412 * @param {!KeyboardEvent} event | 424 * @param {?Event} event |
413 */ | 425 */ |
414 _onReplaceKeyDown: function(event) | 426 _onReplaceKeyDown: function(event) |
415 { | 427 { |
416 if (isEnterKey(event)) | 428 if (isEnterKey(event)) |
417 this._replace(); | 429 this._replace(); |
418 }, | 430 }, |
419 | 431 |
420 /** | 432 /** |
421 * @param {boolean=} isBackwardSearch | 433 * @param {boolean=} isBackwardSearch |
422 */ | 434 */ |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 * @param {string} text | 581 * @param {string} text |
570 */ | 582 */ |
571 replaceSelectionWith: function(text) { }, | 583 replaceSelectionWith: function(text) { }, |
572 | 584 |
573 /** | 585 /** |
574 * @param {string} query | 586 * @param {string} query |
575 * @param {string} replacement | 587 * @param {string} replacement |
576 */ | 588 */ |
577 replaceAllWith: function(query, replacement) { } | 589 replaceAllWith: function(query, replacement) { } |
578 } | 590 } |
OLD | NEW |