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

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 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 1009d71f978f2299aa926f8f34925526bd279665..bdfadf91e7e879e8979ea1e9a80befa2227020fc 100644
--- a/third_party/WebKit/Source/core/editing/EditingUtilities.cpp
+++ b/third_party/WebKit/Source/core/editing/EditingUtilities.cpp
@@ -1732,4 +1732,34 @@ bool isTextSecurityNode(const Node* node)
return node && node->layoutObject() && node->layoutObject()->style()->textSecurity() != TSNONE;
}
+DispatchEventResult dispatchBeforeInputInsertText(EventTarget* target, const String& data)
+{
+ if (!RuntimeEnabledFeatures::inputEventEnabled())
+ return DispatchEventResult::NotCanceled;
+ if (!target)
+ return DispatchEventResult::NotCanceled;
+ InputEvent* beforeInputEvent = InputEvent::createBeforeInput(InputEvent::InputType::InsertText, data, InputEvent::EventCancelable::IsCancelable);
+ return target->dispatchEvent(beforeInputEvent);
+}
+
+DispatchEventResult dispatchBeforeInputFromComposition(EventTarget* target, InputEvent::InputType inputType, const String& data)
+{
+ if (!RuntimeEnabledFeatures::inputEventEnabled())
+ return DispatchEventResult::NotCanceled;
+ if (!target)
+ return DispatchEventResult::NotCanceled;
+ InputEvent* beforeInputEvent = InputEvent::createBeforeInput(inputType, data, InputEvent::EventCancelable::NotCancelable);
+ return target->dispatchEvent(beforeInputEvent);
+}
+
+DispatchEventResult dispatchBeforeInputEditorCommand(EventTarget* target, InputEvent::InputType inputType, const String& data)
+{
+ if (!RuntimeEnabledFeatures::inputEventEnabled())
+ return DispatchEventResult::NotCanceled;
+ if (!target)
+ return DispatchEventResult::NotCanceled;
+ InputEvent* beforeInputEvent = InputEvent::createBeforeInput(inputType, data, InputEvent::EventCancelable::IsCancelable);
+ return target->dispatchEvent(beforeInputEvent);
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698