DropHelper: Use correct root location for DropEvent

For some reason, all DropHelper methods pass the location in the target
view's coordinate system as both the event's location and its root
location. We have the location in the root view's coordinate system
available in all these methods, and we should pass that as the root
location.

This is necessary for e.g. fallback tab dragging, which relies on drag
events' root location being correct.

Bug: 40238145
Change-Id: I1ac578e28000476f8402b0a09a74800bc4b96d72
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5692091
Commit-Queue: Max Ihlenfeldt <max@igalia.com>
Reviewed-by: Keren Zhu <kerenzhu@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1326561}
diff --git a/ui/views/widget/drop_helper.cc b/ui/views/widget/drop_helper.cc
index cf96e65e..1db650c 100644
--- a/ui/views/widget/drop_helper.cc
+++ b/ui/views/widget/drop_helper.cc
@@ -100,7 +100,8 @@
   View* root_view = drop_view->GetWidget()->GetRootView();
   View::ConvertPointToTarget(root_view, drop_view, &view_location);
   ui::DropTargetEvent drop_event(data, gfx::PointF(view_location),
-                                 gfx::PointF(view_location), drag_operation);
+                                 gfx::PointF(root_view_location),
+                                 drag_operation);
   auto output_drag_op = ui::mojom::DragOperation::kNone;
   auto drop_cb = drop_view->GetDropCallback(drop_event);
   std::move(drop_cb).Run(drop_event, output_drag_op,
@@ -126,7 +127,8 @@
   View* root_view = drop_view->GetWidget()->GetRootView();
   View::ConvertPointToTarget(root_view, drop_view, &view_location);
   ui::DropTargetEvent drop_event(data, gfx::PointF(view_location),
-                                 gfx::PointF(view_location), drag_operation);
+                                 gfx::PointF(root_view_location),
+                                 drag_operation);
 
   auto drop_view_cb = drop_view->GetDropCallback(drop_event);
   if (!drop_view_cb)
@@ -202,7 +204,7 @@
   gfx::Point target_view_location(root_view_location);
   View::ConvertPointToTarget(root_view_, target_view_, &target_view_location);
   ui::DropTargetEvent enter_event(data, gfx::PointF(target_view_location),
-                                  gfx::PointF(target_view_location),
+                                  gfx::PointF(root_view_location),
                                   drag_operation);
   target_view_->OnDragEntered(enter_event);
 }
@@ -216,7 +218,7 @@
   gfx::Point target_view_location(root_view_location);
   View::ConvertPointToTarget(root_view_, target_view_, &target_view_location);
   ui::DropTargetEvent enter_event(data, gfx::PointF(target_view_location),
-                                  gfx::PointF(target_view_location),
+                                  gfx::PointF(root_view_location),
                                   drag_operation);
   return target_view_->OnDragUpdated(enter_event);
 }