Chromium Code Reviews| Index: content/browser/frame_host/render_widget_host_view_guest.cc |
| diff --git a/content/browser/frame_host/render_widget_host_view_guest.cc b/content/browser/frame_host/render_widget_host_view_guest.cc |
| index f5a04c4cc6fb1e2c152e847173fabf94ac7f013d..ad7235a0d78d6d476bd006150d8b732ec6d8208d 100644 |
| --- a/content/browser/frame_host/render_widget_host_view_guest.cc |
| +++ b/content/browser/frame_host/render_widget_host_view_guest.cc |
| @@ -625,8 +625,21 @@ void RenderWidgetHostViewGuest::OnHandleInputEvent( |
| const gfx::Rect& guest_window_rect, |
| const blink::WebInputEvent* event) { |
| if (blink::WebInputEvent::isMouseEventType(event->type)) { |
| - host_->ForwardMouseEvent( |
| - *static_cast<const blink::WebMouseEvent*>(event)); |
| + // The mouse events are subject to whatever CSS transforms |
| + // applied on the BrowserPlugin. This causes the reported position of |
| + // ContextMenu from the guest renderer become potentially incorrect. As a |
|
wjmaclean
2015/08/17 13:05:23
-> "... renderer to potentially be incorrect."
Ehsaan
2015/08/17 14:09:12
Done.
|
| + // hack, the position is calculated here and reported to the |
| + // BrowserPluginGuest. |
| + const blink::WebMouseEvent& mouse_event = |
| + static_cast<const blink::WebMouseEvent&>(*event); |
| + // A MouseDown on the ButtonRight could suggest a ContextMenu. |
| + if (guest_ |
| + && mouse_event.type == blink::WebInputEvent::MouseDown |
| + && mouse_event.button == blink::WebPointerProperties::ButtonRight) |
| + guest_->SetContextMenuPosition( |
|
wjmaclean
2015/08/17 13:05:23
Will the transformation ever be more than just a t
Ehsaan
2015/08/17 14:09:12
This translation is based on globalX/Y which is su
|
| + gfx::Point(mouse_event.globalX - GetViewBounds().x(), |
| + mouse_event.globalY - GetViewBounds().y())); |
| + host_->ForwardMouseEvent(mouse_event); |
| return; |
| } |