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

Unified Diff: sky/engine/core/editing/EditorKeyBindings.cpp

Issue 872233002: Switch KeyboardEvents over to NewEventHandler (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Rename virtualKeyCode to key Created 5 years, 11 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 | « sky/engine/core/editing/EditingBehavior.cpp ('k') | sky/engine/core/events/GestureEvent.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/editing/EditorKeyBindings.cpp
diff --git a/sky/engine/core/editing/EditorKeyBindings.cpp b/sky/engine/core/editing/EditorKeyBindings.cpp
index f94fc34297fd46394024a2098bd92629fb0f7494..40d5e50b7eeafcbc45474c097d21efa821341e93 100644
--- a/sky/engine/core/editing/EditorKeyBindings.cpp
+++ b/sky/engine/core/editing/EditorKeyBindings.cpp
@@ -27,24 +27,19 @@
#include "sky/engine/config.h"
#include "sky/engine/core/editing/Editor.h"
+#include "gen/sky/core/EventTypeNames.h"
#include "sky/engine/core/events/KeyboardEvent.h"
#include "sky/engine/core/frame/LocalFrame.h"
#include "sky/engine/core/page/EditorClient.h"
-#include "sky/engine/platform/PlatformKeyboardEvent.h"
namespace blink {
-bool Editor::handleEditingKeyboardEvent(KeyboardEvent* evt)
+bool Editor::handleEditingKeyboardEvent(KeyboardEvent* event)
{
- const PlatformKeyboardEvent* keyEvent = evt->keyEvent();
- // do not treat this as text input if it's a system key event
- if (!keyEvent || keyEvent->isSystemKey())
- return false;
-
- String commandName = behavior().interpretKeyEvent(*evt);
+ String commandName = behavior().interpretKeyEvent(*event);
Command command = this->command(commandName);
- if (keyEvent->type() == PlatformEvent::RawKeyDown) {
+ if (event->type() == EventTypeNames::keydown) {
// WebKit doesn't have enough information about mode to decide how
// commands that just insert text if executed via Editor should be treated,
// so we leave it upon WebCore to either handle them immediately
@@ -52,16 +47,17 @@ bool Editor::handleEditingKeyboardEvent(KeyboardEvent* evt)
// (e.g. Tab that inserts a Tab character, or Enter).
if (command.isTextInsertion() || commandName.isEmpty())
return false;
- return command.execute(evt);
+ return command.execute(event);
}
- if (command.execute(evt))
+ if (command.execute(event))
return true;
- if (!behavior().shouldInsertCharacter(*evt) || !canEdit())
+ if (!behavior().shouldInsertCharacter(*event) || !canEdit())
return false;
- return insertText(evt->keyEvent()->text(), evt);
+ UChar charCode = event->charCode();
+ return insertText(String(&charCode, 1), event);
}
void Editor::handleKeyboardEvent(KeyboardEvent* evt)
« no previous file with comments | « sky/engine/core/editing/EditingBehavior.cpp ('k') | sky/engine/core/events/GestureEvent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698