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

Unified Diff: third_party/WebKit/Source/core/page/DragController.cpp

Issue 2558643003: [InputEvent] Move 'beforeinput' logic into |CompositeEditCommand::willApplyEditing()| (3/3) (Closed)
Patch Set: Rebase on EditCommandSource and willApply() CLs Created 4 years 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/page/DragController.cpp
diff --git a/third_party/WebKit/Source/core/page/DragController.cpp b/third_party/WebKit/Source/core/page/DragController.cpp
index da3319ecdb8a00df032fa20dc69d533f02c54c9b..6e47f3a1ff28dc9a35d335443bead95f1c80c1c2 100644
--- a/third_party/WebKit/Source/core/page/DragController.cpp
+++ b/third_party/WebKit/Source/core/page/DragController.cpp
@@ -605,9 +605,13 @@ bool DragController::concludeEditDrag(DragData* dragData) {
? InsertMode::Smart
: InsertMode::Simple;
- if (!innerFrame->editor().deleteSelectionAfterDraggingWithEvents(
- innerFrame->editor().findEventTargetFromSelection(), deleteMode,
- dragCaret.base()))
+ innerFrame->editor().deleteSelectionWithSmartDelete(
+ EditCommandSource::kMenuOrKeyBinding, deleteMode,
+ InputEvent::InputType::DeleteByDrag, dragCaret.base());
+
+ // 'beforeinput' event handler may destroy drop frame.
+ if (innerFrame->document()->frame() != innerFrame ||
+ !element->isConnected())
return false;
innerFrame->selection().setSelection(
@@ -616,19 +620,16 @@ bool DragController::concludeEditDrag(DragData* dragData) {
.build());
if (innerFrame->selection().isAvailable()) {
DCHECK(m_documentUnderMouse);
- if (!innerFrame->editor().replaceSelectionAfterDraggingWithEvents(
- element, dragData, fragment, range, insertMode, dragSourceType))
- return false;
+ innerFrame->editor().replaceSelectionAfterDragging(fragment, insertMode,
+ dragSourceType);
}
} else {
if (setSelectionToDragCaret(innerFrame, dragCaret, range, point)) {
DCHECK(m_documentUnderMouse);
- if (!innerFrame->editor().replaceSelectionAfterDraggingWithEvents(
- element, dragData, fragment, range,
- dragData->canSmartReplace() ? InsertMode::Smart
- : InsertMode::Simple,
- dragSourceType))
- return false;
+ innerFrame->editor().replaceSelectionAfterDragging(
+ fragment, dragData->canSmartReplace() ? InsertMode::Smart
+ : InsertMode::Simple,
+ dragSourceType);
}
}
} else {
@@ -638,11 +639,9 @@ bool DragController::concludeEditDrag(DragData* dragData) {
if (setSelectionToDragCaret(innerFrame, dragCaret, range, point)) {
DCHECK(m_documentUnderMouse);
- if (!innerFrame->editor().replaceSelectionAfterDraggingWithEvents(
- element, dragData,
- createFragmentFromText(EphemeralRange(range), text), range,
- InsertMode::Simple, DragSourceType::PlainTextSource))
- return false;
+ innerFrame->editor().replaceSelectionAfterDragging(
+ createFragmentFromText(EphemeralRange(range), text),
+ InsertMode::Simple, DragSourceType::PlainTextSource);
}
}

Powered by Google App Engine
This is Rietveld 408576698