| 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, !Range, boolean, function(!Array.<string>, number=
))} completions | |
| 35 * @param {string=} stopCharacters | |
| 36 */ | 34 */ |
| 37 WebInspector.TextPrompt = function(completions, stopCharacters) | 35 WebInspector.TextPrompt = function() |
| 38 { | 36 { |
| 39 /** | 37 /** |
| 40 * @type {!Element|undefined} | 38 * @type {!Element|undefined} |
| 41 */ | 39 */ |
| 42 this._proxyElement; | 40 this._proxyElement; |
| 43 this._proxyElementDisplay = "inline-block"; | 41 this._proxyElementDisplay = "inline-block"; |
| 44 this._loadCompletions = completions; | |
| 45 this._completionStopCharacters = stopCharacters || " =:[({;,!+-*/&|^<>."; | |
| 46 this._autocompletionTimeout = WebInspector.TextPrompt.DefaultAutocompletionT
imeout; | 42 this._autocompletionTimeout = WebInspector.TextPrompt.DefaultAutocompletionT
imeout; |
| 47 this._title = ""; | 43 this._title = ""; |
| 48 this._previousText = ""; | 44 this._previousText = ""; |
| 49 this._currentHintText = ""; | 45 this._currentHintText = ""; |
| 50 this._completionRequestId = 0; | 46 this._completionRequestId = 0; |
| 51 }; | 47 }; |
| 52 | 48 |
| 53 WebInspector.TextPrompt.DefaultAutocompletionTimeout = 250; | 49 WebInspector.TextPrompt.DefaultAutocompletionTimeout = 250; |
| 54 | 50 |
| 55 /** @enum {symbol} */ | 51 /** @enum {symbol} */ |
| 56 WebInspector.TextPrompt.Events = { | 52 WebInspector.TextPrompt.Events = { |
| 57 ItemApplied: Symbol("text-prompt-item-applied"), | 53 ItemApplied: Symbol("text-prompt-item-applied"), |
| 58 ItemAccepted: Symbol("text-prompt-item-accepted") | 54 ItemAccepted: Symbol("text-prompt-item-accepted") |
| 59 }; | 55 }; |
| 60 | 56 |
| 61 WebInspector.TextPrompt.prototype = { | 57 WebInspector.TextPrompt.prototype = { |
| 62 /** | 58 /** |
| 59 * @param {function(!Element, !Range, boolean, function(!Array.<string>, num
ber=))} completions |
| 60 * @param {string=} stopCharacters |
| 61 */ |
| 62 initialize: function(completions, stopCharacters) |
| 63 { |
| 64 this._loadCompletions = completions; |
| 65 this._completionStopCharacters = stopCharacters || " =:[({;,!+-*/&|^<>."
; |
| 66 }, |
| 67 |
| 68 /** |
| 63 * @param {number} timeout | 69 * @param {number} timeout |
| 64 */ | 70 */ |
| 65 setAutocompletionTimeout: function(timeout) | 71 setAutocompletionTimeout: function(timeout) |
| 66 { | 72 { |
| 67 this._autocompletionTimeout = timeout; | 73 this._autocompletionTimeout = timeout; |
| 68 }, | 74 }, |
| 69 | 75 |
| 70 /** | 76 /** |
| 71 * @param {boolean} suggestBoxEnabled | 77 * @param {boolean} suggestBoxEnabled |
| 72 */ | 78 */ |
| (...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 | 795 |
| 790 | 796 |
| 791 /** | 797 /** |
| 792 * @constructor | 798 * @constructor |
| 793 * @extends {WebInspector.TextPrompt} | 799 * @extends {WebInspector.TextPrompt} |
| 794 * @param {function(!Element, !Range, boolean, function(!Array.<string>, number=
))} completions | 800 * @param {function(!Element, !Range, boolean, function(!Array.<string>, number=
))} completions |
| 795 * @param {string=} stopCharacters | 801 * @param {string=} stopCharacters |
| 796 */ | 802 */ |
| 797 WebInspector.TextPromptWithHistory = function(completions, stopCharacters) | 803 WebInspector.TextPromptWithHistory = function(completions, stopCharacters) |
| 798 { | 804 { |
| 799 WebInspector.TextPrompt.call(this, completions, stopCharacters); | 805 WebInspector.TextPrompt.call(this); |
| 806 this.initialize(completions, stopCharacters); |
| 800 | 807 |
| 801 this._history = new WebInspector.HistoryManager(); | 808 this._history = new WebInspector.HistoryManager(); |
| 802 this._addCompletionsFromHistory = true; | 809 this._addCompletionsFromHistory = true; |
| 803 }; | 810 }; |
| 804 | 811 |
| 805 WebInspector.TextPromptWithHistory.prototype = { | 812 WebInspector.TextPromptWithHistory.prototype = { |
| 806 /** | 813 /** |
| 807 * @override | 814 * @override |
| 808 * @param {string} prefix | 815 * @param {string} prefix |
| 809 * @return {!WebInspector.SuggestBox.Suggestions} | 816 * @return {!WebInspector.SuggestBox.Suggestions} |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 996 }, | 1003 }, |
| 997 | 1004 |
| 998 /** | 1005 /** |
| 999 * @return {string|undefined} | 1006 * @return {string|undefined} |
| 1000 */ | 1007 */ |
| 1001 _currentHistoryItem: function() | 1008 _currentHistoryItem: function() |
| 1002 { | 1009 { |
| 1003 return this._data[this._data.length - this._historyOffset]; | 1010 return this._data[this._data.length - this._historyOffset]; |
| 1004 } | 1011 } |
| 1005 }; | 1012 }; |
| OLD | NEW |