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..bf2fd7eb24cc04bffba532d27955686265ef3a02 100644 |
--- a/third_party/WebKit/Source/core/editing/EditingUtilities.cpp |
+++ b/third_party/WebKit/Source/core/editing/EditingUtilities.cpp |
@@ -1731,4 +1731,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::createBeforeInputTyping(InputEvent::InputType::InsertText, data); |
+ 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::createBeforeInputFromComposition(inputType, data); |
+ 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::createBeforeInputEditorCommand(inputType, data); |
+ return target->dispatchEvent(beforeInputEvent); |
+} |
+ |
} // namespace blink |