Commit 555ff725 authored by Yoshifumi Inoue's avatar Yoshifumi Inoue Committed by Commit Bot

Make DragController::CanProcessDrag() to pass point in frame to HitTestResult::IsSelected()

This patch changes |DragController::CanProcessDrag()| to pass point in frame
to |HitTestResult::IsSelected(point_in_frame)| instead of point in root,
because |HitTestResult::IsSelected()| calls |LayoutView::HitTest()| which
takes point in frame.

The change of "fast/lists/drag-into-marker.html" verifies this code change.

Change-Id: Ic95b16692fa73ea42ce62acac1fc868efd54a436
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2251607
Auto-Submit: Yoshifumi Inoue <yosin@chromium.org>
Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Commit-Queue: Yoshifumi Inoue <yosin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#780175}
parent 8f1505ba
......@@ -712,12 +712,13 @@ bool DragController::CanProcessDrag(DragData* drag_data,
if (!local_root.ContentLayoutObject())
return false;
PhysicalOffset point = local_root.View()->ConvertFromRootFrame(
const PhysicalOffset point_in_local_root =
local_root.View()->ConvertFromRootFrame(
PhysicalOffset::FromFloatPointRound(drag_data->ClientPosition()));
HitTestLocation location(point);
HitTestResult result =
local_root.GetEventHandler().HitTestResultAtLocation(location);
const HitTestResult result =
local_root.GetEventHandler().HitTestResultAtLocation(
HitTestLocation(point_in_local_root));
if (!result.InnerNode())
return false;
......@@ -732,9 +733,16 @@ bool DragController::CanProcessDrag(DragData* drag_data,
return false;
}
if (did_initiate_drag_ && document_under_mouse_ == drag_initiator_ &&
result.IsSelected(location))
return false;
if (did_initiate_drag_ && document_under_mouse_ == drag_initiator_) {
const PhysicalOffset point_in_frame =
result.InnerNode()
->GetDocument()
.GetFrame()
->View()
->ConvertFromRootFrame(PhysicalOffset::FromFloatPointRound(
drag_data->ClientPosition()));
return !result.IsSelected(HitTestLocation(point_in_frame));
}
return true;
}
......
......@@ -69,7 +69,7 @@ selection_test(
// can't get to. This (x, y) *should* be over the list marker.
eventSender.mouseMoveTo(
selection.computeLeft(ul) + 18,
selection.computeTop(li) + 3);
selection.computeTop(li) + li.offsetHeight / 2);
eventSender.mouseUp();
},
[
......
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