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

Unified Diff: third_party/WebKit/Source/core/editing/commands/EditorCommand.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/editing/commands/EditorCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp b/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
index e6ccf709060eb168e2319c19fb85797ade3cc43d..a6a64a9524ba50c4af8e8dcd92a0c594dc9116fd 100644
--- a/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
@@ -161,12 +161,7 @@ InputEvent::InputType InputTypeFromCommandType(WebEditingCommandType commandType
return InputType::Undo;
case CommandType::Redo:
return InputType::Redo;
- case CommandType::Copy:
- return InputType::Copy;
- case CommandType::Cut:
- return InputType::Cut;
- case CommandType::Paste:
- return InputType::Paste;
+ // Cut and Paste will be handled in |Editor::dispatchCPPEvent()|.
// Styling.
case CommandType::Bold:
@@ -479,7 +474,7 @@ static bool executeCut(LocalFrame& frame, Event*, EditorCommandSource source, co
// |canExecute()|. See also "Copy", and "Paste" command.
if (!canWriteClipboard(frame, source))
return false;
- frame.editor().cut();
+ frame.editor().cut(source);
return true;
}
@@ -1126,7 +1121,7 @@ static bool executePaste(LocalFrame& frame, Event*, EditorCommandSource source,
// |canExecute()|. See also "Copy", and "Cut" command.
if (!canReadClipboard(frame, source))
return false;
- frame.editor().paste();
+ frame.editor().paste(source);
return true;
}
@@ -1145,14 +1140,14 @@ static bool executePasteGlobalSelection(LocalFrame& frame, Event*, EditorCommand
bool oldSelectionMode = Pasteboard::generalPasteboard()->isSelectionMode();
Pasteboard::generalPasteboard()->setSelectionMode(true);
- frame.editor().paste();
+ frame.editor().paste(source);
Pasteboard::generalPasteboard()->setSelectionMode(oldSelectionMode);
return true;
}
-static bool executePasteAndMatchStyle(LocalFrame& frame, Event*, EditorCommandSource, const String&)
+static bool executePasteAndMatchStyle(LocalFrame& frame, Event*, EditorCommandSource source, const String&)
{
- frame.editor().pasteAsPlainText();
+ frame.editor().pasteAsPlainText(source);
return true;
}
@@ -1886,8 +1881,8 @@ bool Editor::Command::execute(const String& parameter, Event* triggeringEvent) c
}
}
- // 'beforeinput' event handler may destroy |frame()|.
- if (!m_frame || !frame().document())
+ // 'beforeinput' event handler may destroy target frame.
+ if (m_frame->document()->frame() != m_frame)
return false;
frame().document()->updateStyleAndLayoutIgnorePendingStylesheets();

Powered by Google App Engine
This is Rietveld 408576698