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

Side by Side Diff: content/browser/renderer_host/input/web_input_event_builders_android.cc

Issue 1811553002: [Android] Synthetic composition event should have DomKey 'Unidentified' (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Filter synthetic key event by checking |android_key_event| not null Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/renderer_host/input/web_input_event_builders_android_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/input/web_input_event_builders_android.h " 5 #include "content/browser/renderer_host/input/web_input_event_builders_android.h "
6 6
7 #include <android/input.h> 7 #include <android/input.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "content/browser/renderer_host/input/web_input_event_util.h" 10 #include "content/browser/renderer_host/input/web_input_event_util.h"
(...skipping 27 matching lines...) Expand all
38 android_modifier |= AMETA_CAPS_LOCK_ON; 38 android_modifier |= AMETA_CAPS_LOCK_ON;
39 return android_modifier; 39 return android_modifier;
40 } 40 }
41 41
42 ui::DomKey GetDomKeyFromEvent( 42 ui::DomKey GetDomKeyFromEvent(
43 JNIEnv* env, 43 JNIEnv* env,
44 const base::android::JavaRef<jobject>& android_key_event, 44 const base::android::JavaRef<jobject>& android_key_event,
45 int keycode, 45 int keycode,
46 int modifiers, 46 int modifiers,
47 int unicode_character) { 47 int unicode_character) {
48 // Synthetic key event, not enough information to get DomKey.
49 if (android_key_event.is_null() && !unicode_character)
50 return ui::DomKey::UNIDENTIFIED;
chongz 2016/03/17 15:50:39 Sorry for the confusing logic... Will this look be
51
48 if (!unicode_character && env) { 52 if (!unicode_character && env) {
49 // According to spec |kAllowedModifiers| should be Shift and AltGr, however 53 // According to spec |kAllowedModifiers| should be Shift and AltGr, however
50 // Android doesn't have AltGr key and ImeAdapter::getModifiers won't pass it 54 // Android doesn't have AltGr key and ImeAdapter::getModifiers won't pass it
51 // either. 55 // either.
52 // According to discussion we want to honor CapsLock and possibly NumLock as 56 // According to discussion we want to honor CapsLock and possibly NumLock as
53 // well. https://github.com/w3c/uievents/issues/70 57 // well. https://github.com/w3c/uievents/issues/70
54 const int kAllowedModifiers = 58 const int kAllowedModifiers =
55 WebInputEvent::ShiftKey | WebInputEvent::CapsLockOn; 59 WebInputEvent::ShiftKey | WebInputEvent::CapsLockOn;
56 int fallback_modifiers = 60 int fallback_modifiers =
57 WebInputEventToAndroidModifier(modifiers & kAllowedModifiers); 61 WebInputEventToAndroidModifier(modifiers & kAllowedModifiers);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 result.type = type; 177 result.type = type;
174 result.x = x; 178 result.x = x;
175 result.y = y; 179 result.y = y;
176 result.timeStampSeconds = time_sec; 180 result.timeStampSeconds = time_sec;
177 result.sourceDevice = blink::WebGestureDeviceTouchscreen; 181 result.sourceDevice = blink::WebGestureDeviceTouchscreen;
178 182
179 return result; 183 return result;
180 } 184 }
181 185
182 } // namespace content 186 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/input/web_input_event_builders_android_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698