OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Portions based heavily on: | 5 // Portions based heavily on: |
6 // third_party/WebKit/Source/WebKit/chromium/public/gtk/WebInputEventFactory.cpp | 6 // third_party/WebKit/Source/WebKit/chromium/public/gtk/WebInputEventFactory.cpp |
7 // | 7 // |
8 /* | 8 /* |
9 * Copyright (C) 2006-2011 Google Inc. All rights reserved. | 9 * Copyright (C) 2006-2011 Google Inc. All rights reserved. |
10 * | 10 * |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 ResetClickCountState(); | 244 ResetClickCountState(); |
245 break; | 245 break; |
246 default: | 246 default: |
247 NOTIMPLEMENTED() << "Received unexpected event: " << event->type(); | 247 NOTIMPLEMENTED() << "Received unexpected event: " << event->type(); |
248 break; | 248 break; |
249 } | 249 } |
250 | 250 |
251 return webkit_event; | 251 return webkit_event; |
252 } | 252 } |
253 | 253 |
254 WebKit::WebKeyboardEvent MakeWebKeyboardEventFromNativeEvent( | 254 WebKit::WebKeyboardEvent MakeWebKeyboardEventFromAuraEvent( |
255 base::NativeEvent native_event) { | 255 aura::KeyEvent* event) { |
| 256 base::NativeEvent native_event = event->native_event(); |
256 WebKit::WebKeyboardEvent webkit_event; | 257 WebKit::WebKeyboardEvent webkit_event; |
257 XKeyEvent* native_key_event = &native_event->xkey; | 258 XKeyEvent* native_key_event = &native_event->xkey; |
258 | 259 |
259 webkit_event.timeStampSeconds = | 260 webkit_event.timeStampSeconds = |
260 XEventTimeToWebEventTime(native_key_event->time); | 261 XEventTimeToWebEventTime(native_key_event->time); |
261 webkit_event.modifiers = XStateToWebEventModifiers(native_key_event->state); | 262 webkit_event.modifiers = XStateToWebEventModifiers(native_key_event->state); |
262 | 263 |
263 switch (native_event->type) { | 264 switch (native_event->type) { |
264 case KeyPress: | 265 case KeyPress: |
265 webkit_event.type = WebKit::WebInputEvent::RawKeyDown; | 266 webkit_event.type = event->is_char() ? WebKit::WebInputEvent::Char : |
| 267 WebKit::WebInputEvent::RawKeyDown; |
266 break; | 268 break; |
267 case KeyRelease: | 269 case KeyRelease: |
268 webkit_event.type = WebKit::WebInputEvent::KeyUp; | 270 webkit_event.type = WebKit::WebInputEvent::KeyUp; |
269 break; | 271 break; |
270 default: | 272 default: |
271 NOTREACHED(); | 273 NOTREACHED(); |
272 } | 274 } |
273 | 275 |
274 if (webkit_event.modifiers & WebKit::WebInputEvent::AltKey) | 276 if (webkit_event.modifiers & WebKit::WebInputEvent::AltKey) |
275 webkit_event.isSystemKey = true; | 277 webkit_event.isSystemKey = true; |
(...skipping 18 matching lines...) Expand all Loading... |
294 } | 296 } |
295 | 297 |
296 webkit_event.setKeyIdentifierFromWindowsKeyCode(); | 298 webkit_event.setKeyIdentifierFromWindowsKeyCode(); |
297 | 299 |
298 // TODO: IsAutoRepeat/IsKeyPad? | 300 // TODO: IsAutoRepeat/IsKeyPad? |
299 | 301 |
300 return webkit_event; | 302 return webkit_event; |
301 } | 303 } |
302 | 304 |
303 } // namespace content | 305 } // namespace content |
OLD | NEW |