| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 */ | 28 */ |
| 29 | 29 |
| 30 /** | 30 /** |
| 31 * @constructor | 31 * @constructor |
| 32 * @extends {WebInspector.Object} | 32 * @extends {WebInspector.Object} |
| 33 * @implements {WebInspector.SuggestBoxDelegate} | 33 * @implements {WebInspector.SuggestBoxDelegate} |
| 34 * @param {function(!Element, string, number, !Range, boolean, function(!Array.<
string>, number=))} completions | 34 * @param {function(!Element, !Range, boolean, function(!Array.<string>, number=
))} completions |
| 35 * @param {string=} stopCharacters | 35 * @param {string=} stopCharacters |
| 36 */ | 36 */ |
| 37 WebInspector.TextPrompt = function(completions, stopCharacters) | 37 WebInspector.TextPrompt = function(completions, stopCharacters) |
| 38 { | 38 { |
| 39 /** | 39 /** |
| 40 * @type {!Element|undefined} | 40 * @type {!Element|undefined} |
| 41 */ | 41 */ |
| 42 this._proxyElement; | 42 this._proxyElement; |
| 43 this._proxyElementDisplay = "inline-block"; | 43 this._proxyElementDisplay = "inline-block"; |
| 44 this._loadCompletions = completions; | 44 this._loadCompletions = completions; |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 if (wordSuffixRange.toString().length) | 430 if (wordSuffixRange.toString().length) |
| 431 shouldExit = true; | 431 shouldExit = true; |
| 432 } | 432 } |
| 433 if (shouldExit) { | 433 if (shouldExit) { |
| 434 this.hideSuggestBox(); | 434 this.hideSuggestBox(); |
| 435 return; | 435 return; |
| 436 } | 436 } |
| 437 | 437 |
| 438 var wordPrefixRange = selectionRange.startContainer.rangeOfWord(selectio
nRange.startOffset, this._completionStopCharacters, this._element, "backward"); | 438 var wordPrefixRange = selectionRange.startContainer.rangeOfWord(selectio
nRange.startOffset, this._completionStopCharacters, this._element, "backward"); |
| 439 this._waitingForCompletions = true; | 439 this._waitingForCompletions = true; |
| 440 this._loadCompletions(/** @type {!Element} */ (this._proxyElement), this
.text(), selectionRange.startOffset, wordPrefixRange, force || false, this._comp
letionsReady.bind(this, selection, wordPrefixRange, !!reverse, !!force)); | 440 this._loadCompletions(/** @type {!Element} */ (this._proxyElement), word
PrefixRange, force || false, this._completionsReady.bind(this, selection, wordPr
efixRange, !!reverse, !!force)); |
| 441 }, | 441 }, |
| 442 | 442 |
| 443 disableDefaultSuggestionForEmptyInput: function() | 443 disableDefaultSuggestionForEmptyInput: function() |
| 444 { | 444 { |
| 445 this._disableDefaultSuggestionForEmptyInput = true; | 445 this._disableDefaultSuggestionForEmptyInput = true; |
| 446 }, | 446 }, |
| 447 | 447 |
| 448 /** | 448 /** |
| 449 * @param {!Selection} selection | 449 * @param {!Selection} selection |
| 450 * @param {!Range} textRange | 450 * @param {!Range} textRange |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 return this._proxyElement || null; | 817 return this._proxyElement || null; |
| 818 }, | 818 }, |
| 819 | 819 |
| 820 __proto__: WebInspector.Object.prototype | 820 __proto__: WebInspector.Object.prototype |
| 821 } | 821 } |
| 822 | 822 |
| 823 | 823 |
| 824 /** | 824 /** |
| 825 * @constructor | 825 * @constructor |
| 826 * @extends {WebInspector.TextPrompt} | 826 * @extends {WebInspector.TextPrompt} |
| 827 * @param {function(!Element, string, number, !Range, boolean, function(!Array.<
string>, number=))} completions | 827 * @param {function(!Element, !Range, boolean, function(!Array.<string>, number=
))} completions |
| 828 * @param {string=} stopCharacters | 828 * @param {string=} stopCharacters |
| 829 */ | 829 */ |
| 830 WebInspector.TextPromptWithHistory = function(completions, stopCharacters) | 830 WebInspector.TextPromptWithHistory = function(completions, stopCharacters) |
| 831 { | 831 { |
| 832 WebInspector.TextPrompt.call(this, completions, stopCharacters); | 832 WebInspector.TextPrompt.call(this, completions, stopCharacters); |
| 833 | 833 |
| 834 /** | 834 /** |
| 835 * @type {!Array.<string>} | 835 * @type {!Array.<string>} |
| 836 */ | 836 */ |
| 837 this._data = []; | 837 this._data = []; |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1013 | 1013 |
| 1014 return; | 1014 return; |
| 1015 } | 1015 } |
| 1016 | 1016 |
| 1017 WebInspector.TextPrompt.prototype.onKeyDown.apply(this, arguments); | 1017 WebInspector.TextPrompt.prototype.onKeyDown.apply(this, arguments); |
| 1018 }, | 1018 }, |
| 1019 | 1019 |
| 1020 __proto__: WebInspector.TextPrompt.prototype | 1020 __proto__: WebInspector.TextPrompt.prototype |
| 1021 } | 1021 } |
| 1022 | 1022 |
| OLD | NEW |