| 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..0e76d1c1e87375b637da5d5f4b9b31c430cd18eb 100644
|
| --- a/third_party/WebKit/Source/core/page/DragController.cpp
|
| +++ b/third_party/WebKit/Source/core/page/DragController.cpp
|
| @@ -606,9 +606,12 @@ 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 destroy drop frame.
|
| + if (innerFrame->document()->frame() != innerFrame ||
|
| + !element->isConnected())
|
| return false;
|
|
|
| innerFrame->selection().setSelection(
|
| @@ -617,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 {
|
| @@ -639,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);
|
| }
|
| }
|
|
|
|
|