OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/web_input_event_aura.h" | 5 #include "content/browser/renderer_host/web_input_event_aura.h" |
6 | 6 |
7 #include "content/browser/renderer_host/input/web_input_event_util.h" | 7 #include "content/browser/renderer_host/input/web_input_event_util.h" |
8 #include "content/browser/renderer_host/ui_events_helper.h" | 8 #include "content/browser/renderer_host/ui_events_helper.h" |
9 #include "ui/aura/client/screen_position_client.h" | 9 #include "ui/aura/client/screen_position_client.h" |
10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
11 #include "ui/events/blink/blink_event_util.h" | 11 #include "ui/events/blink/blink_event_util.h" |
12 #include "ui/events/event.h" | 12 #include "ui/events/event.h" |
13 #include "ui/events/event_utils.h" | 13 #include "ui/events/event_utils.h" |
14 #include "ui/events/keycodes/dom/keycode_converter.h" | 14 #include "ui/events/keycodes/dom/keycode_converter.h" |
| 15 #include "ui/events/keycodes/keyboard_code_conversion.h" |
15 | 16 |
16 namespace content { | 17 namespace content { |
17 | 18 |
18 namespace { | 19 namespace { |
19 | 20 |
20 gfx::Point GetScreenLocationFromEvent(const ui::LocatedEvent& event) { | 21 gfx::Point GetScreenLocationFromEvent(const ui::LocatedEvent& event) { |
21 if (!event.target()) | 22 if (!event.target()) |
22 return event.root_location(); | 23 return event.root_location(); |
23 | 24 |
24 aura::Window* root = | 25 aura::Window* root = |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 case ui::ET_KEY_RELEASED: | 79 case ui::ET_KEY_RELEASED: |
79 webkit_event.type = blink::WebInputEvent::KeyUp; | 80 webkit_event.type = blink::WebInputEvent::KeyUp; |
80 break; | 81 break; |
81 default: | 82 default: |
82 NOTREACHED(); | 83 NOTREACHED(); |
83 } | 84 } |
84 | 85 |
85 if (webkit_event.modifiers & blink::WebInputEvent::AltKey) | 86 if (webkit_event.modifiers & blink::WebInputEvent::AltKey) |
86 webkit_event.isSystemKey = true; | 87 webkit_event.isSystemKey = true; |
87 | 88 |
88 webkit_event.windowsKeyCode = event.key_code(); | 89 // TODO(dtapuska): crbug.com/570388. Ozone appears to deliver |
| 90 // key_code events that aren't "located" for the keypad like |
| 91 // Windows and X11 do and blink expects. |
| 92 webkit_event.windowsKeyCode = |
| 93 ui::NonLocatedToLocatedKeypadKeyboardCode(event.key_code(), event.code()); |
89 webkit_event.nativeKeyCode = | 94 webkit_event.nativeKeyCode = |
90 ui::KeycodeConverter::DomCodeToNativeKeycode(event.code()); | 95 ui::KeycodeConverter::DomCodeToNativeKeycode(event.code()); |
91 webkit_event.domCode = static_cast<int>(event.code()); | 96 webkit_event.domCode = static_cast<int>(event.code()); |
92 webkit_event.domKey = static_cast<int>(event.GetDomKey()); | 97 webkit_event.domKey = static_cast<int>(event.GetDomKey()); |
93 webkit_event.unmodifiedText[0] = event.GetUnmodifiedText(); | 98 webkit_event.unmodifiedText[0] = event.GetUnmodifiedText(); |
94 webkit_event.text[0] = event.GetText(); | 99 webkit_event.text[0] = event.GetText(); |
95 | 100 |
96 webkit_event.setKeyIdentifierFromWindowsKeyCode(); | 101 webkit_event.setKeyIdentifierFromWindowsKeyCode(); |
97 | 102 |
98 return webkit_event; | 103 return webkit_event; |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 webkit_event.tiltX = roundf(event.pointer_details().tilt_x()); | 419 webkit_event.tiltX = roundf(event.pointer_details().tilt_x()); |
415 webkit_event.tiltY = roundf(event.pointer_details().tilt_y()); | 420 webkit_event.tiltY = roundf(event.pointer_details().tilt_y()); |
416 webkit_event.force = event.pointer_details().force(); | 421 webkit_event.force = event.pointer_details().force(); |
417 webkit_event.pointerType = | 422 webkit_event.pointerType = |
418 EventPointerTypeToWebPointerType(event.pointer_details().pointer_type()); | 423 EventPointerTypeToWebPointerType(event.pointer_details().pointer_type()); |
419 | 424 |
420 return webkit_event; | 425 return webkit_event; |
421 } | 426 } |
422 | 427 |
423 } // namespace content | 428 } // namespace content |
OLD | NEW |