Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(793)

Unified Diff: Source/core/events/KeyboardEvent.cpp

Issue 797243003: [Events] Propagate IME composition event to JS on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/events/KeyboardEvent.cpp
diff --git a/Source/core/events/KeyboardEvent.cpp b/Source/core/events/KeyboardEvent.cpp
index ac7ae1f7ad51bd6b10b7387839bb4dd0d16d4968..98e70ab4f99523737fa576b7f267a2ed1dd2f89f 100644
--- a/Source/core/events/KeyboardEvent.cpp
+++ b/Source/core/events/KeyboardEvent.cpp
@@ -28,6 +28,14 @@
namespace blink {
+namespace {
+
+#if OS(ANDROID)
+int kInputMethodEditorCompositionKeyCode = 229;
bcwhite 2015/01/12 21:02:44 Is this constant available anywhere else already o
huangs 2015/01/12 23:25:57 Searched for 229 and 0xE5. Something close is ht
+#endif
+
+} // namespace
+
static inline const AtomicString& eventTypeForKeyboardEventType(PlatformEvent::Type type)
{
switch (type) {
@@ -163,6 +171,13 @@ int KeyboardEvent::keyCode() const
// We match IE.
if (!m_keyEvent)
return 0;
+
+#if OS(ANDROID)
bcwhite 2015/01/12 21:02:44 // TODO: Check if this applies to other OS
huangs 2015/01/12 23:25:57 Done (using FIXME instead).
+ // If the key event belongs to IME composition then propagate to JS.
+ if (m_keyEvent->nativeVirtualKeyCode() == kInputMethodEditorCompositionKeyCode)
+ return kInputMethodEditorCompositionKeyCode;
+#endif
+
if (type() == EventTypeNames::keydown || type() == EventTypeNames::keyup)
return windowsVirtualKeyCodeWithoutLocation(m_keyEvent->windowsVirtualKeyCode());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698