OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 newModifiers |= PlatformEvent::ShiftKey; | 95 newModifiers |= PlatformEvent::ShiftKey; |
96 if (webModifiers & WebInputEvent::ControlKey) | 96 if (webModifiers & WebInputEvent::ControlKey) |
97 newModifiers |= PlatformEvent::CtrlKey; | 97 newModifiers |= PlatformEvent::CtrlKey; |
98 if (webModifiers & WebInputEvent::AltKey) | 98 if (webModifiers & WebInputEvent::AltKey) |
99 newModifiers |= PlatformEvent::AltKey; | 99 newModifiers |= PlatformEvent::AltKey; |
100 if (webModifiers & WebInputEvent::MetaKey) | 100 if (webModifiers & WebInputEvent::MetaKey) |
101 newModifiers |= PlatformEvent::MetaKey; | 101 newModifiers |= PlatformEvent::MetaKey; |
102 return newModifiers; | 102 return newModifiers; |
103 } | 103 } |
104 | 104 |
| 105 static unsigned toPlatformKeyboardEventModifiers(int webModifiers) |
| 106 { |
| 107 unsigned newModifiers = toPlatformEventModifiers(webModifiers); |
| 108 if (webModifiers & WebInputEvent::IsKeyPad) |
| 109 newModifiers |= PlatformEvent::IsKeyPad; |
| 110 if (webModifiers & WebInputEvent::IsAutoRepeat) |
| 111 newModifiers |= PlatformEvent::IsAutoRepeat; |
| 112 return newModifiers; |
| 113 } |
| 114 |
105 unsigned toPlatformMouseEventModifiers(int webModifiers) | 115 unsigned toPlatformMouseEventModifiers(int webModifiers) |
106 { | 116 { |
107 unsigned newModifiers = toPlatformEventModifiers(webModifiers); | 117 unsigned newModifiers = toPlatformEventModifiers(webModifiers); |
108 if (webModifiers & WebInputEvent::LeftButtonDown) | 118 if (webModifiers & WebInputEvent::LeftButtonDown) |
109 newModifiers |= PlatformEvent::LeftButtonDown; | 119 newModifiers |= PlatformEvent::LeftButtonDown; |
110 if (webModifiers & WebInputEvent::MiddleButtonDown) | 120 if (webModifiers & WebInputEvent::MiddleButtonDown) |
111 newModifiers |= PlatformEvent::MiddleButtonDown; | 121 newModifiers |= PlatformEvent::MiddleButtonDown; |
112 if (webModifiers & WebInputEvent::RightButtonDown) | 122 if (webModifiers & WebInputEvent::RightButtonDown) |
113 newModifiers |= PlatformEvent::RightButtonDown; | 123 newModifiers |= PlatformEvent::RightButtonDown; |
114 return newModifiers; | 124 return newModifiers; |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 } | 306 } |
297 return PlatformEvent::KeyDown; | 307 return PlatformEvent::KeyDown; |
298 } | 308 } |
299 | 309 |
300 PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder(const WebKeyboardEven
t& e) | 310 PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder(const WebKeyboardEven
t& e) |
301 { | 311 { |
302 m_type = toPlatformKeyboardEventType(e.type); | 312 m_type = toPlatformKeyboardEventType(e.type); |
303 m_text = String(e.text); | 313 m_text = String(e.text); |
304 m_unmodifiedText = String(e.unmodifiedText); | 314 m_unmodifiedText = String(e.unmodifiedText); |
305 m_keyIdentifier = String(e.keyIdentifier); | 315 m_keyIdentifier = String(e.keyIdentifier); |
306 m_autoRepeat = (e.modifiers & WebInputEvent::IsAutoRepeat); | |
307 m_nativeVirtualKeyCode = e.nativeKeyCode; | 316 m_nativeVirtualKeyCode = e.nativeKeyCode; |
308 m_isKeypad = (e.modifiers & WebInputEvent::IsKeyPad); | |
309 m_isSystemKey = e.isSystemKey; | 317 m_isSystemKey = e.isSystemKey; |
310 // TODO: BUG482880 Fix this initialization to lazy initialization. | 318 // TODO: BUG482880 Fix this initialization to lazy initialization. |
311 m_code = Platform::current()->domCodeStringFromEnum(e.domCode); | 319 m_code = Platform::current()->domCodeStringFromEnum(e.domCode); |
312 m_key = Platform::current()->domKeyStringFromEnum(e.domKey); | 320 m_key = Platform::current()->domKeyStringFromEnum(e.domKey); |
313 | 321 |
314 m_modifiers = toPlatformEventModifiers(e.modifiers); | 322 m_modifiers = toPlatformKeyboardEventModifiers(e.modifiers); |
315 | 323 |
316 // FIXME: PlatformKeyboardEvents expect a locational version of the keycode
(e.g. VK_LSHIFT | 324 // FIXME: PlatformKeyboardEvents expect a locational version of the keycode
(e.g. VK_LSHIFT |
317 // instead of VK_SHIFT). This should be changed so the location/keycode are
stored separately, | 325 // instead of VK_SHIFT). This should be changed so the location/keycode are
stored separately, |
318 // as in other places in the code. | 326 // as in other places in the code. |
319 m_windowsVirtualKeyCode = e.windowsKeyCode; | 327 m_windowsVirtualKeyCode = e.windowsKeyCode; |
320 if (e.windowsKeyCode == VK_SHIFT) { | 328 if (e.windowsKeyCode == VK_SHIFT) { |
321 if (e.modifiers & WebInputEvent::IsLeft) | 329 if (e.modifiers & WebInputEvent::IsLeft) |
322 m_windowsVirtualKeyCode = VK_LSHIFT; | 330 m_windowsVirtualKeyCode = VK_LSHIFT; |
323 else if (e.modifiers & WebInputEvent::IsRight) | 331 else if (e.modifiers & WebInputEvent::IsRight) |
324 m_windowsVirtualKeyCode = VK_RSHIFT; | 332 m_windowsVirtualKeyCode = VK_RSHIFT; |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 modifiers = getWebInputModifiers(event); | 760 modifiers = getWebInputModifiers(event); |
753 | 761 |
754 globalX = event.screenX(); | 762 globalX = event.screenX(); |
755 globalY = event.screenY(); | 763 globalY = event.screenY(); |
756 IntPoint localPoint = convertAbsoluteLocationForLayoutObject(event.absoluteL
ocation(), *layoutObject); | 764 IntPoint localPoint = convertAbsoluteLocationForLayoutObject(event.absoluteL
ocation(), *layoutObject); |
757 x = localPoint.x(); | 765 x = localPoint.x(); |
758 y = localPoint.y(); | 766 y = localPoint.y(); |
759 } | 767 } |
760 | 768 |
761 } // namespace blink | 769 } // namespace blink |
OLD | NEW |