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

Unified Diff: third_party/WebKit/Source/core/input/EventHandler.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: Fix chromeos 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/EventHandler.cpp
diff --git a/third_party/WebKit/Source/core/input/EventHandler.cpp b/third_party/WebKit/Source/core/input/EventHandler.cpp
index bad5b0dc36e3628c3abf728963fe111b80484d2d..464019b1f711dee05382aa43cc93b4cf0fb7677a 100644
--- a/third_party/WebKit/Source/core/input/EventHandler.cpp
+++ b/third_party/WebKit/Source/core/input/EventHandler.cpp
@@ -2684,22 +2684,17 @@ WebInputEventResult EventHandler::keyEvent(const PlatformKeyboardEvent& initialK
return toWebInputEventResult(node->dispatchEvent(keypress));
}
-static WebFocusType focusDirectionForKey(const AtomicString& keyIdentifier)
+static 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")
bokan 2016/06/09 15:51:56 Perhaps these kind of "ArrowDown", "Backspace" typ
dtapuska 2016/06/09 18:20:33 sgtm; I can create a bug for that.
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;
@@ -2716,14 +2711,14 @@ void EventHandler::defaultKeyboardEventHandler(KeyboardEvent* event)
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