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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
299 PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder(const WebKeyboardEven t& e) | 299 PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder(const WebKeyboardEven t& e) |
300 { | 300 { |
301 m_type = toPlatformKeyboardEventType(e.type); | 301 m_type = toPlatformKeyboardEventType(e.type); |
302 m_text = String(e.text); | 302 m_text = String(e.text); |
303 m_unmodifiedText = String(e.unmodifiedText); | 303 m_unmodifiedText = String(e.unmodifiedText); |
304 m_keyIdentifier = String(e.keyIdentifier); | 304 m_keyIdentifier = String(e.keyIdentifier); |
305 m_autoRepeat = (e.modifiers & WebInputEvent::IsAutoRepeat); | 305 m_autoRepeat = (e.modifiers & WebInputEvent::IsAutoRepeat); |
306 m_nativeVirtualKeyCode = e.nativeKeyCode; | 306 m_nativeVirtualKeyCode = e.nativeKeyCode; |
307 m_isKeypad = (e.modifiers & WebInputEvent::IsKeyPad); | 307 m_isKeypad = (e.modifiers & WebInputEvent::IsKeyPad); |
308 m_isSystemKey = e.isSystemKey; | 308 m_isSystemKey = e.isSystemKey; |
309 // TODO: BUG482880 Fix this initialization to lazy initialization. | |
Wez
2015/05/06 01:32:13
Do you mean "Fix |code| and |key| to be lazily-int
| |
309 m_code = Platform::current()->domCodeStringFromEnum(e.domCode); | 310 m_code = Platform::current()->domCodeStringFromEnum(e.domCode); |
311 m_key = Platform::current()->domKeyStringFromEnum(e.domKey); | |
310 | 312 |
311 m_modifiers = toPlatformEventModifiers(e.modifiers); | 313 m_modifiers = toPlatformEventModifiers(e.modifiers); |
312 | 314 |
313 // FIXME: PlatformKeyboardEvents expect a locational version of the keycode (e.g. VK_LSHIFT | 315 // FIXME: PlatformKeyboardEvents expect a locational version of the keycode (e.g. VK_LSHIFT |
314 // instead of VK_SHIFT). This should be changed so the location/keycode are stored separately, | 316 // instead of VK_SHIFT). This should be changed so the location/keycode are stored separately, |
315 // as in other places in the code. | 317 // as in other places in the code. |
316 m_windowsVirtualKeyCode = e.windowsKeyCode; | 318 m_windowsVirtualKeyCode = e.windowsKeyCode; |
317 if (e.windowsKeyCode == VK_SHIFT) { | 319 if (e.windowsKeyCode == VK_SHIFT) { |
318 if (e.modifiers & WebInputEvent::IsLeft) | 320 if (e.modifiers & WebInputEvent::IsLeft) |
319 m_windowsVirtualKeyCode = VK_LSHIFT; | 321 m_windowsVirtualKeyCode = VK_LSHIFT; |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
620 | 622 |
621 timeStampSeconds = event.timeStamp() / millisPerSecond; | 623 timeStampSeconds = event.timeStamp() / millisPerSecond; |
622 windowsKeyCode = event.keyCode(); | 624 windowsKeyCode = event.keyCode(); |
623 | 625 |
624 // The platform keyevent does not exist if the event was created using | 626 // The platform keyevent does not exist if the event was created using |
625 // initKeyboardEvent. | 627 // initKeyboardEvent. |
626 if (!event.keyEvent()) | 628 if (!event.keyEvent()) |
627 return; | 629 return; |
628 nativeKeyCode = event.keyEvent()->nativeVirtualKeyCode(); | 630 nativeKeyCode = event.keyEvent()->nativeVirtualKeyCode(); |
629 domCode = Platform::current()->domEnumFromCodeString(event.keyEvent()->code( )); | 631 domCode = Platform::current()->domEnumFromCodeString(event.keyEvent()->code( )); |
632 domKey = Platform::current()->domKeyEnumFromString(event.keyEvent()->key()); | |
630 unsigned numberOfCharacters = std::min(event.keyEvent()->text().length(), st atic_cast<unsigned>(textLengthCap)); | 633 unsigned numberOfCharacters = std::min(event.keyEvent()->text().length(), st atic_cast<unsigned>(textLengthCap)); |
631 for (unsigned i = 0; i < numberOfCharacters; ++i) { | 634 for (unsigned i = 0; i < numberOfCharacters; ++i) { |
632 text[i] = event.keyEvent()->text()[i]; | 635 text[i] = event.keyEvent()->text()[i]; |
633 unmodifiedText[i] = event.keyEvent()->unmodifiedText()[i]; | 636 unmodifiedText[i] = event.keyEvent()->unmodifiedText()[i]; |
634 } | 637 } |
635 memcpy(keyIdentifier, event.keyIdentifier().ascii().data(), event.keyIdentif ier().length()); | 638 memcpy(keyIdentifier, event.keyIdentifier().ascii().data(), event.keyIdentif ier().length()); |
636 } | 639 } |
637 | 640 |
638 WebInputEvent::Type toWebKeyboardEventType(PlatformEvent::Type type) | 641 WebInputEvent::Type toWebKeyboardEventType(PlatformEvent::Type type) |
639 { | 642 { |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
741 modifiers = getWebInputModifiers(event); | 744 modifiers = getWebInputModifiers(event); |
742 | 745 |
743 globalX = event.screenX(); | 746 globalX = event.screenX(); |
744 globalY = event.screenY(); | 747 globalY = event.screenY(); |
745 IntPoint localPoint = convertAbsoluteLocationForLayoutObject(event.absoluteL ocation(), *layoutObject); | 748 IntPoint localPoint = convertAbsoluteLocationForLayoutObject(event.absoluteL ocation(), *layoutObject); |
746 x = localPoint.x(); | 749 x = localPoint.x(); |
747 y = localPoint.y(); | 750 y = localPoint.y(); |
748 } | 751 } |
749 | 752 |
750 } // namespace blink | 753 } // namespace blink |
OLD | NEW |