Commit f8cb9057 authored by lazyboy@chromium.org's avatar lazyboy@chromium.org

Fix <webview> context menu positioning on mac.

Something changed along the way and it seems the coordinate translation
is necessary for mac too.

BUG=406117
Test=Open a <webview> in a chrome app.
Right click on the <webview>, context menu should appear in correct
position, regardless of the position of the <webview> relative to the
embedder.

Review URL: https://codereview.chromium.org/490293003

Cr-Commit-Position: refs/heads/master@{#291438}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@291438 0039d316-1c4b-4281-b951-d872f2087c98
parent 22605793
......@@ -73,12 +73,8 @@ void WebContentsViewGuest::OnGuestInitialized(WebContentsView* parent_view) {
ContextMenuParams WebContentsViewGuest::ConvertContextMenuParams(
const ContextMenuParams& params) const {
#if defined(USE_AURA)
// Context menu uses ScreenPositionClient::ConvertPointToScreen() in aura
// to calculate popup position. Guest's native view
// (platform_view_->GetNativeView()) is part of the embedder's view hierarchy,
// but is placed at (0, 0) w.r.t. the embedder's position. Therefore, |offset|
// is added to |params|.
// We need to add |offset| of the guest from the embedder to position the
// menu properly.
gfx::Rect embedder_bounds;
guest_->embedder_web_contents()->GetView()->GetContainerBounds(
&embedder_bounds);
......@@ -90,9 +86,6 @@ ContextMenuParams WebContentsViewGuest::ConvertContextMenuParams(
params_in_embedder.x += offset.x();
params_in_embedder.y += offset.y();
return params_in_embedder;
#else
return params;
#endif
}
void WebContentsViewGuest::GetContainerBounds(gfx::Rect* out) const {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment