Bug 975383 part.7 Remove compositionupdate dispatchers in forms.js of B2G r=yxl
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 03 Oct 2014 15:33:49 +0900
changeset 208531 d4b4cca22c1970a9918b026045cb7d36c33e98f6
parent 208530 432ecdbf058a8ea649a283f0cd22f9b39bee54ec
child 208532 e730625ff9e11bf232b0b9f46ed1e1583e8c84c8
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersyxl
bugs975383
milestone35.0a1
Bug 975383 part.7 Remove compositionupdate dispatchers in forms.js of B2G r=yxl
dom/inputmethod/forms.js
--- 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;
   }
 };