Chromium Code Reviews| Index: ui/views/cocoa/bridged_content_view.mm |
| diff --git a/ui/views/cocoa/bridged_content_view.mm b/ui/views/cocoa/bridged_content_view.mm |
| index 625cb43c9498ed66f63e6742c7595db5f00ed6b2..39dae81d1ae28dcbc2ee6a4a3e18ebe4e0f6af36 100644 |
| --- a/ui/views/cocoa/bridged_content_view.mm |
| +++ b/ui/views/cocoa/bridged_content_view.mm |
| @@ -438,10 +438,17 @@ - (void)insertTextInternal:(id)text { |
| // If a single character is inserted by keyDown's call to |
| // interpretKeyEvents: then use InsertChar() to allow editing events to be |
| // merged. |
| - if (isCharacterEvent) |
| - textInputClient_->InsertChar(GetCharacterEventFromNSEvent(keyDownEvent_)); |
| - else |
| + // Note we don't use |keyDownEvent_| to generate the synthetic ui::KeyEvent |
| + // since for text inserted using an IME, [keyDownEvent_ characters] might |
| + // not be the same as |text|. This is because |keyDownEvent_| will |
| + // correspond to the event that caused the composition text to be confirmed, |
| + // say, Return key press. |
| + if (isCharacterEvent) { |
| + textInputClient_->InsertChar(ui::KeyEvent([text characterAtIndex:0], |
| + ui::VKEY_UNKNOWN, ui::EF_NONE)); |
|
tapted
2016/07/26 06:04:17
Perhaps comment about VKEY_UNKNOWN?
E.g. before r
karandeepb
2016/07/27 04:47:32
Done. I guess this is fine, Else will have to expo
|
| + } else { |
| textInputClient_->InsertText(base::SysNSStringToUTF16(text)); |
| + } |
| return; |
| } |