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

Unified Diff: third_party/WebKit/Source/core/editing/EditingUtilities.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 on WebEditingCommandType & Yosin's review 2 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/EditingUtilities.cpp
diff --git a/third_party/WebKit/Source/core/editing/EditingUtilities.cpp b/third_party/WebKit/Source/core/editing/EditingUtilities.cpp
index b1969288e1236da78496692d17fcb110eb3ab03a..ea27a285e618e40ab2c8c62bf85fccdbd1675a5f 100644
--- a/third_party/WebKit/Source/core/editing/EditingUtilities.cpp
+++ b/third_party/WebKit/Source/core/editing/EditingUtilities.cpp
@@ -1731,4 +1731,37 @@ bool isTextSecurityNode(const Node* node)
return node && node->layoutObject() && node->layoutObject()->style()->textSecurity() != TSNONE;
}
+DispatchEventResult dispatchBeforeInputInsertText(EventTarget* target, const String& data)
+{
+ if (RuntimeEnabledFeatures::inputEventEnabled()) {
yosin_UTC9 2016/04/13 06:13:09 Could you use early return style to reduce indenta
chongz 2016/04/13 23:53:08 Done.
+ if (target) {
+ InputEvent* beforeInputEvent = InputEvent::createBeforeInputTyping(InputEvent::InputType::InsertText, data);
+ return target->dispatchEvent(beforeInputEvent);
+ }
+ }
+ return DispatchEventResult::NotCanceled;
+}
+
+DispatchEventResult dispatchBeforeInputFromComposition(EventTarget* target, InputEvent::InputType inputType, const String& data)
+{
+ if (RuntimeEnabledFeatures::inputEventEnabled()) {
+ if (target) {
+ InputEvent* beforeInputEvent = InputEvent::createBeforeInputFromComposition(inputType, data);
+ return target->dispatchEvent(beforeInputEvent);
+ }
+ }
+ return DispatchEventResult::NotCanceled;
+}
+
+DispatchEventResult dispatchBeforeInputEditorCommand(EventTarget* target, InputEvent::InputType inputType, const String& data)
+{
+ if (RuntimeEnabledFeatures::inputEventEnabled()) {
+ if (target) {
+ InputEvent* beforeInputEvent = InputEvent::createBeforeInputEditorCommand(inputType, data);
+ return target->dispatchEvent(beforeInputEvent);
+ }
+ }
+ return DispatchEventResult::NotCanceled;
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698