Bug 975383 part.7 Remove compositionupdate dispatchers in forms.js of B2G r=yxl
--- a/dom/inputmethod/forms.js
+++ b/dom/inputmethod/forms.js
@@ -1175,17 +1175,16 @@ function replaceSurroundingText(element,
// Insert the text to be replaced with.
editor.insertText(text);
}
return true;
}
let CompositionManager = {
_isStarted: false,
- _text: '',
_clauseAttrMap: {
'raw-input':
Ci.nsICompositionStringSynthesizer.ATTR_RAWINPUT,
'selected-raw-text':
Ci.nsICompositionStringSynthesizer.ATTR_SELECTEDRAWTEXT,
'converted-text':
Ci.nsICompositionStringSynthesizer.ATTR_CONVERTEDTEXT,
'selected-converted-text':
@@ -1228,56 +1227,46 @@ let CompositionManager = {
clauseLens.push(len);
clauseAttrs.push(Ci.nsICompositionStringSynthesizer.ATTR_RAWINPUT);
}
// Start composition if need to.
if (!this._isStarted) {
this._isStarted = true;
domWindowUtils.sendCompositionEvent('compositionstart', '', '');
- this._text = '';
}
// Update the composing text.
- if (this._text !== text) {
- this._text = text;
- domWindowUtils.sendCompositionEvent('compositionupdate', text, '');
- }
let compositionString = domWindowUtils.createCompositionStringSynthesizer();
compositionString.setString(text);
for (var i = 0; i < clauseLens.length; i++) {
compositionString.appendClause(clauseLens[i], clauseAttrs[i]);
}
if (cursor >= 0) {
compositionString.setCaret(cursor, 0);
}
compositionString.dispatchEvent();
},
endComposition: function cm_endComposition(text) {
if (!this._isStarted) {
return;
}
// Update the composing text.
- if (this._text !== text) {
- domWindowUtils.sendCompositionEvent('compositionupdate', text, '');
- }
let compositionString = domWindowUtils.createCompositionStringSynthesizer();
compositionString.setString(text);
// Set the cursor position to |text.length| so that the text will be
// committed before the cursor position.
compositionString.setCaret(text.length, 0);
compositionString.dispatchEvent();
domWindowUtils.sendCompositionEvent('compositionend', text, '');
- this._text = '';
this._isStarted = false;
},
// Composition ends due to external actions.
onCompositionEnd: function cm_onCompositionEnd() {
if (!this._isStarted) {
return;
}
- this._text = '';
this._isStarted = false;
}
};