| 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 95dc7b50921f3e8563b96b76fdf118ff09d76186..3bdc1632dc0fd213384d6868bc89500e5163c62f 100644
|
| --- a/third_party/WebKit/Source/core/events/InputEvent.cpp
|
| +++ b/third_party/WebKit/Source/core/events/InputEvent.cpp
|
| @@ -16,13 +16,13 @@ const struct {
|
| InputEvent::InputType inputType;
|
| const char* stringName;
|
| } kInputTypeStringNameMap[] = {
|
| - {InputEvent::InputType::None, ""},
|
| - {InputEvent::InputType::InsertText, "insertText"},
|
| - {InputEvent::InputType::ReplaceContent, "replaceContent"},
|
| - {InputEvent::InputType::DeleteContent, "deleteContent"},
|
| - {InputEvent::InputType::DeleteComposedCharacter, "deleteComposedCharacter"},
|
| - {InputEvent::InputType::Undo, "undo"},
|
| - {InputEvent::InputType::Redo, "redo"},
|
| + { InputEvent::InputType::None, "" },
|
| + { InputEvent::InputType::InsertText, "insertText" },
|
| + { InputEvent::InputType::ReplaceContent, "replaceContent" },
|
| + { InputEvent::InputType::DeleteContent, "deleteContent" },
|
| + { InputEvent::InputType::DeleteComposedCharacter, "deleteComposedCharacter" },
|
| + { InputEvent::InputType::Undo, "undo" },
|
| + { InputEvent::InputType::Redo, "redo" },
|
| };
|
|
|
| static_assert(arraysize(kInputTypeStringNameMap) == static_cast<size_t>(InputEvent::InputType::NumberOfInputTypes),
|
| @@ -85,6 +85,24 @@ InputEvent* InputEvent::createBeforeInput(InputType inputType, const String& dat
|
| return InputEvent::create(EventTypeNames::beforeinput, inputEventInit);
|
| }
|
|
|
| +/* static */
|
| +InputEvent* InputEvent::createInput(InputType inputType, const String& data, EventIsComposing isComposing, const RangeVector* ranges)
|
| +{
|
| + InputEventInit inputEventInit;
|
| +
|
| + inputEventInit.setBubbles(true);
|
| + inputEventInit.setCancelable(false);
|
| + // TODO(ojan): We should find a way to prevent conversion like String->enum->String just in order to use initializer.
|
| + // See InputEvent::InputEvent() for the second conversion.
|
| + inputEventInit.setInputType(convertInputTypeToString(inputType));
|
| + inputEventInit.setData(data);
|
| + inputEventInit.setIsComposing(isComposing == IsComposing);
|
| + if (ranges)
|
| + inputEventInit.setRanges(*ranges);
|
| +
|
| + return InputEvent::create(EventTypeNames::input, inputEventInit);
|
| +}
|
| +
|
| String InputEvent::inputType() const
|
| {
|
| return convertInputTypeToString(m_inputType);
|
|
|