Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/bind_helpers.h" | 5 #include "base/bind_helpers.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "cc/surfaces/surface.h" | 9 #include "cc/surfaces/surface.h" |
| 10 #include "cc/surfaces/surface_factory.h" | 10 #include "cc/surfaces/surface_factory.h" |
| (...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 618 return static_cast<RenderWidgetHostViewBase*>( | 618 return static_cast<RenderWidgetHostViewBase*>( |
| 619 guest_->GetOwnerRenderWidgetHostView()); | 619 guest_->GetOwnerRenderWidgetHostView()); |
| 620 } | 620 } |
| 621 | 621 |
| 622 void RenderWidgetHostViewGuest::OnHandleInputEvent( | 622 void RenderWidgetHostViewGuest::OnHandleInputEvent( |
| 623 RenderWidgetHostImpl* embedder, | 623 RenderWidgetHostImpl* embedder, |
| 624 int browser_plugin_instance_id, | 624 int browser_plugin_instance_id, |
| 625 const gfx::Rect& guest_window_rect, | 625 const gfx::Rect& guest_window_rect, |
| 626 const blink::WebInputEvent* event) { | 626 const blink::WebInputEvent* event) { |
| 627 if (blink::WebInputEvent::isMouseEventType(event->type)) { | 627 if (blink::WebInputEvent::isMouseEventType(event->type)) { |
| 628 host_->ForwardMouseEvent( | 628 // The mouse events are subject to whatever CSS transforms |
| 629 *static_cast<const blink::WebMouseEvent*>(event)); | 629 // applied on the BrowserPlugin. This causes the reported position of |
| 630 // 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.
| |
| 631 // hack, the position is calculated here and reported to the | |
| 632 // BrowserPluginGuest. | |
| 633 const blink::WebMouseEvent& mouse_event = | |
| 634 static_cast<const blink::WebMouseEvent&>(*event); | |
| 635 // A MouseDown on the ButtonRight could suggest a ContextMenu. | |
| 636 if (guest_ | |
| 637 && mouse_event.type == blink::WebInputEvent::MouseDown | |
| 638 && mouse_event.button == blink::WebPointerProperties::ButtonRight) | |
| 639 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
| |
| 640 gfx::Point(mouse_event.globalX - GetViewBounds().x(), | |
| 641 mouse_event.globalY - GetViewBounds().y())); | |
| 642 host_->ForwardMouseEvent(mouse_event); | |
| 630 return; | 643 return; |
| 631 } | 644 } |
| 632 | 645 |
| 633 if (event->type == blink::WebInputEvent::MouseWheel) { | 646 if (event->type == blink::WebInputEvent::MouseWheel) { |
| 634 host_->ForwardWheelEvent( | 647 host_->ForwardWheelEvent( |
| 635 *static_cast<const blink::WebMouseWheelEvent*>(event)); | 648 *static_cast<const blink::WebMouseWheelEvent*>(event)); |
| 636 return; | 649 return; |
| 637 } | 650 } |
| 638 | 651 |
| 639 if (blink::WebInputEvent::isKeyboardEventType(event->type)) { | 652 if (blink::WebInputEvent::isKeyboardEventType(event->type)) { |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 657 } | 670 } |
| 658 | 671 |
| 659 if (blink::WebInputEvent::isGestureEventType(event->type)) { | 672 if (blink::WebInputEvent::isGestureEventType(event->type)) { |
| 660 host_->ForwardGestureEvent( | 673 host_->ForwardGestureEvent( |
| 661 *static_cast<const blink::WebGestureEvent*>(event)); | 674 *static_cast<const blink::WebGestureEvent*>(event)); |
| 662 return; | 675 return; |
| 663 } | 676 } |
| 664 } | 677 } |
| 665 | 678 |
| 666 } // namespace content | 679 } // namespace content |
| OLD | NEW |