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); |
} |