Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(847)

Unified Diff: Source/core/events/KeyboardEvent.cpp

Issue 1352283002: Remove PlatformKeyboardEvents requirement to have located virtual keycode information. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/platform/PlatformEvent.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « no previous file | Source/platform/PlatformEvent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698