Index: third_party/WebKit/Source/core/editing/Editor.cpp |
diff --git a/third_party/WebKit/Source/core/editing/Editor.cpp b/third_party/WebKit/Source/core/editing/Editor.cpp |
index fb4d38efb0921a32a6cbb6442e0da96eb1549ef5..b20ac81d7503f3b13a401cfe667672dd3adbe6a0 100644 |
--- a/third_party/WebKit/Source/core/editing/Editor.cpp |
+++ b/third_party/WebKit/Source/core/editing/Editor.cpp |
@@ -348,7 +348,7 @@ bool Editor::deleteWithDirection(DeleteDirection direction, TextGranularity gran |
return true; |
} |
-void Editor::deleteSelectionWithSmartDelete(bool smartDelete, InputEvent::InputType inputType) |
+void Editor::deleteSelectionWithSmartDelete(bool smartDelete, InputEvent::InputType inputType, const Position& referenceMovePosition) |
{ |
if (frame().selection().isNone()) |
return; |
@@ -357,7 +357,7 @@ void Editor::deleteSelectionWithSmartDelete(bool smartDelete, InputEvent::InputT |
const bool kExpandForSpecialElements = false; |
const bool kSanitizeMarkup = true; |
DCHECK(frame().document()); |
- DeleteSelectionCommand::create(*frame().document(), smartDelete, kMergeBlocksAfterDelete, kExpandForSpecialElements, kSanitizeMarkup, inputType)->apply(); |
+ DeleteSelectionCommand::create(*frame().document(), smartDelete, kMergeBlocksAfterDelete, kExpandForSpecialElements, kSanitizeMarkup, inputType, referenceMovePosition)->apply(); |
} |
void Editor::pasteAsPlainText(const String& pastingText, bool smartReplace) |
@@ -551,7 +551,7 @@ void Editor::replaceSelectionAfterDragging(DocumentFragment* fragment, bool smar |
if (plainText) |
options |= ReplaceSelectionCommand::MatchStyle; |
DCHECK(frame().document()); |
- ReplaceSelectionCommand::create(*frame().document(), fragment, options, InputEvent::InputType::Drag)->apply(); |
+ ReplaceSelectionCommand::create(*frame().document(), fragment, options, InputEvent::InputType::InsertFromDrop)->apply(); |
} |
void Editor::moveSelectionAfterDragging(DocumentFragment* fragment, const Position& pos, bool smartInsert, bool smartDelete) |
@@ -719,6 +719,9 @@ void Editor::appliedEditing(CompositeEditCommand* cmd) |
// Command will be equal to last edit command only in the case of typing |
if (m_lastEditCommand.get() == cmd) { |
DCHECK(cmd->isTypingCommand()); |
+ } else if (m_lastEditCommand && m_lastEditCommand->inputType() == InputEvent::InputType::DeleteByDrag && cmd->inputType() == InputEvent::InputType::InsertFromDrop) { |
+ m_lastEditCommand->appendCommandToComposite(cmd); |
+ m_lastEditCommand = cmd; |
chongz
2016/09/28 02:19:26
Has potential issue. These 2 commands might be cre
yosin_UTC9
2016/09/28 04:19:03
How about having DragAndDropCommand, derived from
chongz
2016/09/29 02:36:22
Added command group wrapper |DragAndDropCommand|,
|
} else { |
// Only register a new undo command if the command passed in is |
// different from the last command |