| 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 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 /** | 545 /** |
| 546 * @return {boolean} | 546 * @return {boolean} |
| 547 */ | 547 */ |
| 548 _acceptSuggestionInternal: function() | 548 _acceptSuggestionInternal: function() |
| 549 { | 549 { |
| 550 if (!this._prefixRange) | 550 if (!this._prefixRange) |
| 551 return false; | 551 return false; |
| 552 | 552 |
| 553 var text = this.text(); | 553 var text = this.text(); |
| 554 this._element.textContent = text.substring(0, this._prefixRange.startCol
umn) + this._currentSuggestion + text.substring(this._prefixRange.endColumn); | 554 this._element.textContent = text.substring(0, this._prefixRange.startCol
umn) + this._currentSuggestion + text.substring(this._prefixRange.endColumn); |
| 555 this._setDOMSelection(this._prefixRange.startColumn + this._currentSugge
stion.length, this._prefixRange.startColumn + this._currentSuggestion.length); | 555 this.setDOMSelection(this._prefixRange.startColumn + this._currentSugges
tion.length, this._prefixRange.startColumn + this._currentSuggestion.length); |
| 556 | 556 |
| 557 this.clearAutocomplete(); | 557 this.clearAutocomplete(); |
| 558 this.dispatchEventToListeners(WebInspector.TextPrompt.Events.ItemAccepte
d); | 558 this.dispatchEventToListeners(WebInspector.TextPrompt.Events.ItemAccepte
d); |
| 559 | 559 |
| 560 return true; | 560 return true; |
| 561 }, | 561 }, |
| 562 | 562 |
| 563 /** | 563 /** |
| 564 * @param {number} startColumn | 564 * @param {number} startColumn |
| 565 * @param {number} endColumn | 565 * @param {number} endColumn |
| 566 */ | 566 */ |
| 567 _setDOMSelection: function(startColumn, endColumn) | 567 setDOMSelection: function(startColumn, endColumn) |
| 568 { | 568 { |
| 569 this._element.normalize(); | 569 this._element.normalize(); |
| 570 var node = this._element.childNodes[0]; | 570 var node = this._element.childNodes[0]; |
| 571 if (!node || node === this._ghostTextElement) | 571 if (!node || node === this._ghostTextElement) |
| 572 return; | 572 return; |
| 573 var range = this._createRange(); | 573 var range = this._createRange(); |
| 574 range.setStart(node, startColumn); | 574 range.setStart(node, startColumn); |
| 575 range.setEnd(node, endColumn); | 575 range.setEnd(node, endColumn); |
| 576 var selection = this._element.getComponentSelection(); | 576 var selection = this._element.getComponentSelection(); |
| 577 selection.removeAllRanges(); | 577 selection.removeAllRanges(); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 /** | 661 /** |
| 662 * @return {?Element} | 662 * @return {?Element} |
| 663 */ | 663 */ |
| 664 proxyElementForTests: function() | 664 proxyElementForTests: function() |
| 665 { | 665 { |
| 666 return this._proxyElement || null; | 666 return this._proxyElement || null; |
| 667 }, | 667 }, |
| 668 | 668 |
| 669 __proto__: WebInspector.Object.prototype | 669 __proto__: WebInspector.Object.prototype |
| 670 }; | 670 }; |
| OLD | NEW |