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

Unified Diff: content/browser/devtools/protocol/input_handler.cc

Issue 1148803002: Synthesize proper keyIdentifier for devtools protocol key events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Attempt to fix test flakiness. Created 5 years, 7 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 | « content/browser/devtools/protocol/devtools_protocol_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/devtools/protocol/input_handler.cc
diff --git a/content/browser/devtools/protocol/input_handler.cc b/content/browser/devtools/protocol/input_handler.cc
index 55a3c74346905f73131870d0f69a22a4c6d2f874..610b71cd3390c4d0cf403ba2afe5e3f1ae713c3b 100644
--- a/content/browser/devtools/protocol/input_handler.cc
+++ b/content/browser/devtools/protocol/input_handler.cc
@@ -177,6 +177,17 @@ Response InputHandler::DispatchKeyEvent(
if (!SetKeyboardEventText(event.unmodifiedText, unmodified_text))
return Response::InvalidParams("Invalid 'unmodifiedText' parameter");
+ if (windows_virtual_key_code)
+ event.windowsKeyCode = *windows_virtual_key_code;
+ if (native_virtual_key_code)
+ event.nativeKeyCode = *native_virtual_key_code;
+ if (auto_repeat && *auto_repeat)
+ event.modifiers |= blink::WebInputEvent::IsAutoRepeat;
+ if (is_keypad && *is_keypad)
+ event.modifiers |= blink::WebInputEvent::IsKeyPad;
+ if (is_system_key)
+ event.isSystemKey = *is_system_key;
+
if (key_identifier) {
if (key_identifier->size() >
blink::WebKeyboardEvent::keyIdentifierLengthCap) {
@@ -184,6 +195,8 @@ Response InputHandler::DispatchKeyEvent(
}
for (size_t i = 0; i < key_identifier->size(); ++i)
event.keyIdentifier[i] = (*key_identifier)[i];
+ } else if (event.type != blink::WebInputEvent::Char) {
+ event.setKeyIdentifierFromWindowsKeyCode();
}
if (code) {
@@ -191,17 +204,6 @@ Response InputHandler::DispatchKeyEvent(
ui::KeycodeConverter::CodeStringToDomCode(code->c_str()));
}
- if (windows_virtual_key_code)
- event.windowsKeyCode = *windows_virtual_key_code;
- if (native_virtual_key_code)
- event.nativeKeyCode = *native_virtual_key_code;
- if (auto_repeat && *auto_repeat)
- event.modifiers |= blink::WebInputEvent::IsAutoRepeat;
- if (is_keypad && *is_keypad)
- event.modifiers |= blink::WebInputEvent::IsKeyPad;
- if (is_system_key)
- event.isSystemKey = *is_system_key;
-
if (!host_)
return Response::ServerError("Could not connect to view");
« no previous file with comments | « content/browser/devtools/protocol/devtools_protocol_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698