| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 return newModifiers; | 102 return newModifiers; |
| 103 } | 103 } |
| 104 | 104 |
| 105 static unsigned toPlatformKeyboardEventModifiers(int webModifiers) | 105 static unsigned toPlatformKeyboardEventModifiers(int webModifiers) |
| 106 { | 106 { |
| 107 unsigned newModifiers = toPlatformEventModifiers(webModifiers); | 107 unsigned newModifiers = toPlatformEventModifiers(webModifiers); |
| 108 if (webModifiers & WebInputEvent::IsKeyPad) | 108 if (webModifiers & WebInputEvent::IsKeyPad) |
| 109 newModifiers |= PlatformEvent::IsKeyPad; | 109 newModifiers |= PlatformEvent::IsKeyPad; |
| 110 if (webModifiers & WebInputEvent::IsAutoRepeat) | 110 if (webModifiers & WebInputEvent::IsAutoRepeat) |
| 111 newModifiers |= PlatformEvent::IsAutoRepeat; | 111 newModifiers |= PlatformEvent::IsAutoRepeat; |
| 112 if (webModifiers & WebInputEvent::IsLeft) |
| 113 newModifiers |= PlatformEvent::IsLeft; |
| 114 if (webModifiers & WebInputEvent::IsRight) |
| 115 newModifiers |= PlatformEvent::IsRight; |
| 112 return newModifiers; | 116 return newModifiers; |
| 113 } | 117 } |
| 114 | 118 |
| 115 unsigned toPlatformMouseEventModifiers(int webModifiers) | 119 unsigned toPlatformMouseEventModifiers(int webModifiers) |
| 116 { | 120 { |
| 117 unsigned newModifiers = toPlatformEventModifiers(webModifiers); | 121 unsigned newModifiers = toPlatformEventModifiers(webModifiers); |
| 118 if (webModifiers & WebInputEvent::LeftButtonDown) | 122 if (webModifiers & WebInputEvent::LeftButtonDown) |
| 119 newModifiers |= PlatformEvent::LeftButtonDown; | 123 newModifiers |= PlatformEvent::LeftButtonDown; |
| 120 if (webModifiers & WebInputEvent::MiddleButtonDown) | 124 if (webModifiers & WebInputEvent::MiddleButtonDown) |
| 121 newModifiers |= PlatformEvent::MiddleButtonDown; | 125 newModifiers |= PlatformEvent::MiddleButtonDown; |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 m_text = String(e.text); | 323 m_text = String(e.text); |
| 320 m_unmodifiedText = String(e.unmodifiedText); | 324 m_unmodifiedText = String(e.unmodifiedText); |
| 321 m_keyIdentifier = String(e.keyIdentifier); | 325 m_keyIdentifier = String(e.keyIdentifier); |
| 322 m_nativeVirtualKeyCode = e.nativeKeyCode; | 326 m_nativeVirtualKeyCode = e.nativeKeyCode; |
| 323 m_isSystemKey = e.isSystemKey; | 327 m_isSystemKey = e.isSystemKey; |
| 324 // TODO: BUG482880 Fix this initialization to lazy initialization. | 328 // TODO: BUG482880 Fix this initialization to lazy initialization. |
| 325 m_code = Platform::current()->domCodeStringFromEnum(e.domCode); | 329 m_code = Platform::current()->domCodeStringFromEnum(e.domCode); |
| 326 m_key = Platform::current()->domKeyStringFromEnum(e.domKey); | 330 m_key = Platform::current()->domKeyStringFromEnum(e.domKey); |
| 327 | 331 |
| 328 m_modifiers = toPlatformKeyboardEventModifiers(e.modifiers); | 332 m_modifiers = toPlatformKeyboardEventModifiers(e.modifiers); |
| 329 | |
| 330 // FIXME: PlatformKeyboardEvents expect a locational version of the keycode
(e.g. VK_LSHIFT | |
| 331 // instead of VK_SHIFT). This should be changed so the location/keycode are
stored separately, | |
| 332 // as in other places in the code. | |
| 333 m_windowsVirtualKeyCode = e.windowsKeyCode; | 333 m_windowsVirtualKeyCode = e.windowsKeyCode; |
| 334 if (e.windowsKeyCode == VK_SHIFT) { | |
| 335 if (e.modifiers & WebInputEvent::IsLeft) | |
| 336 m_windowsVirtualKeyCode = VK_LSHIFT; | |
| 337 else if (e.modifiers & WebInputEvent::IsRight) | |
| 338 m_windowsVirtualKeyCode = VK_RSHIFT; | |
| 339 } else if (e.windowsKeyCode == VK_CONTROL) { | |
| 340 if (e.modifiers & WebInputEvent::IsLeft) | |
| 341 m_windowsVirtualKeyCode = VK_LCONTROL; | |
| 342 else if (e.modifiers & WebInputEvent::IsRight) | |
| 343 m_windowsVirtualKeyCode = VK_RCONTROL; | |
| 344 } else if (e.windowsKeyCode == VK_MENU) { | |
| 345 if (e.modifiers & WebInputEvent::IsLeft) | |
| 346 m_windowsVirtualKeyCode = VK_LMENU; | |
| 347 else if (e.modifiers & WebInputEvent::IsRight) | |
| 348 m_windowsVirtualKeyCode = VK_RMENU; | |
| 349 } | |
| 350 | |
| 351 } | 334 } |
| 352 | 335 |
| 353 void PlatformKeyboardEventBuilder::setKeyType(Type type) | 336 void PlatformKeyboardEventBuilder::setKeyType(Type type) |
| 354 { | 337 { |
| 355 // According to the behavior of Webkit in Windows platform, | 338 // According to the behavior of Webkit in Windows platform, |
| 356 // we need to convert KeyDown to RawKeydown and Char events | 339 // we need to convert KeyDown to RawKeydown and Char events |
| 357 // See WebKit/WebKit/Win/WebView.cpp | 340 // See WebKit/WebKit/Win/WebView.cpp |
| 358 ASSERT(m_type == KeyDown); | 341 ASSERT(m_type == KeyDown); |
| 359 ASSERT(type == RawKeyDown || type == Char); | 342 ASSERT(type == RawKeyDown || type == Char); |
| 360 m_type = type; | 343 m_type = type; |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 modifiers = getWebInputModifiers(event); | 758 modifiers = getWebInputModifiers(event); |
| 776 | 759 |
| 777 globalX = event.screenX(); | 760 globalX = event.screenX(); |
| 778 globalY = event.screenY(); | 761 globalY = event.screenY(); |
| 779 IntPoint localPoint = convertAbsoluteLocationForLayoutObject(event.absoluteL
ocation(), *layoutObject); | 762 IntPoint localPoint = convertAbsoluteLocationForLayoutObject(event.absoluteL
ocation(), *layoutObject); |
| 780 x = localPoint.x(); | 763 x = localPoint.x(); |
| 781 y = localPoint.y(); | 764 y = localPoint.y(); |
| 782 } | 765 } |
| 783 | 766 |
| 784 } // namespace blink | 767 } // namespace blink |
| OLD | NEW |