Chromium Code Reviews| Index: content/browser/web_contents/web_drag_source_mac.mm |
| diff --git a/content/browser/web_contents/web_drag_source_mac.mm b/content/browser/web_contents/web_drag_source_mac.mm |
| index fdd46497ad47345bd0149631a2155878443973fc..ad2a9d658f6375fd831f73ca0a9387bbe78171b8 100644 |
| --- a/content/browser/web_contents/web_drag_source_mac.mm |
| +++ b/content/browser/web_contents/web_drag_source_mac.mm |
| @@ -23,6 +23,7 @@ |
| #include "content/browser/download/drag_download_util.h" |
| #include "content/browser/renderer_host/render_view_host_impl.h" |
| #include "content/browser/renderer_host/render_widget_host_impl.h" |
| +#include "content/browser/renderer_host/render_widget_host_view_base.h" |
| #include "content/browser/web_contents/web_contents_impl.h" |
| #include "content/public/browser/content_browser_client.h" |
| #include "content/public/common/content_client.h" |
| @@ -291,12 +292,28 @@ void PromiseWriterHelper(const DropData& drop_data, |
| if (operation == (NSDragOperationMove | NSDragOperationCopy)) |
| operation &= ~NSDragOperationMove; |
| - // TODO(paulmeyer): In the OOPIF case, should |localPoint| be converted to |
| - // the coordinates local to |dragStartRWH_|? |
| + // |localPoint| and |screenPoint| are in the root coordinate space, for |
| + // non-root RenderWidgetHosts they need to be transformed. |
| + gfx::Point transformedPoint = gfx::Point(localPoint.x, localPoint.y); |
| + gfx::Point transformedScreenPoint = gfx::Point(screenPoint.x, screenPoint.y); |
| + static_cast<content::RenderWidgetHostViewBase*>( |
| + contents_->GetRenderWidgetHostView()) |
| + ->TransformPointToCoordSpaceForView( |
| + gfx::Point(localPoint.x, localPoint.y), |
| + static_cast<content::RenderWidgetHostViewBase*>( |
| + dragStartRWH_->GetView()), |
| + &transformedPoint); |
| + static_cast<content::RenderWidgetHostViewBase*>( |
| + contents_->GetRenderWidgetHostView()) |
| + ->TransformPointToCoordSpaceForView( |
| + gfx::Point(screenPoint.x, screenPoint.y), |
| + static_cast<content::RenderWidgetHostViewBase*>( |
| + dragStartRWH_->GetView()), |
| + &transformedScreenPoint); |
|
dcheng
2017/02/01 20:45:31
Is it possible to have more of these utility funct
kenrb
2017/02/02 21:21:03
I have made changes to make the point transformati
|
| contents_->DragSourceEndedAt( |
| - localPoint.x, localPoint.y, screenPoint.x, screenPoint.y, |
| - static_cast<blink::WebDragOperation>(operation), |
| - dragStartRWH_.get()); |
| + transformedPoint.x(), transformedPoint.y(), transformedScreenPoint.x(), |
| + transformedScreenPoint.y(), |
| + static_cast<blink::WebDragOperation>(operation), dragStartRWH_.get()); |
| // Make sure the pasteboard owner isn't us. |
| [pasteboard_ declareTypes:[NSArray array] owner:nil]; |