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

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

Issue 2258663003: [InputEvent] Support |deleteByCut|&|insertFromPaste| with |dataTransfer| field (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: yosin's review2, fix nits Created 4 years, 4 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 395b5d9be45d2ae468d8e8395473d4ff7b100716..7ffa3de31a48b8c37522c899d70729f2cad40820 100644
--- a/third_party/WebKit/Source/core/events/InputEvent.cpp
+++ b/third_party/WebKit/Source/core/events/InputEvent.cpp
@@ -24,6 +24,7 @@ const struct {
{ InputEvent::InputType::InsertOrderedList, "insertOrderedList" },
{ InputEvent::InputType::InsertUnorderedList, "insertUnorderedList" },
{ InputEvent::InputType::InsertHorizontalRule, "insertHorizontalRule" },
+ { InputEvent::InputType::InsertFromPaste, "insertFromPaste" },
{ InputEvent::InputType::DeleteComposedCharacterForward, "deleteComposedCharacterForward" },
{ InputEvent::InputType::DeleteComposedCharacterBackward, "deleteComposedCharacterBackward" },
{ InputEvent::InputType::DeleteWordBackward, "deleteWordBackward" },
@@ -32,11 +33,9 @@ const struct {
{ InputEvent::InputType::DeleteLineForward, "deleteLineForward" },
{ InputEvent::InputType::DeleteContentBackward, "deleteContentBackward" },
{ InputEvent::InputType::DeleteContentForward, "deleteContentForward" },
+ { InputEvent::InputType::DeleteByCut, "deleteByCut" },
{ InputEvent::InputType::Undo, "undo" },
{ InputEvent::InputType::Redo, "redo" },
- { InputEvent::InputType::Copy, "copy" },
- { InputEvent::InputType::Cut, "cut" },
- { InputEvent::InputType::Paste, "paste" },
{ InputEvent::InputType::Bold, "bold" },
{ InputEvent::InputType::Italic, "italic" },
{ InputEvent::InputType::Underline, "underline" },
@@ -94,6 +93,8 @@ InputEvent::InputEvent(const AtomicString& type, const InputEventInit& initializ
m_inputType = convertStringToInputType(initializer.inputType());
if (initializer.hasData())
m_data = initializer.data();
+ if (initializer.hasDataTransfer())
+ m_dataTransfer = initializer.dataTransfer();
if (initializer.hasIsComposing())
m_isComposing = initializer.isComposing();
if (initializer.hasRanges())
@@ -119,6 +120,22 @@ InputEvent* InputEvent::createBeforeInput(InputType inputType, const String& dat
}
/* static */
+InputEvent* InputEvent::createBeforeInput(InputType inputType, DataTransfer* dataTransfer, EventCancelable cancelable, EventIsComposing isComposing, const RangeVector* ranges)
+{
+ InputEventInit inputEventInit;
+
+ inputEventInit.setBubbles(true);
+ inputEventInit.setCancelable(cancelable == IsCancelable);
+ inputEventInit.setInputType(convertInputTypeToString(inputType));
+ inputEventInit.setDataTransfer(dataTransfer);
+ inputEventInit.setIsComposing(isComposing == IsComposing);
+ if (ranges)
+ inputEventInit.setRanges(*ranges);
+
+ return InputEvent::create(EventTypeNames::beforeinput, inputEventInit);
+}
+
+/* static */
InputEvent* InputEvent::createInput(InputType inputType, const String& data, EventIsComposing isComposing, const RangeVector* ranges)
{
InputEventInit inputEventInit;
@@ -164,6 +181,7 @@ EventDispatchMediator* InputEvent::createMediator()
DEFINE_TRACE(InputEvent)
{
UIEvent::trace(visitor);
+ visitor->trace(m_dataTransfer);
visitor->trace(m_ranges);
}
« no previous file with comments | « third_party/WebKit/Source/core/events/InputEvent.h ('k') | third_party/WebKit/Source/core/events/InputEvent.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698