| 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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 } | 296 } |
| 297 | 297 |
| 298 PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder(const WebKeyboardEven
t& e) | 298 PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder(const WebKeyboardEven
t& e) |
| 299 { | 299 { |
| 300 m_type = toPlatformKeyboardEventType(e.type); | 300 m_type = toPlatformKeyboardEventType(e.type); |
| 301 m_text = String(e.text); | 301 m_text = String(e.text); |
| 302 m_unmodifiedText = String(e.unmodifiedText); | 302 m_unmodifiedText = String(e.unmodifiedText); |
| 303 m_keyIdentifier = String(e.keyIdentifier); | 303 m_keyIdentifier = String(e.keyIdentifier); |
| 304 m_autoRepeat = (e.modifiers & WebInputEvent::IsAutoRepeat); | 304 m_autoRepeat = (e.modifiers & WebInputEvent::IsAutoRepeat); |
| 305 m_nativeVirtualKeyCode = e.nativeKeyCode; | 305 m_nativeVirtualKeyCode = e.nativeKeyCode; |
| 306 m_usbCode = e.usbCode; |
| 306 m_isKeypad = (e.modifiers & WebInputEvent::IsKeyPad); | 307 m_isKeypad = (e.modifiers & WebInputEvent::IsKeyPad); |
| 307 m_isSystemKey = e.isSystemKey; | 308 m_isSystemKey = e.isSystemKey; |
| 308 | 309 |
| 309 m_modifiers = 0; | 310 m_modifiers = 0; |
| 310 if (e.modifiers & WebInputEvent::ShiftKey) | 311 if (e.modifiers & WebInputEvent::ShiftKey) |
| 311 m_modifiers |= PlatformEvent::ShiftKey; | 312 m_modifiers |= PlatformEvent::ShiftKey; |
| 312 if (e.modifiers & WebInputEvent::ControlKey) | 313 if (e.modifiers & WebInputEvent::ControlKey) |
| 313 m_modifiers |= PlatformEvent::CtrlKey; | 314 m_modifiers |= PlatformEvent::CtrlKey; |
| 314 if (e.modifiers & WebInputEvent::AltKey) | 315 if (e.modifiers & WebInputEvent::AltKey) |
| 315 m_modifiers |= PlatformEvent::AltKey; | 316 m_modifiers |= PlatformEvent::AltKey; |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 modifiers |= WebInputEvent::IsRight; | 679 modifiers |= WebInputEvent::IsRight; |
| 679 | 680 |
| 680 timeStampSeconds = event.timeStamp() / millisPerSecond; | 681 timeStampSeconds = event.timeStamp() / millisPerSecond; |
| 681 windowsKeyCode = event.keyCode(); | 682 windowsKeyCode = event.keyCode(); |
| 682 | 683 |
| 683 // The platform keyevent does not exist if the event was created using | 684 // The platform keyevent does not exist if the event was created using |
| 684 // initKeyboardEvent. | 685 // initKeyboardEvent. |
| 685 if (!event.keyEvent()) | 686 if (!event.keyEvent()) |
| 686 return; | 687 return; |
| 687 nativeKeyCode = event.keyEvent()->nativeVirtualKeyCode(); | 688 nativeKeyCode = event.keyEvent()->nativeVirtualKeyCode(); |
| 689 usbCode = event.keyEvent()->usbKeyCode(); |
| 690 |
| 688 unsigned numberOfCharacters = std::min(event.keyEvent()->text().length(), st
atic_cast<unsigned>(textLengthCap)); | 691 unsigned numberOfCharacters = std::min(event.keyEvent()->text().length(), st
atic_cast<unsigned>(textLengthCap)); |
| 689 for (unsigned i = 0; i < numberOfCharacters; ++i) { | 692 for (unsigned i = 0; i < numberOfCharacters; ++i) { |
| 690 text[i] = event.keyEvent()->text()[i]; | 693 text[i] = event.keyEvent()->text()[i]; |
| 691 unmodifiedText[i] = event.keyEvent()->unmodifiedText()[i]; | 694 unmodifiedText[i] = event.keyEvent()->unmodifiedText()[i]; |
| 692 } | 695 } |
| 693 memcpy(keyIdentifier, event.keyIdentifier().ascii().data(), event.keyIdentif
ier().length()); | 696 memcpy(keyIdentifier, event.keyIdentifier().ascii().data(), event.keyIdentif
ier().length()); |
| 694 } | 697 } |
| 695 | 698 |
| 696 WebInputEvent::Type toWebKeyboardEventType(PlatformEvent::Type type) | 699 WebInputEvent::Type toWebKeyboardEventType(PlatformEvent::Type type) |
| 697 { | 700 { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 726 WebKeyboardEventBuilder::WebKeyboardEventBuilder(const PlatformKeyboardEvent& ev
ent) | 729 WebKeyboardEventBuilder::WebKeyboardEventBuilder(const PlatformKeyboardEvent& ev
ent) |
| 727 { | 730 { |
| 728 type = toWebKeyboardEventType(event.type()); | 731 type = toWebKeyboardEventType(event.type()); |
| 729 modifiers = toWebKeyboardEventModifiers(event.modifiers()); | 732 modifiers = toWebKeyboardEventModifiers(event.modifiers()); |
| 730 if (event.isAutoRepeat()) | 733 if (event.isAutoRepeat()) |
| 731 modifiers |= WebInputEvent::IsAutoRepeat; | 734 modifiers |= WebInputEvent::IsAutoRepeat; |
| 732 if (event.isKeypad()) | 735 if (event.isKeypad()) |
| 733 modifiers |= WebInputEvent::IsKeyPad; | 736 modifiers |= WebInputEvent::IsKeyPad; |
| 734 isSystemKey = event.isSystemKey(); | 737 isSystemKey = event.isSystemKey(); |
| 735 nativeKeyCode = event.nativeVirtualKeyCode(); | 738 nativeKeyCode = event.nativeVirtualKeyCode(); |
| 739 usbCode = event.usbKeyCode(); |
| 736 | 740 |
| 737 windowsKeyCode = windowsKeyCodeWithoutLocation(event.windowsVirtualKeyCode()
); | 741 windowsKeyCode = windowsKeyCodeWithoutLocation(event.windowsVirtualKeyCode()
); |
| 738 modifiers |= locationModifiersFromWindowsKeyCode(event.windowsVirtualKeyCode
()); | 742 modifiers |= locationModifiersFromWindowsKeyCode(event.windowsVirtualKeyCode
()); |
| 739 | 743 |
| 740 event.text().copyTo(text, 0, textLengthCap); | 744 event.text().copyTo(text, 0, textLengthCap); |
| 741 event.unmodifiedText().copyTo(unmodifiedText, 0, textLengthCap); | 745 event.unmodifiedText().copyTo(unmodifiedText, 0, textLengthCap); |
| 742 memcpy(keyIdentifier, event.keyIdentifier().ascii().data(), std::min(static_
cast<unsigned>(keyIdentifierLengthCap), event.keyIdentifier().length())); | 746 memcpy(keyIdentifier, event.keyIdentifier().ascii().data(), std::min(static_
cast<unsigned>(keyIdentifierLengthCap), event.keyIdentifier().length())); |
| 743 } | 747 } |
| 744 | 748 |
| 745 static WebTouchPoint toWebTouchPoint(const Touch* touch, const RenderObject* ren
derObject, WebTouchPoint::State state) | 749 static WebTouchPoint toWebTouchPoint(const Touch* touch, const RenderObject* ren
derObject, WebTouchPoint::State state) |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 829 modifiers = getWebInputModifiers(event); | 833 modifiers = getWebInputModifiers(event); |
| 830 | 834 |
| 831 globalX = event.screenX(); | 835 globalX = event.screenX(); |
| 832 globalY = event.screenY(); | 836 globalY = event.screenY(); |
| 833 IntPoint localPoint = convertAbsoluteLocationForRenderObject(event.absoluteL
ocation(), *renderObject); | 837 IntPoint localPoint = convertAbsoluteLocationForRenderObject(event.absoluteL
ocation(), *renderObject); |
| 834 x = localPoint.x(); | 838 x = localPoint.x(); |
| 835 y = localPoint.y(); | 839 y = localPoint.y(); |
| 836 } | 840 } |
| 837 | 841 |
| 838 } // namespace blink | 842 } // namespace blink |
| OLD | NEW |