OLD | NEW |
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_win.h" | 5 #include "content/browser/renderer_host/input/web_input_event_builders_win.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "content/browser/renderer_host/input/web_input_event_util.h" | 8 #include "content/browser/renderer_host/input/web_input_event_util.h" |
9 #include "ui/display/win/screen_win.h" | 9 #include "ui/display/win/screen_win.h" |
10 #include "ui/events/blink/blink_event_util.h" | 10 #include "ui/events/blink/blink_event_util.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 break; | 55 break; |
56 default: | 56 default: |
57 NOTREACHED(); | 57 NOTREACHED(); |
58 } | 58 } |
59 | 59 |
60 if (result.type == WebInputEvent::Char | 60 if (result.type == WebInputEvent::Char |
61 || result.type == WebInputEvent::RawKeyDown) { | 61 || result.type == WebInputEvent::RawKeyDown) { |
62 result.text[0] = result.windowsKeyCode; | 62 result.text[0] = result.windowsKeyCode; |
63 result.unmodifiedText[0] = result.windowsKeyCode; | 63 result.unmodifiedText[0] = result.windowsKeyCode; |
64 } | 64 } |
65 result.setKeyIdentifierFromWindowsKeyCode(); | |
66 | |
67 result.modifiers = | 65 result.modifiers = |
68 ui::EventFlagsToWebEventModifiers(ui::GetModifiersFromKeyState()); | 66 ui::EventFlagsToWebEventModifiers(ui::GetModifiersFromKeyState()); |
69 // NOTE: There doesn't seem to be a way to query the mouse button state in | 67 // NOTE: There doesn't seem to be a way to query the mouse button state in |
70 // this case. | 68 // this case. |
71 | 69 |
72 // Bit 30 of lParam represents the "previous key state". If set, the key was | 70 // Bit 30 of lParam represents the "previous key state". If set, the key was |
73 // already down, therefore this is an auto-repeat. Only apply this to key | 71 // already down, therefore this is an auto-repeat. Only apply this to key |
74 // down events, to match DOM semantics. | 72 // down events, to match DOM semantics. |
75 if ((result.type == WebInputEvent::RawKeyDown) && (lparam & 0x40000000)) | 73 if ((result.type == WebInputEvent::RawKeyDown) && (lparam & 0x40000000)) |
76 result.modifiers |= WebInputEvent::IsAutoRepeat; | 74 result.modifiers |= WebInputEvent::IsAutoRepeat; |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 result.wheelTicksX = wheel_delta; | 367 result.wheelTicksX = wheel_delta; |
370 } else { | 368 } else { |
371 result.deltaY = scroll_delta; | 369 result.deltaY = scroll_delta; |
372 result.wheelTicksY = wheel_delta; | 370 result.wheelTicksY = wheel_delta; |
373 } | 371 } |
374 | 372 |
375 return result; | 373 return result; |
376 } | 374 } |
377 | 375 |
378 } // namespace content | 376 } // namespace content |
OLD | NEW |