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

Unified Diff: third_party/WebKit/Source/core/events/InputEvent.cpp

Issue 2074423004: [InputEvent] Dispatch 'input' event for ContentEditable and typing on Input element (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Dispatch scoped 'input' event Created 4 years, 6 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/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..3efdb69b40d6408913957f2a0708c8b4ed713fa6 100644
--- a/third_party/WebKit/Source/core/events/InputEvent.cpp
+++ b/third_party/WebKit/Source/core/events/InputEvent.cpp
@@ -16,13 +16,14 @@ 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" },
+ { InputEvent::InputType::Bold, "bold" },
};
static_assert(arraysize(kInputTypeStringNameMap) == static_cast<size_t>(InputEvent::InputType::NumberOfInputTypes),
@@ -85,6 +86,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.
tkent 2016/06/22 06:53:21 why ojan?
chongz 2016/06/23 00:32:06 This is the similar issue as in |InputEvent::creat
+ // 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);

Powered by Google App Engine
This is Rietveld 408576698