| 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 30 matching lines...) Expand all Loading... |
| 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; |
| 45 this._completionStopCharacters = stopCharacters || " =:[({;,!+-*/&|^<>."; | 45 this._completionStopCharacters = stopCharacters || " =:[({;,!+-*/&|^<>."; |
| 46 this._autocompletionTimeout = WebInspector.TextPrompt.DefaultAutocompletionT
imeout; | 46 this._autocompletionTimeout = WebInspector.TextPrompt.DefaultAutocompletionT
imeout; |
| 47 this._title = ""; | 47 this._title = ""; |
| 48 this._previousText = ""; | 48 this._previousText = ""; |
| 49 this._currentHintText = ""; | 49 this._currentHintText = ""; |
| 50 this._completionRequestId = 0; | 50 this._completionRequestId = 0; |
| 51 } | 51 }; |
| 52 | 52 |
| 53 WebInspector.TextPrompt.DefaultAutocompletionTimeout = 250; | 53 WebInspector.TextPrompt.DefaultAutocompletionTimeout = 250; |
| 54 | 54 |
| 55 /** @enum {symbol} */ | 55 /** @enum {symbol} */ |
| 56 WebInspector.TextPrompt.Events = { | 56 WebInspector.TextPrompt.Events = { |
| 57 ItemApplied: Symbol("text-prompt-item-applied"), | 57 ItemApplied: Symbol("text-prompt-item-applied"), |
| 58 ItemAccepted: Symbol("text-prompt-item-accepted") | 58 ItemAccepted: Symbol("text-prompt-item-accepted") |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 WebInspector.TextPrompt.prototype = { | 61 WebInspector.TextPrompt.prototype = { |
| (...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 778 | 778 |
| 779 /** | 779 /** |
| 780 * @return {?Element} | 780 * @return {?Element} |
| 781 */ | 781 */ |
| 782 proxyElementForTests: function() | 782 proxyElementForTests: function() |
| 783 { | 783 { |
| 784 return this._proxyElement || null; | 784 return this._proxyElement || null; |
| 785 }, | 785 }, |
| 786 | 786 |
| 787 __proto__: WebInspector.Object.prototype | 787 __proto__: WebInspector.Object.prototype |
| 788 } | 788 }; |
| 789 | 789 |
| 790 | 790 |
| 791 /** | 791 /** |
| 792 * @constructor | 792 * @constructor |
| 793 * @extends {WebInspector.TextPrompt} | 793 * @extends {WebInspector.TextPrompt} |
| 794 * @param {function(!Element, !Range, boolean, function(!Array.<string>, number=
))} completions | 794 * @param {function(!Element, !Range, boolean, function(!Array.<string>, number=
))} completions |
| 795 * @param {string=} stopCharacters | 795 * @param {string=} stopCharacters |
| 796 */ | 796 */ |
| 797 WebInspector.TextPromptWithHistory = function(completions, stopCharacters) | 797 WebInspector.TextPromptWithHistory = function(completions, stopCharacters) |
| 798 { | 798 { |
| 799 WebInspector.TextPrompt.call(this, completions, stopCharacters); | 799 WebInspector.TextPrompt.call(this, completions, stopCharacters); |
| 800 | 800 |
| 801 this._history = new WebInspector.HistoryManager(); | 801 this._history = new WebInspector.HistoryManager(); |
| 802 this._addCompletionsFromHistory = true; | 802 this._addCompletionsFromHistory = true; |
| 803 } | 803 }; |
| 804 | 804 |
| 805 WebInspector.TextPromptWithHistory.prototype = { | 805 WebInspector.TextPromptWithHistory.prototype = { |
| 806 /** | 806 /** |
| 807 * @override | 807 * @override |
| 808 * @param {string} prefix | 808 * @param {string} prefix |
| 809 * @return {!WebInspector.SuggestBox.Suggestions} | 809 * @return {!WebInspector.SuggestBox.Suggestions} |
| 810 */ | 810 */ |
| 811 additionalCompletions: function(prefix) | 811 additionalCompletions: function(prefix) |
| 812 { | 812 { |
| 813 if (!this._addCompletionsFromHistory || !this.isCaretAtEndOfPrompt()) | 813 if (!this._addCompletionsFromHistory || !this.isCaretAtEndOfPrompt()) |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 | 897 |
| 898 /** | 898 /** |
| 899 * @return {!WebInspector.HistoryManager} | 899 * @return {!WebInspector.HistoryManager} |
| 900 */ | 900 */ |
| 901 history: function() | 901 history: function() |
| 902 { | 902 { |
| 903 return this._history; | 903 return this._history; |
| 904 }, | 904 }, |
| 905 | 905 |
| 906 __proto__: WebInspector.TextPrompt.prototype | 906 __proto__: WebInspector.TextPrompt.prototype |
| 907 } | 907 }; |
| 908 | 908 |
| 909 /** | 909 /** |
| 910 * @constructor | 910 * @constructor |
| 911 */ | 911 */ |
| 912 WebInspector.HistoryManager = function() | 912 WebInspector.HistoryManager = function() |
| 913 { | 913 { |
| 914 /** | 914 /** |
| 915 * @type {!Array.<string>} | 915 * @type {!Array.<string>} |
| 916 */ | 916 */ |
| 917 this._data = []; | 917 this._data = []; |
| 918 | 918 |
| 919 /** | 919 /** |
| 920 * 1-based entry in the history stack. | 920 * 1-based entry in the history stack. |
| 921 * @type {number} | 921 * @type {number} |
| 922 */ | 922 */ |
| 923 this._historyOffset = 1; | 923 this._historyOffset = 1; |
| 924 } | 924 }; |
| 925 | 925 |
| 926 WebInspector.HistoryManager.prototype = { | 926 WebInspector.HistoryManager.prototype = { |
| 927 /** | 927 /** |
| 928 * @return {!Array.<string>} | 928 * @return {!Array.<string>} |
| 929 */ | 929 */ |
| 930 historyData: function() | 930 historyData: function() |
| 931 { | 931 { |
| 932 return this._data; | 932 return this._data; |
| 933 }, | 933 }, |
| 934 | 934 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 996 }, | 996 }, |
| 997 | 997 |
| 998 /** | 998 /** |
| 999 * @return {string|undefined} | 999 * @return {string|undefined} |
| 1000 */ | 1000 */ |
| 1001 _currentHistoryItem: function() | 1001 _currentHistoryItem: function() |
| 1002 { | 1002 { |
| 1003 return this._data[this._data.length - this._historyOffset]; | 1003 return this._data[this._data.length - this._historyOffset]; |
| 1004 } | 1004 } |
| 1005 }; | 1005 }; |
| OLD | NEW |