Index: chrome/browser/ui/cocoa/renderer_context_menu/render_view_context_menu_mac.mm |
diff --git a/chrome/browser/ui/cocoa/renderer_context_menu/render_view_context_menu_mac.mm b/chrome/browser/ui/cocoa/renderer_context_menu/render_view_context_menu_mac.mm |
index 033c0addd3520806ef32bbabd7413ec64ee17f55..ace76f103f706da8f1d837c6ec79ca51e1fd32d5 100644 |
--- a/chrome/browser/ui/cocoa/renderer_context_menu/render_view_context_menu_mac.mm |
+++ b/chrome/browser/ui/cocoa/renderer_context_menu/render_view_context_menu_mac.mm |
@@ -100,10 +100,8 @@ void RenderViewContextMenuMac::Show() { |
// [NSApp currentEvent] will return a valid event. |
NSEvent* currentEvent = [NSApp currentEvent]; |
NSWindow* window = [parent_view_ window]; |
- NSPoint position = |
- NSMakePoint(params_.x, NSHeight([parent_view_ bounds]) - params_.y); |
- position = [parent_view_ convertPoint:position toView:nil]; |
NSTimeInterval eventTime = [currentEvent timestamp]; |
+ NSPoint position = NSMakePoint(params_.screen_x, params_.screen_y); |
NSEvent* clickEvent = [NSEvent mouseEventWithType:NSRightMouseDown |
location:position |
modifierFlags:NSRightMouseDownMask |
@@ -218,6 +216,14 @@ bool RenderViewContextMenuMac::IsCommandIdEnabled(int command_id) const { |
} |
} |
+void RenderViewContextMenuMac::CalculateScreenCoordinatesInParams() { |
+ NSPoint position = |
+ NSMakePoint(params_.x, NSHeight([parent_view_ bounds]) - params_.y); |
+ position = [parent_view_ convertPoint:position toView:nil]; |
+ params_.screen_x = position.x; |
+ params_.screen_y = position.y; |
+} |
+ |
bool RenderViewContextMenuMac::GetAcceleratorForCommandId( |
int command_id, |
ui::Accelerator* accelerator) { |