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

Unified Diff: third_party/WebKit/Source/core/editing/EditorKeyBindings.cpp

Issue 1752933002: [InputEvent] Fire 'beforeinput' during typing, pressing hot keys and IME composition (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 8 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/editing/EditorKeyBindings.cpp
diff --git a/third_party/WebKit/Source/core/editing/EditorKeyBindings.cpp b/third_party/WebKit/Source/core/editing/EditorKeyBindings.cpp
index 6f3dca9682f9a5f14349b60a1b60dfccc5cfdaa4..589c314f62ddb710bfe4845ddd83bf5c0d5b22c7 100644
--- a/third_party/WebKit/Source/core/editing/EditorKeyBindings.cpp
+++ b/third_party/WebKit/Source/core/editing/EditorKeyBindings.cpp
@@ -26,6 +26,7 @@
#include "core/editing/Editor.h"
+#include "core/editing/EditingUtilities.h"
#include "core/events/KeyboardEvent.h"
#include "core/frame/LocalFrame.h"
#include "core/page/EditorClient.h"
@@ -60,6 +61,10 @@ bool Editor::handleEditingKeyboardEvent(KeyboardEvent* evt)
if (!behavior().shouldInsertCharacter(*evt) || !canEdit())
return false;
+ // Return true to prevent default action. e.g. Space key scroll.
+ if (dispatchBeforeInputInsertText(evt->target(), evt->keyEvent()->text()) != DispatchEventResult::NotCanceled)
+ return true;
+
return insertText(evt->keyEvent()->text(), evt);
}

Powered by Google App Engine
This is Rietveld 408576698