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

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

Issue 2558643003: [InputEvent] Move 'beforeinput' logic into |CompositeEditCommand::willApplyEditing()| (3/3) (Closed)
Patch Set: 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 8a439f75018f8ab3745ac250cef85eef87e3e3f3..3d51ee6c23a5fbe6dc19a0e38755e98fd85090b0 100644
--- a/third_party/WebKit/Source/core/page/DragController.cpp
+++ b/third_party/WebKit/Source/core/page/DragController.cpp
@@ -606,9 +606,11 @@ bool DragController::concludeEditDrag(DragData* dragData) {
? InsertMode::Smart
: InsertMode::Simple;
- if (!innerFrame->editor().deleteSelectionAfterDraggingWithEvents(
- innerFrame->editor().findEventTargetFromSelection(), deleteMode,
- dragCaret.base()))
+ innerFrame->editor().deleteSelectionWithSmartDelete(
+ deleteMode, InputEvent::InputType::DeleteByDrag, dragCaret.base());
+
+ // 'beforeinput' event handler may disconnect drop target.
+ if (!element->isConnected())
return false;
innerFrame->selection().setSelection(
@@ -617,19 +619,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 {
@@ -639,11 +638,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