Index: third_party/WebKit/Source/core/events/InputEvent.cpp |
diff --git a/third_party/WebKit/Source/core/events/InputEvent.cpp b/third_party/WebKit/Source/core/events/InputEvent.cpp |
index f7eb07a65d040c9cb0071ccc8a29dc660983bf09..5ace994f4b4bceafe3e1c958655d7bd3026dcefe 100644 |
--- a/third_party/WebKit/Source/core/events/InputEvent.cpp |
+++ b/third_party/WebKit/Source/core/events/InputEvent.cpp |
@@ -15,6 +15,36 @@ InputEvent::InputEvent() |
InputEvent::InputEvent(const AtomicString& type, const InputEventInit& initializer) |
: UIEvent(type, initializer) |
{ |
+ if (initializer.hasInputType()) |
+ m_inputType = initializer.inputType(); |
+ if (initializer.hasData()) |
+ m_data = initializer.data(); |
+} |
+ |
+/* static */ |
+PassRefPtrWillBeRawPtr<InputEvent> InputEvent::createBeforeInput(const String& inputType, const String& data) |
+{ |
+ InputEventInit inputEventInit; |
+ |
+ inputEventInit.setBubbles(true); |
+ inputEventInit.setCancelable(false); |
+ inputEventInit.setInputType(inputType); |
+ inputEventInit.setData(data); |
+ |
+ return InputEvent::create(EventTypeNames::beforeinput, inputEventInit); |
+} |
+ |
+/* static */ |
+PassRefPtrWillBeRawPtr<InputEvent> InputEvent::createCancelableBeforeInput(const String& inputType, const String& data) |
+{ |
+ InputEventInit inputEventInit; |
+ |
+ inputEventInit.setBubbles(true); |
+ inputEventInit.setCancelable(true); |
+ inputEventInit.setInputType(inputType); |
+ inputEventInit.setData(data); |
+ |
+ return InputEvent::create(EventTypeNames::beforeinput, inputEventInit); |
} |
bool InputEvent::isInputEvent() const |