summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-19 20:27:07 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-19 20:27:07 +0000
commita8a1992ce36c243c05cd649558e6da6f6d61f3b6 (patch)
treec1534730f8ba522640756ffa4269075a1cf78ce6 /content
parent750c2e814d92771b254d39305fb8593fcf238585 (diff)
downloadchromium_src-a8a1992ce36c243c05cd649558e6da6f6d61f3b6.zip
chromium_src-a8a1992ce36c243c05cd649558e6da6f6d61f3b6.tar.gz
chromium_src-a8a1992ce36c243c05cd649558e6da6f6d61f3b6.tar.bz2
Get KeyEvents to limp in Aura. This assumes the desktop host is going to send two aura::KeyEvents for every keydown - one raw key down, and one char. They share the same ET, but the first has is_char = false, the second is_char = true.
http://crbug.com/99757 TEST=none Review URL: http://codereview.chromium.org/8342026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106374 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/renderer_host/web_input_event_aura.cc17
-rw-r--r--content/browser/renderer_host/web_input_event_aurax11.cc8
2 files changed, 21 insertions, 4 deletions
diff --git a/content/browser/renderer_host/web_input_event_aura.cc b/content/browser/renderer_host/web_input_event_aura.cc
index bbadb7c..a677b0c 100644
--- a/content/browser/renderer_host/web_input_event_aura.cc
+++ b/content/browser/renderer_host/web_input_event_aura.cc
@@ -8,11 +8,16 @@
namespace content {
+#if defined(OS_WIN)
WebKit::WebMouseEvent MakeUntranslatedWebMouseEventFromNativeEvent(
base::NativeEvent native_event);
-WebKit::WebMouseEvent MakeWebMouseEventFromAuraEvent(aura::MouseEvent* event);
WebKit::WebKeyboardEvent MakeWebKeyboardEventFromNativeEvent(
base::NativeEvent native_event);
+#else
+WebKit::WebMouseEvent MakeWebMouseEventFromAuraEvent(aura::MouseEvent* event);
+WebKit::WebKeyboardEvent MakeWebKeyboardEventFromAuraEvent(
+ aura::KeyEvent* event);
+#endif
// General approach:
//
@@ -59,8 +64,18 @@ WebKit::WebMouseEvent MakeWebMouseEvent(aura::MouseEvent* event) {
}
WebKit::WebKeyboardEvent MakeWebKeyboardEvent(aura::KeyEvent* event) {
+ // Windows can figure out whether or not to construct a RawKeyDown or a Char
+ // WebInputEvent based on the type of message carried in
+ // event->native_event(). X11 is not so fortunate, there is no separate
+ // translated event type, so DesktopHostLinux sends an extra KeyEvent with
+ // is_char() == true. We need to pass the aura::KeyEvent to the X11 function
+ // to detect this case so the right event type can be constructed.
+#if defined(OS_WIN)
// Key events require no translation by the aura system.
return MakeWebKeyboardEventFromNativeEvent(event->native_event());
+#else
+ return MakeWebKeyboardEventFromAuraEvent(event);
+#endif
}
} // namespace content
diff --git a/content/browser/renderer_host/web_input_event_aurax11.cc b/content/browser/renderer_host/web_input_event_aurax11.cc
index c361b2b..2b54343 100644
--- a/content/browser/renderer_host/web_input_event_aurax11.cc
+++ b/content/browser/renderer_host/web_input_event_aurax11.cc
@@ -251,8 +251,9 @@ WebKit::WebMouseEvent MakeWebMouseEventFromAuraEvent(aura::MouseEvent* event) {
return webkit_event;
}
-WebKit::WebKeyboardEvent MakeWebKeyboardEventFromNativeEvent(
- base::NativeEvent native_event) {
+WebKit::WebKeyboardEvent MakeWebKeyboardEventFromAuraEvent(
+ aura::KeyEvent* event) {
+ base::NativeEvent native_event = event->native_event();
WebKit::WebKeyboardEvent webkit_event;
XKeyEvent* native_key_event = &native_event->xkey;
@@ -262,7 +263,8 @@ WebKit::WebKeyboardEvent MakeWebKeyboardEventFromNativeEvent(
switch (native_event->type) {
case KeyPress:
- webkit_event.type = WebKit::WebInputEvent::RawKeyDown;
+ webkit_event.type = event->is_char() ? WebKit::WebInputEvent::Char :
+ WebKit::WebInputEvent::RawKeyDown;
break;
case KeyRelease:
webkit_event.type = WebKit::WebInputEvent::KeyUp;