Bug 882866 - Ignore all EditAction notifications caused by replaceSurroundingText. r=dflanagan

This commit is contained in:
Yuan Xulei 2013-06-23 20:43:40 -04:00
parent 7f542efd72
commit 19ef469157

View File

@ -208,6 +208,7 @@ let FormAssistant = {
_documentEncoder: null,
_editor: null,
_editing: false,
_ignoreEditActionOnce: false,
get focusedElement() {
if (this._focusedElement && Cu.isDeadWrapper(this._focusedElement))
@ -268,7 +269,9 @@ let FormAssistant = {
// current input field has changed.
EditAction: function fa_editAction() {
if (this._editing) {
this._editing = false;
return;
} else if (this._ignoreEditActionOnce) {
this._ignoreEditActionOnce = false;
return;
}
this.sendKeyboardState(this.focusedElement);
@ -364,7 +367,7 @@ let FormAssistant = {
case "keydown":
// Don't monitor the text change resulting from key event.
this._editing = true;
this._ignoreEditActionOnce = true;
// We use 'setTimeout' to wait until the input element accomplishes the
// change in selection range.
@ -374,7 +377,7 @@ let FormAssistant = {
break;
case "keyup":
this._editing = false;
this._ignoreEditActionOnce = false;
break;
}
},