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, ...@@ -712,12 +712,13 @@ bool DragController::CanProcessDrag(DragData* drag_data,
if (!local_root.ContentLayoutObject()) if (!local_root.ContentLayoutObject())
return false; return false;
PhysicalOffset point = local_root.View()->ConvertFromRootFrame( const PhysicalOffset point_in_local_root =
PhysicalOffset::FromFloatPointRound(drag_data->ClientPosition())); local_root.View()->ConvertFromRootFrame(
PhysicalOffset::FromFloatPointRound(drag_data->ClientPosition()));
HitTestLocation location(point); const HitTestResult result =
HitTestResult result = local_root.GetEventHandler().HitTestResultAtLocation(
local_root.GetEventHandler().HitTestResultAtLocation(location); HitTestLocation(point_in_local_root));
if (!result.InnerNode()) if (!result.InnerNode())
return false; return false;
...@@ -732,9 +733,16 @@ bool DragController::CanProcessDrag(DragData* drag_data, ...@@ -732,9 +733,16 @@ bool DragController::CanProcessDrag(DragData* drag_data,
return false; return false;
} }
if (did_initiate_drag_ && document_under_mouse_ == drag_initiator_ && if (did_initiate_drag_ && document_under_mouse_ == drag_initiator_) {
result.IsSelected(location)) const PhysicalOffset point_in_frame =
return false; result.InnerNode()
->GetDocument()
.GetFrame()
->View()
->ConvertFromRootFrame(PhysicalOffset::FromFloatPointRound(
drag_data->ClientPosition()));
return !result.IsSelected(HitTestLocation(point_in_frame));
}
return true; return true;
} }
......
...@@ -69,7 +69,7 @@ selection_test( ...@@ -69,7 +69,7 @@ selection_test(
// can't get to. This (x, y) *should* be over the list marker. // can't get to. This (x, y) *should* be over the list marker.
eventSender.mouseMoveTo( eventSender.mouseMoveTo(
selection.computeLeft(ul) + 18, selection.computeLeft(ul) + 18,
selection.computeTop(li) + 3); selection.computeTop(li) + li.offsetHeight / 2);
eventSender.mouseUp(); 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