Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5080)

Unified Diff: chrome/browser/ui/cocoa/renderer_context_menu/render_view_context_menu_mac.mm

Issue 678653003: Remove Downcasting RVContextMenuBase in ContextMenuDeleagate implementations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync @toot Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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) {

Powered by Google App Engine
This is Rietveld 408576698