| 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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 { | 312 { |
| 313 m_type = toPlatformKeyboardEventType(e.type); | 313 m_type = toPlatformKeyboardEventType(e.type); |
| 314 m_text = String(e.text); | 314 m_text = String(e.text); |
| 315 m_unmodifiedText = String(e.unmodifiedText); | 315 m_unmodifiedText = String(e.unmodifiedText); |
| 316 m_keyIdentifier = String(e.keyIdentifier); | 316 m_keyIdentifier = String(e.keyIdentifier); |
| 317 m_autoRepeat = (e.modifiers & WebInputEvent::IsAutoRepeat); | 317 m_autoRepeat = (e.modifiers & WebInputEvent::IsAutoRepeat); |
| 318 m_nativeVirtualKeyCode = e.nativeKeyCode; | 318 m_nativeVirtualKeyCode = e.nativeKeyCode; |
| 319 m_isKeypad = (e.modifiers & WebInputEvent::IsKeyPad); | 319 m_isKeypad = (e.modifiers & WebInputEvent::IsKeyPad); |
| 320 m_isSystemKey = e.isSystemKey; | 320 m_isSystemKey = e.isSystemKey; |
| 321 m_code = Platform::current()->domCodeStringFromEnum(e.domCode); | 321 m_code = Platform::current()->domCodeStringFromEnum(e.domCode); |
| 322 m_key = Platform::current()->domKeyStringFromEnum(e.domKey); |
| 322 | 323 |
| 323 m_modifiers = toPlatformEventModifiers(e.modifiers); | 324 m_modifiers = toPlatformEventModifiers(e.modifiers); |
| 324 | 325 |
| 325 // FIXME: PlatformKeyboardEvents expect a locational version of the keycode
(e.g. VK_LSHIFT | 326 // FIXME: PlatformKeyboardEvents expect a locational version of the keycode
(e.g. VK_LSHIFT |
| 326 // instead of VK_SHIFT). This should be changed so the location/keycode are
stored separately, | 327 // instead of VK_SHIFT). This should be changed so the location/keycode are
stored separately, |
| 327 // as in other places in the code. | 328 // as in other places in the code. |
| 328 m_windowsVirtualKeyCode = e.windowsKeyCode; | 329 m_windowsVirtualKeyCode = e.windowsKeyCode; |
| 329 if (e.windowsKeyCode == VK_SHIFT) { | 330 if (e.windowsKeyCode == VK_SHIFT) { |
| 330 if (e.modifiers & WebInputEvent::IsLeft) | 331 if (e.modifiers & WebInputEvent::IsLeft) |
| 331 m_windowsVirtualKeyCode = VK_LSHIFT; | 332 m_windowsVirtualKeyCode = VK_LSHIFT; |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 | 671 |
| 671 timeStampSeconds = event.timeStamp() / millisPerSecond; | 672 timeStampSeconds = event.timeStamp() / millisPerSecond; |
| 672 windowsKeyCode = event.keyCode(); | 673 windowsKeyCode = event.keyCode(); |
| 673 | 674 |
| 674 // The platform keyevent does not exist if the event was created using | 675 // The platform keyevent does not exist if the event was created using |
| 675 // initKeyboardEvent. | 676 // initKeyboardEvent. |
| 676 if (!event.keyEvent()) | 677 if (!event.keyEvent()) |
| 677 return; | 678 return; |
| 678 nativeKeyCode = event.keyEvent()->nativeVirtualKeyCode(); | 679 nativeKeyCode = event.keyEvent()->nativeVirtualKeyCode(); |
| 679 domCode = Platform::current()->domEnumFromCodeString(event.keyEvent()->code(
)); | 680 domCode = Platform::current()->domEnumFromCodeString(event.keyEvent()->code(
)); |
| 681 domKey = Platform::current()->domEnumFromKeyString(event.keyEvent()->key()); |
| 680 unsigned numberOfCharacters = std::min(event.keyEvent()->text().length(), st
atic_cast<unsigned>(textLengthCap)); | 682 unsigned numberOfCharacters = std::min(event.keyEvent()->text().length(), st
atic_cast<unsigned>(textLengthCap)); |
| 681 for (unsigned i = 0; i < numberOfCharacters; ++i) { | 683 for (unsigned i = 0; i < numberOfCharacters; ++i) { |
| 682 text[i] = event.keyEvent()->text()[i]; | 684 text[i] = event.keyEvent()->text()[i]; |
| 683 unmodifiedText[i] = event.keyEvent()->unmodifiedText()[i]; | 685 unmodifiedText[i] = event.keyEvent()->unmodifiedText()[i]; |
| 684 } | 686 } |
| 685 memcpy(keyIdentifier, event.keyIdentifier().ascii().data(), event.keyIdentif
ier().length()); | 687 memcpy(keyIdentifier, event.keyIdentifier().ascii().data(), event.keyIdentif
ier().length()); |
| 686 } | 688 } |
| 687 | 689 |
| 688 WebInputEvent::Type toWebKeyboardEventType(PlatformEvent::Type type) | 690 WebInputEvent::Type toWebKeyboardEventType(PlatformEvent::Type type) |
| 689 { | 691 { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 705 { | 707 { |
| 706 type = toWebKeyboardEventType(event.type()); | 708 type = toWebKeyboardEventType(event.type()); |
| 707 modifiers = toWebEventModifiers(event.modifiers()); | 709 modifiers = toWebEventModifiers(event.modifiers()); |
| 708 if (event.isAutoRepeat()) | 710 if (event.isAutoRepeat()) |
| 709 modifiers |= WebInputEvent::IsAutoRepeat; | 711 modifiers |= WebInputEvent::IsAutoRepeat; |
| 710 if (event.isKeypad()) | 712 if (event.isKeypad()) |
| 711 modifiers |= WebInputEvent::IsKeyPad; | 713 modifiers |= WebInputEvent::IsKeyPad; |
| 712 isSystemKey = event.isSystemKey(); | 714 isSystemKey = event.isSystemKey(); |
| 713 nativeKeyCode = event.nativeVirtualKeyCode(); | 715 nativeKeyCode = event.nativeVirtualKeyCode(); |
| 714 domCode = Platform::current()->domEnumFromCodeString(event.code()); | 716 domCode = Platform::current()->domEnumFromCodeString(event.code()); |
| 717 domKey = Platform::current()->domEnumFromKeyString(event.key()); |
| 715 | 718 |
| 716 windowsKeyCode = windowsKeyCodeWithoutLocation(event.windowsVirtualKeyCode()
); | 719 windowsKeyCode = windowsKeyCodeWithoutLocation(event.windowsVirtualKeyCode()
); |
| 717 modifiers |= locationModifiersFromWindowsKeyCode(event.windowsVirtualKeyCode
()); | 720 modifiers |= locationModifiersFromWindowsKeyCode(event.windowsVirtualKeyCode
()); |
| 718 | 721 |
| 719 event.text().copyTo(text, 0, textLengthCap); | 722 event.text().copyTo(text, 0, textLengthCap); |
| 720 event.unmodifiedText().copyTo(unmodifiedText, 0, textLengthCap); | 723 event.unmodifiedText().copyTo(unmodifiedText, 0, textLengthCap); |
| 721 memcpy(keyIdentifier, event.keyIdentifier().ascii().data(), std::min(static_
cast<unsigned>(keyIdentifierLengthCap), event.keyIdentifier().length())); | 724 memcpy(keyIdentifier, event.keyIdentifier().ascii().data(), std::min(static_
cast<unsigned>(keyIdentifierLengthCap), event.keyIdentifier().length())); |
| 722 } | 725 } |
| 723 | 726 |
| 724 static WebTouchPoint toWebTouchPoint(const Touch* touch, const LayoutObject* lay
outObject, WebTouchPoint::State state) | 727 static WebTouchPoint toWebTouchPoint(const Touch* touch, const LayoutObject* lay
outObject, WebTouchPoint::State state) |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 808 modifiers = getWebInputModifiers(event); | 811 modifiers = getWebInputModifiers(event); |
| 809 | 812 |
| 810 globalX = event.screenX(); | 813 globalX = event.screenX(); |
| 811 globalY = event.screenY(); | 814 globalY = event.screenY(); |
| 812 IntPoint localPoint = convertAbsoluteLocationForLayoutObject(event.absoluteL
ocation(), *layoutObject); | 815 IntPoint localPoint = convertAbsoluteLocationForLayoutObject(event.absoluteL
ocation(), *layoutObject); |
| 813 x = localPoint.x(); | 816 x = localPoint.x(); |
| 814 y = localPoint.y(); | 817 y = localPoint.y(); |
| 815 } | 818 } |
| 816 | 819 |
| 817 } // namespace blink | 820 } // namespace blink |
| OLD | NEW |