зеркало из https://github.com/mozilla/gecko-dev.git
Bug 780191 - Commit composition string before sending autocomplete text event. r=blassey
This commit is contained in:
Родитель
1e8552f4c9
Коммит
f8dde392f7
|
@ -4067,12 +4067,21 @@ var FormAssistant = {
|
|||
if (!this._currentInputElement)
|
||||
break;
|
||||
|
||||
this._currentInputElement.QueryInterface(Ci.nsIDOMNSEditableElement).setUserInput(aData);
|
||||
let editableElement = this._currentInputElement.QueryInterface(Ci.nsIDOMNSEditableElement);
|
||||
|
||||
// If we have an active composition string, commit it before sending
|
||||
// the autocomplete event with the text that will replace it.
|
||||
try {
|
||||
let imeEditor = editableElement.editor.QueryInterface(Ci.nsIEditorIMESupport);
|
||||
if (imeEditor.composing)
|
||||
imeEditor.forceCompositionEnd();
|
||||
} catch (e) {}
|
||||
|
||||
editableElement.setUserInput(aData);
|
||||
|
||||
let event = this._currentInputElement.ownerDocument.createEvent("Events");
|
||||
event.initEvent("DOMAutoComplete", true, true);
|
||||
this._currentInputElement.dispatchEvent(event);
|
||||
|
||||
break;
|
||||
|
||||
case "FormAssist:Blocklisted":
|
||||
|
|
Загрузка…
Ссылка в новой задаче