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 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 var fullWordRange = this._createRange(); | 480 var fullWordRange = this._createRange(); |
481 fullWordRange.setStart(originalWordQueryRange.startContainer, originalWordQu
eryRange.startOffset); | 481 fullWordRange.setStart(originalWordQueryRange.startContainer, originalWordQu
eryRange.startOffset); |
482 fullWordRange.setEnd(selectionRange.endContainer, selectionRange.endOffset); | 482 fullWordRange.setEnd(selectionRange.endContainer, selectionRange.endOffset); |
483 | 483 |
484 if (query + selectionRange.toString() !== fullWordRange.toString()) | 484 if (query + selectionRange.toString() !== fullWordRange.toString()) |
485 return; | 485 return; |
486 | 486 |
487 var beforeRange = this._createRange(); | 487 var beforeRange = this._createRange(); |
488 beforeRange.setStart(this._element, 0); | 488 beforeRange.setStart(this._element, 0); |
489 beforeRange.setEnd(fullWordRange.startContainer, fullWordRange.startOffset); | 489 beforeRange.setEnd(fullWordRange.startContainer, fullWordRange.startOffset); |
490 this._queryRange = new Common.TextRange( | 490 this._queryRange = new TextUtils.TextRange( |
491 0, beforeRange.toString().length, 0, beforeRange.toString().length + ful
lWordRange.toString().length); | 491 0, beforeRange.toString().length, 0, beforeRange.toString().length + ful
lWordRange.toString().length); |
492 | 492 |
493 var shouldSelect = !this._disableDefaultSuggestionForEmptyInput || !!this.te
xt(); | 493 var shouldSelect = !this._disableDefaultSuggestionForEmptyInput || !!this.te
xt(); |
494 if (this._suggestBox) { | 494 if (this._suggestBox) { |
495 this._suggestBox.updateSuggestions( | 495 this._suggestBox.updateSuggestions( |
496 this._boxForAnchorAtStart(selection, fullWordRange), completions, shou
ldSelect, !this._isCaretAtEndOfPrompt(), | 496 this._boxForAnchorAtStart(selection, fullWordRange), completions, shou
ldSelect, !this._isCaretAtEndOfPrompt(), |
497 this.text()); | 497 this.text()); |
498 } | 498 } |
499 } | 499 } |
500 | 500 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 */ | 634 */ |
635 proxyElementForTests() { | 635 proxyElementForTests() { |
636 return this._proxyElement || null; | 636 return this._proxyElement || null; |
637 } | 637 } |
638 }; | 638 }; |
639 | 639 |
640 UI.TextPrompt.DefaultAutocompletionTimeout = 250; | 640 UI.TextPrompt.DefaultAutocompletionTimeout = 250; |
641 | 641 |
642 /** @implements {Common.Emittable} */ | 642 /** @implements {Common.Emittable} */ |
643 UI.TextPrompt.TextChangedEvent = class {}; | 643 UI.TextPrompt.TextChangedEvent = class {}; |
OLD | NEW |