Index: Source/core/events/KeyboardEvent.cpp |
diff --git a/Source/core/events/KeyboardEvent.cpp b/Source/core/events/KeyboardEvent.cpp |
index 54e373d63e29d822fea49978759ac7cbd8d23188..fe5a977f487d5c5972a42c5aae9cd01bd1952f42 100644 |
--- a/Source/core/events/KeyboardEvent.cpp |
+++ b/Source/core/events/KeyboardEvent.cpp |
@@ -49,42 +49,15 @@ static inline const AtomicString& eventTypeForKeyboardEventType(PlatformEvent::T |
return EventTypeNames::keydown; |
} |
-static inline int windowsVirtualKeyCodeWithoutLocation(int keycode) |
-{ |
- switch (keycode) { |
- case VK_LCONTROL: |
- case VK_RCONTROL: |
- return VK_CONTROL; |
- case VK_LSHIFT: |
- case VK_RSHIFT: |
- return VK_SHIFT; |
- case VK_LMENU: |
- case VK_RMENU: |
- return VK_MENU; |
- default: |
- return keycode; |
- } |
-} |
- |
static inline KeyboardEvent::KeyLocationCode keyLocationCode(const PlatformKeyboardEvent& key) |
{ |
if (key.isKeypad()) |
return KeyboardEvent::DOM_KEY_LOCATION_NUMPAD; |
- |
- switch (key.windowsVirtualKeyCode()) { |
- case VK_LCONTROL: |
- case VK_LSHIFT: |
- case VK_LMENU: |
- case VK_LWIN: |
+ if (key.modifiers() & PlatformEvent::IsLeft) |
return KeyboardEvent::DOM_KEY_LOCATION_LEFT; |
- case VK_RCONTROL: |
- case VK_RSHIFT: |
- case VK_RMENU: |
- case VK_RWIN: |
+ if (key.modifiers() & PlatformEvent::IsRight) |
return KeyboardEvent::DOM_KEY_LOCATION_RIGHT; |
- default: |
- return KeyboardEvent::DOM_KEY_LOCATION_STANDARD; |
- } |
+ return KeyboardEvent::DOM_KEY_LOCATION_STANDARD; |
} |
PassRefPtrWillBeRawPtr<KeyboardEvent> KeyboardEvent::create(ScriptState* scriptState, const AtomicString& type, const KeyboardEventInit& initializer) |
@@ -185,7 +158,7 @@ int KeyboardEvent::keyCode() const |
#endif |
if (type() == EventTypeNames::keydown || type() == EventTypeNames::keyup) |
- return windowsVirtualKeyCodeWithoutLocation(m_keyEvent->windowsVirtualKeyCode()); |
+ return m_keyEvent->windowsVirtualKeyCode(); |
return charCode(); |
} |