Bug 860546 - Ignore content changes caused by key events. r=fabrice

This commit is contained in:
Yuan Xulei 2013-05-16 08:21:07 -04:00
parent 440c264cce
commit f7869463f2

View File

@ -188,6 +188,7 @@ let FormAssistant = {
addEventListener("beforeunload", this, true, false);
addEventListener("input", this, true, false);
addEventListener("keydown", this, true, false);
addEventListener("keyup", this, true, false);
addMessageListener("Forms:Select:Choice", this);
addMessageListener("Forms:Input:Value", this);
addMessageListener("Forms:Select:Blur", this);
@ -261,6 +262,7 @@ let FormAssistant = {
// current input field has changed.
EditAction: function fa_editAction() {
if (this._editing) {
this._editing = false;
return;
}
this.sendKeyboardState(this.focusedElement);
@ -359,12 +361,15 @@ let FormAssistant = {
this._editing = true;
// We use 'setTimeout' to wait until the input element accomplishes the
// change in selection range or text content.
// change in selection range.
content.setTimeout(function() {
this.updateSelection();
this._editing = false;
}.bind(this), 0);
break;
case "keyup":
this._editing = false;
break;
}
},