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 6c1364db24f3693e8ab44879629892df971df92f..9dd691f3ad66c3a03858fdc9c27b94ca2df9cb9d 100644 |
--- a/content/browser/renderer_host/render_view_host_impl.cc |
+++ b/content/browser/renderer_host/render_view_host_impl.cc |
@@ -690,9 +690,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( |
@@ -700,8 +702,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() { |
@@ -712,17 +716,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() { |
@@ -1391,4 +1396,12 @@ void RenderViewHostImpl::RenderViewReady() { |
delegate_->RenderViewReady(this); |
} |
+gfx::Point RenderViewHostImpl::ConvertDIPToViewport(const gfx::Point& point) { |
+ // The point in guest view is already converted. |
+ if (!render_widget_host_->scale_input_to_viewport()) |
+ return point; |
+ float scale = GetWidget()->GetView()->current_device_scale_factor(); |
+ return gfx::Point(point.x() * scale, point.y() * scale); |
+} |
+ |
} // namespace content |