Bug 904530 - endComposition should commit text before cursor. r=masayuki
authorYuan Xulei <xyuan@mozilla.com>
Thu, 05 Sep 2013 08:20:25 -0400
changeset 145579 c45e24c1798bc17ab52b0793822eec592ed19359
parent 145578 5033980115faf63df1273d7c6fca0299d55942c4
child 145580 745aef6fe389622442abd85c99ea1456279c96f8
push id739
push userryanvm@gmail.com
push dateThu, 05 Sep 2013 12:21:09 +0000
treeherderb2g-inbound@745aef6fe389 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs904530
milestone26.0a1
Bug 904530 - endComposition should commit text before cursor. r=masayuki
b2g/chrome/content/forms.js
--- a/b2g/chrome/content/forms.js
+++ b/b2g/chrome/content/forms.js
@@ -1135,17 +1135,19 @@ let CompositionManager =  {
   endComposition: function cm_endComposition(text) {
     if (!this._isStarted) {
       return;
     }
     // Update the composing text.
     if (this._text !== text) {
       domWindowUtils.sendCompositionEvent('compositionupdate', text, '');
     }
-    domWindowUtils.sendTextEvent(text, 0, 0, 0, 0, 0, 0, 0, 0);
+    // Set the cursor position to |text.length| so that the text will be
+    // committed before the cursor position.
+    domWindowUtils.sendTextEvent(text, 0, 0, 0, 0, 0, 0, text.length, 0);
     domWindowUtils.sendCompositionEvent('compositionend', text, '');
     this._text = '';
     this._isStarted = false;
   },
 
   // Composition ends due to external actions.
   onCompositionEnd: function cm_onCompositionEnd() {
     if (!this._isStarted) {