Bug 821329 - Set charCode of keypress event when TextInputHandler::InsertText() is called without native key event. r=smichaud, a=lsblakk
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 11 Jan 2013 12:30:12 +0900
changeset 127167 28ecd8d04c24cebcf6b18a17934727f0ba6ac0af
parent 127166 c489c87349b51c11116f3d9f440ab65c20559a65
child 127168 b7ceb5f0e97497f1f48bfda26f7582648fe3d4ff
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmichaud, lsblakk
bugs821329
milestone20.0a2
Bug 821329 - Set charCode of keypress event when TextInputHandler::InsertText() is called without native key event. r=smichaud, a=lsblakk
widget/cocoa/TextInputHandler.mm
--- a/widget/cocoa/TextInputHandler.mm
+++ b/widget/cocoa/TextInputHandler.mm
@@ -1943,16 +1943,19 @@ TextInputHandler::InsertText(NSAttribute
   if (currentKeyEvent) {
     NSEvent* keyEvent = currentKeyEvent->mKeyEvent;
     InitKeyEvent(keyEvent, keypressEvent, &str);
     if (currentKeyEvent->mKeyDownHandled) {
       keypressEvent.mFlags.mDefaultPrevented = true;
     }
   } else {
     nsCocoaUtils::InitInputEvent(keypressEvent, static_cast<NSEvent*>(nullptr));
+    if (keypressEvent.isChar) {
+      keypressEvent.charCode = str.CharAt(0);
+    }
     // Note that insertText is not called only at key pressing.
     if (!keypressEvent.charCode) {
       keypressEvent.keyCode =
         WidgetUtils::ComputeKeyCodeFromChar(keypressEvent.charCode);
     }
   }
 
   // Remove basic modifiers from keypress event because if they are included,