OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/browser_plugin/browser_plugin_guest.h" | 5 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
479 RenderWidgetHostView* owner_rwhv = GetOwnerRenderWidgetHostView(); | 479 RenderWidgetHostView* owner_rwhv = GetOwnerRenderWidgetHostView(); |
480 if (!owner_rwhv) | 480 if (!owner_rwhv) |
481 return relative_point; | 481 return relative_point; |
482 | 482 |
483 gfx::Point point(relative_point); | 483 gfx::Point point(relative_point); |
484 | 484 |
485 // Add the offset form the embedder web contents view. | 485 // Add the offset form the embedder web contents view. |
486 point += | 486 point += |
487 owner_rwhv->TransformPointToRootCoordSpace(guest_window_rect_.origin()) | 487 owner_rwhv->TransformPointToRootCoordSpace(guest_window_rect_.origin()) |
488 .OffsetFromOrigin(); | 488 .OffsetFromOrigin(); |
489 if (embedder_web_contents()->GetBrowserPluginGuest()) { | |
490 // |point| is currently with respect to the top-most view (outermost | |
491 // WebContents). We should subtract a displacement to find the point with | |
492 // resepct to embedder's WebContents. | |
493 point -= owner_rwhv->TransformPointToRootCoordSpace(gfx::Point()) | |
494 .OffsetFromOrigin(); | |
lfg
2017/05/17 18:03:24
Is this plus the transformation above the same as
EhsanK
2017/05/17 18:22:49
Yes exactly.
| |
495 } | |
496 | |
489 return point; | 497 return point; |
490 } | 498 } |
491 | 499 |
492 WebContentsImpl* BrowserPluginGuest::GetWebContents() const { | 500 WebContentsImpl* BrowserPluginGuest::GetWebContents() const { |
493 return static_cast<WebContentsImpl*>(web_contents()); | 501 return static_cast<WebContentsImpl*>(web_contents()); |
494 } | 502 } |
495 | 503 |
496 gfx::Point BrowserPluginGuest::GetScreenCoordinates( | 504 gfx::Point BrowserPluginGuest::GetScreenCoordinates( |
497 const gfx::Point& relative_position) const { | 505 const gfx::Point& relative_position) const { |
498 if (!attached()) | 506 if (!attached()) |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1061 range, character_bounds); | 1069 range, character_bounds); |
1062 } | 1070 } |
1063 #endif | 1071 #endif |
1064 | 1072 |
1065 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) { | 1073 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) { |
1066 if (delegate_) | 1074 if (delegate_) |
1067 delegate_->SetContextMenuPosition(position); | 1075 delegate_->SetContextMenuPosition(position); |
1068 } | 1076 } |
1069 | 1077 |
1070 } // namespace content | 1078 } // namespace content |
OLD | NEW |