| Index: Source/core/events/KeyboardEvent.cpp
|
| diff --git a/Source/core/events/KeyboardEvent.cpp b/Source/core/events/KeyboardEvent.cpp
|
| index 99be09ca9633867bb562e44244bb19ae8691609f..5df6e349eb278a82b748e6eebbc2b54456a65f1a 100644
|
| --- a/Source/core/events/KeyboardEvent.cpp
|
| +++ b/Source/core/events/KeyboardEvent.cpp
|
| @@ -23,6 +23,7 @@
|
| #include "config.h"
|
| #include "core/events/KeyboardEvent.h"
|
|
|
| +#include "KeyboardCode.h"
|
| #include "platform/PlatformKeyboardEvent.h"
|
| #include "platform/WindowsKeyboardCodes.h"
|
|
|
| @@ -85,6 +86,23 @@ static inline KeyboardEvent::KeyLocationCode keyLocationCode(const PlatformKeybo
|
| }
|
| }
|
|
|
| +static inline String usbCodeToKeyCode(AtomicString type, int usbCode, int windowsVirtualKeyboard)
|
| +{
|
| + String code = "";
|
| +
|
| + if (type == EventTypeNames::keypress)
|
| + return code;
|
| +
|
| + for (unsigned long i = 0; i < (sizeof(keyCodeMap)/ sizeof(keyCodeMap[0])); ++i) {
|
| + if ((usbCode && usbCode == keyCodeMap[i].usbCode) || (windowsVirtualKeyboard && windowsVirtualKeyboard == keyCodeMap[i].windowsKeyCode)) {
|
| + code = String(keyCodeMap[i].code);
|
| + return code;
|
| + }
|
| + }
|
| +
|
| + return code;
|
| +}
|
| +
|
| KeyboardEventInit::KeyboardEventInit()
|
| : location(0)
|
| , ctrlKey(false)
|
| @@ -108,6 +126,7 @@ KeyboardEvent::KeyboardEvent(const PlatformKeyboardEvent& key, AbstractView* vie
|
| , m_keyIdentifier(key.keyIdentifier())
|
| , m_location(keyLocationCode(key))
|
| , m_isAutoRepeat(key.isAutoRepeat())
|
| + , m_code(usbCodeToKeyCode(eventTypeForKeyboardEventType(key.type()), key.usbKeyCode(), key.windowsVirtualKeyCode()))
|
| {
|
| }
|
|
|
| @@ -116,6 +135,7 @@ KeyboardEvent::KeyboardEvent(const AtomicString& eventType, const KeyboardEventI
|
| , m_keyIdentifier(initializer.keyIdentifier)
|
| , m_location(initializer.location)
|
| , m_isAutoRepeat(initializer.repeat)
|
| + , m_code(initializer.code)
|
| {
|
| }
|
|
|
|
|