Chromium Code Reviews| 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 c7938b4518e0a78294801d7a639abfd978e3bb52..ed88ea7ff8a6e4d4072922eee39a0e68990dcaab 100644 |
| --- a/third_party/WebKit/Source/core/page/DragController.cpp |
| +++ b/third_party/WebKit/Source/core/page/DragController.cpp |
| @@ -460,8 +460,11 @@ static bool setSelectionToDragCaret(LocalFrame* frame, |
| const IntPoint& point) { |
| frame->selection().setSelection(dragCaret); |
| if (frame->selection().isNone()) { |
| - dragCaret = |
| - createVisibleSelectionDeprecated(frame->positionForPoint(point)); |
| + // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets |
| + // needs to be audited. See http://crbug.com/590369 for more details. |
| + frame->document()->updateStyleAndLayoutIgnorePendingStylesheets(); |
| + |
| + dragCaret = createVisibleSelection(frame->positionForPoint(point)); |
| frame->selection().setSelection(dragCaret); |
| range = createRange(dragCaret.toNormalizedEphemeralRange()); |
| } |
| @@ -475,9 +478,8 @@ DispatchEventResult DragController::dispatchTextInputEventFor( |
| String text = m_page->dragCaretController().isContentRichlyEditable() |
| ? "" |
| : dragData->asPlainText(); |
| - Element* target = |
| - innerFrame->editor().findEventTargetFrom(createVisibleSelectionDeprecated( |
| - m_page->dragCaretController().caretPosition())); |
| + Element* target = innerFrame->editor().findEventTargetFrom( |
| + createVisibleSelection(m_page->dragCaretController().caretPosition())); |
|
tkent
2016/10/03 23:37:09
Please explain why we can use non-deprecated versi
|
| return target->dispatchEvent( |
| TextEvent::createForDrop(innerFrame->domWindow(), text)); |
| } |
| @@ -522,8 +524,18 @@ bool DragController::concludeEditDrag(DragData* dragData) { |
| return false; |
| } |
| - VisibleSelection dragCaret = createVisibleSelectionDeprecated( |
| - m_page->dragCaretController().caretPosition()); |
| + if (m_page->dragCaretController().hasCaret()) { |
| + // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets |
| + // needs to be audited. See http://crbug.com/590369 for more details. |
| + m_page->dragCaretController() |
| + .caretPosition() |
| + .position() |
| + .document() |
| + ->updateStyleAndLayoutIgnorePendingStylesheets(); |
| + } |
| + |
| + VisibleSelection dragCaret = |
| + createVisibleSelection(m_page->dragCaretController().caretPosition()); |
| m_page->dragCaretController().clear(); |
| // |innerFrame| can be removed by event handler called by |
| // |dispatchTextInputEventFor()|. |
| @@ -787,7 +799,7 @@ static void prepareDataTransferForImageDrag(LocalFrame* source, |
| Range* range = source->document()->createRange(); |
| range->selectNode(node, ASSERT_NO_EXCEPTION); |
| source->selection().setSelection( |
| - createVisibleSelectionDeprecated(EphemeralRange(range))); |
| + createVisibleSelection(EphemeralRange(range))); |
| } |
| dataTransfer->declareAndWriteDragImage( |
| node, !linkURL.isEmpty() ? linkURL : imageURL, label); |