Commit b245e75b authored by kevers@chromium.org's avatar kevers@chromium.org

Fix typing of accented characters on the VK in Google Docs.

BUG=257093, 257098

Review URL: https://chromiumcodereview.appspot.com/23536030

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221768 0039d316-1c4b-4281-b951-d872f2087c98
parent 07b87731
...@@ -22,6 +22,13 @@ namespace { ...@@ -22,6 +22,13 @@ namespace {
const char kKeyDown[] ="keydown"; const char kKeyDown[] ="keydown";
const char kKeyUp[] = "keyup"; const char kKeyUp[] = "keyup";
void SendProcessKeyEvent(ui::EventType type, aura::RootWindow* root_window) {
ui::TranslatedKeyEvent event(type == ui::ET_KEY_PRESSED,
ui::VKEY_PROCESSKEY,
ui::EF_NONE);
root_window->AsRootWindowHostDelegate()->OnHostKeyEvent(&event);
}
} // namespace } // namespace
namespace keyboard { namespace keyboard {
...@@ -107,18 +114,24 @@ bool SendKeyEvent(const std::string type, ...@@ -107,18 +114,24 @@ bool SendKeyEvent(const std::string type,
ui::KeyboardCode code = static_cast<ui::KeyboardCode>(key_code); ui::KeyboardCode code = static_cast<ui::KeyboardCode>(key_code);
ui::KeyEvent event(event_type, code, flags, false); if (code == ui::VKEY_UNKNOWN) {
event.set_character(key_value); // Handling of special printable characters (e.g. accented characters) for
event.set_unmodified_character(key_value); // which there is no key code.
if (event_type == ui::ET_KEY_RELEASED) {
if (code != ui::VKEY_UNKNOWN) { ui::InputMethod* input_method = root_window->GetProperty(
aura::client::kRootWindowInputMethodKey);
if (!input_method)
return false;
ui::TextInputClient* tic = input_method->GetTextInputClient();
SendProcessKeyEvent(ui::ET_KEY_PRESSED, root_window);
tic->InsertChar(static_cast<uint16>(key_value), ui::EF_NONE);
SendProcessKeyEvent(ui::ET_KEY_RELEASED, root_window);
}
} else {
ui::KeyEvent event(event_type, code, flags, false);
root_window->AsRootWindowHostDelegate()->OnHostKeyEvent(&event); root_window->AsRootWindowHostDelegate()->OnHostKeyEvent(&event);
} else if (event_type == ui::ET_KEY_RELEASED) {
// TODO(kevers): Fix key handling to support key_value when code is
// VKEY_UNKNOWN.
base::string16 text;
text.push_back(static_cast<char16>(key_value));
InsertText(text, root_window);
} }
return true; return true;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment