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 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 { | 562 { |
563 this._acceptSuggestionInternal(); | 563 this._acceptSuggestionInternal(); |
564 }, | 564 }, |
565 | 565 |
566 /** | 566 /** |
567 * @param {boolean=} prefixAccepted | 567 * @param {boolean=} prefixAccepted |
568 * @return {boolean} | 568 * @return {boolean} |
569 */ | 569 */ |
570 _acceptSuggestionInternal: function(prefixAccepted) | 570 _acceptSuggestionInternal: function(prefixAccepted) |
571 { | 571 { |
572 if (this._isAcceptingSuggestion) | |
573 return false; | |
574 | |
575 if (!this.autoCompleteElement || !this.autoCompleteElement.parentNode) | 572 if (!this.autoCompleteElement || !this.autoCompleteElement.parentNode) |
576 return false; | 573 return false; |
577 | 574 |
578 var text = this.autoCompleteElement.textContent; | 575 var text = this.autoCompleteElement.textContent; |
579 var textNode = document.createTextNode(text); | 576 var textNode = document.createTextNode(text); |
580 this.autoCompleteElement.parentNode.replaceChild(textNode, this.autoComp
leteElement); | 577 this.autoCompleteElement.parentNode.replaceChild(textNode, this.autoComp
leteElement); |
581 delete this.autoCompleteElement; | 578 delete this.autoCompleteElement; |
582 | 579 |
583 var finalSelectionRange = document.createRange(); | 580 var finalSelectionRange = document.createRange(); |
584 finalSelectionRange.setStart(textNode, text.length); | 581 finalSelectionRange.setStart(textNode, text.length); |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 | 896 |
900 return; | 897 return; |
901 } | 898 } |
902 | 899 |
903 WebInspector.TextPrompt.prototype.onKeyDown.apply(this, arguments); | 900 WebInspector.TextPrompt.prototype.onKeyDown.apply(this, arguments); |
904 }, | 901 }, |
905 | 902 |
906 __proto__: WebInspector.TextPrompt.prototype | 903 __proto__: WebInspector.TextPrompt.prototype |
907 } | 904 } |
908 | 905 |
OLD | NEW |