Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(292)

Side by Side Diff: Source/devtools/front_end/ui/TextPrompt.js

Issue 1264133002: Devtools: [WIP] Implement enhanced devtools extension language APIs Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Small cleanups - prefer URIs to contentURLs, revert protocol unifications, remove lambdas Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/devtools/front_end/ui/SuggestBox.js ('k') | Source/devtools/front_end/ui/suggestBox.css » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 34 * @param {function(!Element, string, number, !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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 if (wordSuffixRange.toString().length) 393 if (wordSuffixRange.toString().length)
394 shouldExit = true; 394 shouldExit = true;
395 } 395 }
396 if (shouldExit) { 396 if (shouldExit) {
397 this.hideSuggestBox(); 397 this.hideSuggestBox();
398 return; 398 return;
399 } 399 }
400 400
401 var wordPrefixRange = selectionRange.startContainer.rangeOfWord(selectio nRange.startOffset, this._completionStopCharacters, this._element, "backward"); 401 var wordPrefixRange = selectionRange.startContainer.rangeOfWord(selectio nRange.startOffset, this._completionStopCharacters, this._element, "backward");
402 this._waitingForCompletions = true; 402 this._waitingForCompletions = true;
403 this._loadCompletions(/** @type {!Element} */ (this._proxyElement), word PrefixRange, force || false, this._completionsReady.bind(this, selection, wordPr efixRange, !!reverse)); 403 this._loadCompletions(/** @type {!Element} */ (this._proxyElement), this .text(), selectionRange.startOffset, wordPrefixRange, force || false, this._comp letionsReady.bind(this, selection, wordPrefixRange, !!reverse));
404 }, 404 },
405 405
406 disableDefaultSuggestionForEmptyInput: function() 406 disableDefaultSuggestionForEmptyInput: function()
407 { 407 {
408 this._disableDefaultSuggestionForEmptyInput = true; 408 this._disableDefaultSuggestionForEmptyInput = true;
409 }, 409 },
410 410
411 /** 411 /**
412 * @param {!Selection} selection 412 * @param {!Selection} selection
413 * @param {!Range} textRange 413 * @param {!Range} textRange
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 return this._proxyElement || null; 755 return this._proxyElement || null;
756 }, 756 },
757 757
758 __proto__: WebInspector.Object.prototype 758 __proto__: WebInspector.Object.prototype
759 } 759 }
760 760
761 761
762 /** 762 /**
763 * @constructor 763 * @constructor
764 * @extends {WebInspector.TextPrompt} 764 * @extends {WebInspector.TextPrompt}
765 * @param {function(!Element, !Range, boolean, function(!Array.<string>, number= ))} completions 765 * @param {function(!Element, string, number, !Range, boolean, function(!Array.< string>, number=))} completions
766 * @param {string=} stopCharacters 766 * @param {string=} stopCharacters
767 */ 767 */
768 WebInspector.TextPromptWithHistory = function(completions, stopCharacters) 768 WebInspector.TextPromptWithHistory = function(completions, stopCharacters)
769 { 769 {
770 WebInspector.TextPrompt.call(this, completions, stopCharacters); 770 WebInspector.TextPrompt.call(this, completions, stopCharacters);
771 771
772 /** 772 /**
773 * @type {!Array.<string>} 773 * @type {!Array.<string>}
774 */ 774 */
775 this._data = []; 775 this._data = [];
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 915
916 return; 916 return;
917 } 917 }
918 918
919 WebInspector.TextPrompt.prototype.onKeyDown.apply(this, arguments); 919 WebInspector.TextPrompt.prototype.onKeyDown.apply(this, arguments);
920 }, 920 },
921 921
922 __proto__: WebInspector.TextPrompt.prototype 922 __proto__: WebInspector.TextPrompt.prototype
923 } 923 }
924 924
OLDNEW
« no previous file with comments | « Source/devtools/front_end/ui/SuggestBox.js ('k') | Source/devtools/front_end/ui/suggestBox.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698