Commit d9cbbaa8 authored by Yoshifumi Inoue's avatar Yoshifumi Inoue Committed by Commit Bot

Make SetSelectionToDragCaret() to take SelectionInDOMTree

This patch changes |SetSelectionToDragCaret()| to take |SelectionInDOMTree|
instead of |VisibleSelection&| since it uses |SelectionInDOMTree| and output
parameter isn't used in caller for improving code health.

This is 1/3 of series of patches:
 1. This patch
 2. http://crrev.com/c/1153070
 3. http://crrev.com/c/1153071

Bug: 657237
Change-Id: If01c9f465cbf5e5a940d1e9c30af8080a5496527
Reviewed-on: https://chromium-review.googlesource.com/1153069Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Commit-Queue: Yoshifumi Inoue <yosin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579002}
parent 5f32e29a
......@@ -470,10 +470,10 @@ DragOperation DragController::OperationForLoad(DragData* drag_data,
// |range|, otherwise returns false.
// TODO(yosin): We should return |VisibleSelection| rather than three values.
static bool SetSelectionToDragCaret(LocalFrame* frame,
VisibleSelection& drag_caret,
const SelectionInDOMTree& drag_caret,
Range*& range,
const LayoutPoint& point) {
frame->Selection().SetSelectionAndEndTyping(drag_caret.AsSelection());
frame->Selection().SetSelectionAndEndTyping(drag_caret);
if (frame->Selection()
.ComputeVisibleSelectionInDOMTreeDeprecated()
.IsNone()) {
......@@ -488,7 +488,7 @@ static bool SetSelectionToDragCaret(LocalFrame* frame,
frame->Selection().SetSelectionAndEndTyping(
SelectionInDOMTree::Builder().Collapse(position).Build());
drag_caret =
const VisibleSelection& drag_caret =
frame->Selection().ComputeVisibleSelectionInDOMTreeDeprecated();
range = CreateRange(drag_caret.ToNormalizedEphemeralRange());
}
......@@ -652,7 +652,8 @@ bool DragController::ConcludeEditDrag(DragData* drag_data) {
return false;
}
} else {
if (SetSelectionToDragCaret(inner_frame, drag_caret, range, point)) {
if (SetSelectionToDragCaret(inner_frame, drag_caret.AsSelection(), range,
point)) {
DCHECK(document_under_mouse_);
if (!inner_frame->GetEditor().ReplaceSelectionAfterDraggingWithEvents(
element, drag_data, fragment, range,
......@@ -667,7 +668,8 @@ bool DragController::ConcludeEditDrag(DragData* drag_data) {
if (text.IsEmpty())
return false;
if (SetSelectionToDragCaret(inner_frame, drag_caret, range, point)) {
if (SetSelectionToDragCaret(inner_frame, drag_caret.AsSelection(), range,
point)) {
DCHECK(document_under_mouse_);
if (!inner_frame->GetEditor().ReplaceSelectionAfterDraggingWithEvents(
element, drag_data,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment