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 fed03353f55ed4fa03b8f0b67ffc02d2b62934ef..9767592b6aff211fe631297eb7713707aaeee66e 100644 |
--- a/third_party/WebKit/Source/core/editing/EditingUtilities.cpp |
+++ b/third_party/WebKit/Source/core/editing/EditingUtilities.cpp |
@@ -41,6 +41,7 @@ |
#include "core/editing/VisibleUnits.h" |
#include "core/editing/iterators/TextIterator.h" |
#include "core/editing/serializers/HTMLInterchange.h" |
+#include "core/events/InputEvent.h" |
#include "core/frame/LocalFrame.h" |
#include "core/frame/UseCounter.h" |
#include "core/html/HTMLBRElement.h" |
@@ -1652,4 +1653,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()) { |
+ if (target) { |
+ RefPtrWillBeRawPtr<InputEvent> beforeInputEvent = InputEvent::createBeforeInputTyping(InputEvent::InputType::InsertText, data); |
+ return target->dispatchEvent(beforeInputEvent); |
+ } |
+ } |
+ return DispatchEventResult::NotCanceled; |
+} |
+ |
+DispatchEventResult dispatchBeforeInputCompositionUpdate(EventTarget* target, const String& data) |
+{ |
+ if (RuntimeEnabledFeatures::inputEventEnabled()) { |
+ if (target) { |
+ RefPtrWillBeRawPtr<InputEvent> beforeInputEvent = InputEvent::createBeforeInputCompositionUpdate(InputEvent::InputType::ReplaceText, data); |
+ return target->dispatchEvent(beforeInputEvent); |
+ } |
+ } |
+ return DispatchEventResult::NotCanceled; |
+} |
+ |
+DispatchEventResult dispatchBeforeInputEditorCommand(EventTarget* target, const char* commandName, const String& data) |
+{ |
+ if (RuntimeEnabledFeatures::inputEventEnabled()) { |
+ if (target) { |
+ RefPtrWillBeRawPtr<InputEvent> beforeInputEvent = InputEvent::createBeforeInputEditorCommand(commandName, data); |
+ return target->dispatchEvent(beforeInputEvent); |
+ } |
+ } |
+ return DispatchEventResult::NotCanceled; |
+} |
+ |
} // namespace blink |