Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(787)

Unified Diff: content/browser/renderer_host/render_view_host_impl.cc

Issue 1605143003: [UseZoomForDSF] Support drag&drop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_view_host_impl.cc
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc
index 4672bccd6fc703e014b5b2d022763a8adba569f0..b5293c7771b40714c826e1456138ef5f06780da8 100644
--- a/content/browser/renderer_host/render_view_host_impl.cc
+++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -692,9 +692,11 @@ void RenderViewHostImpl::DragTargetDragEnter(
.append(register_name));
}
- Send(new DragMsg_TargetDragEnter(GetRoutingID(), filtered_data, client_pt,
- screen_pt, operations_allowed,
- key_modifiers));
+ const gfx::Point client_pt_in_viewport = convertDipToViewport(client_pt);
+
+ Send(new DragMsg_TargetDragEnter(GetRoutingID(), filtered_data,
+ client_pt_in_viewport, screen_pt,
+ operations_allowed, key_modifiers));
}
void RenderViewHostImpl::DragTargetDragOver(
@@ -702,8 +704,10 @@ void RenderViewHostImpl::DragTargetDragOver(
const gfx::Point& screen_pt,
WebDragOperationsMask operations_allowed,
int key_modifiers) {
- Send(new DragMsg_TargetDragOver(GetRoutingID(), client_pt, screen_pt,
- operations_allowed, key_modifiers));
+ const gfx::Point client_pt_in_viewport = convertDipToViewport(client_pt);
+ Send(new DragMsg_TargetDragOver(GetRoutingID(), client_pt_in_viewport,
+ screen_pt, operations_allowed,
+ key_modifiers));
}
void RenderViewHostImpl::DragTargetDragLeave() {
@@ -714,17 +718,18 @@ void RenderViewHostImpl::DragTargetDrop(
const gfx::Point& client_pt,
const gfx::Point& screen_pt,
int key_modifiers) {
- Send(new DragMsg_TargetDrop(GetRoutingID(), client_pt, screen_pt,
+ const gfx::Point client_pt_in_viewport = convertDipToViewport(client_pt);
+ Send(new DragMsg_TargetDrop(GetRoutingID(), client_pt_in_viewport, screen_pt,
key_modifiers));
}
void RenderViewHostImpl::DragSourceEndedAt(
int client_x, int client_y, int screen_x, int screen_y,
WebDragOperation operation) {
- Send(new DragMsg_SourceEnded(GetRoutingID(),
- gfx::Point(client_x, client_y),
- gfx::Point(screen_x, screen_y),
- operation));
+ const gfx::Point client_pt_in_viewport =
+ convertDipToViewport(gfx::Point(client_x, client_y));
+ Send(new DragMsg_SourceEnded(GetRoutingID(), client_pt_in_viewport,
+ gfx::Point(screen_x, screen_y), operation));
}
void RenderViewHostImpl::DragSourceSystemDragEnded() {
@@ -1393,4 +1398,9 @@ void RenderViewHostImpl::RenderViewReady() {
delegate_->RenderViewReady(this);
}
+gfx::Point RenderViewHostImpl::convertDipToViewport(const gfx::Point& point) {
+ float scale = GetWidget()->GetView()->current_device_scale_factor();
+ return gfx::Point(point.x() * scale, point.y() * scale);
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698