| 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 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 /** | 711 /** |
| 706 * @return {?Element} | 712 * @return {?Element} |
| 707 */ | 713 */ |
| 708 proxyElementForTests: function() | 714 proxyElementForTests: function() |
| 709 { | 715 { |
| 710 return this._proxyElement || null; | 716 return this._proxyElement || null; |
| 711 }, | 717 }, |
| 712 | 718 |
| 713 __proto__: WebInspector.Object.prototype | 719 __proto__: WebInspector.Object.prototype |
| 714 }; | 720 }; |
| OLD | NEW |