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 5b7dd0e1a3e4376187624a221a4a81cb560c1320..692e883639d9fa920e51e74715a8255fe578254d 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); |
} |