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

Unified Diff: third_party/WebKit/Source/core/input/KeyboardEventManager.cpp

Issue 2045603002: Handle the "key" field as opposed to keyIdentifier field. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove initialization of the view Created 4 years, 6 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
Index: third_party/WebKit/Source/core/input/KeyboardEventManager.cpp
diff --git a/third_party/WebKit/Source/core/input/KeyboardEventManager.cpp b/third_party/WebKit/Source/core/input/KeyboardEventManager.cpp
index bce0b9adfa2c295bc2b3f453c6555e99415da53b..3db8af2e88f01b59000a2a8e1fb0811d4108853d 100644
--- a/third_party/WebKit/Source/core/input/KeyboardEventManager.cpp
+++ b/third_party/WebKit/Source/core/input/KeyboardEventManager.cpp
@@ -24,24 +24,17 @@ namespace blink {
namespace {
-WebFocusType focusDirectionForKey(const AtomicString& keyIdentifier)
+WebFocusType focusDirectionForKey(const String& key)
{
- DEFINE_STATIC_LOCAL(AtomicString, Down, ("Down"));
- DEFINE_STATIC_LOCAL(AtomicString, Up, ("Up"));
- DEFINE_STATIC_LOCAL(AtomicString, Left, ("Left"));
- DEFINE_STATIC_LOCAL(AtomicString, Right, ("Right"));
-
WebFocusType retVal = WebFocusTypeNone;
-
- if (keyIdentifier == Down)
+ if (key == "ArrowDown")
retVal = WebFocusTypeDown;
- else if (keyIdentifier == Up)
+ else if (key == "ArrowUp")
retVal = WebFocusTypeUp;
- else if (keyIdentifier == Left)
+ else if (key == "ArrowLeft")
retVal = WebFocusTypeLeft;
- else if (keyIdentifier == Right)
+ else if (key == "ArrowRight")
retVal = WebFocusTypeRight;
-
return retVal;
}
@@ -174,14 +167,14 @@ void KeyboardEventManager::defaultKeyboardEventHandler(
m_frame->editor().handleKeyboardEvent(event);
if (event->defaultHandled())
return;
- if (event->keyIdentifier() == "U+0009") {
+ if (event->key() == "Tab") {
defaultTabEventHandler(event);
- } else if (event->keyIdentifier() == "U+0008") {
+ } else if (event->key() == "Backspace") {
defaultBackspaceEventHandler(event);
- } else if (event->keyIdentifier() == "U+001B") {
+ } else if (event->key() == "Escape") {
defaultEscapeEventHandler(event);
} else {
- WebFocusType type = focusDirectionForKey(AtomicString(event->keyIdentifier()));
+ WebFocusType type = focusDirectionForKey(event->key());
if (type != WebFocusTypeNone)
defaultArrowEventHandler(type, event);
}

Powered by Google App Engine
This is Rietveld 408576698