Image menu is offset by the amount the view is scrolled
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 May 2014 21:17:53 +0000 (21:17 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 May 2014 21:17:53 +0000 (21:17 +0000)
<rdar://problem/16818966> and https://bugs.webkit.org/show_bug.cgi?id=132663

Reviewed by Tim Horton.

* WebCoreSupport/WebContextMenuClient.mm:
(WebContextMenuClient::showContextMenu): Use FrameView::contentsToWindow instead of contentsToRoot,
  and skip the [NSView convertPoint:toView:] step.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@168438 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm

index 6218256..be5700a 100644 (file)
@@ -1,3 +1,14 @@
+2014-05-07  Brady Eidson  <beidson@apple.com>
+
+        Image menu is offset by the amount the view is scrolled
+        <rdar://problem/16818966> and https://bugs.webkit.org/show_bug.cgi?id=132663
+
+        Reviewed by Tim Horton.
+
+        * WebCoreSupport/WebContextMenuClient.mm:
+        (WebContextMenuClient::showContextMenu): Use FrameView::contentsToWindow instead of contentsToRoot, 
+          and skip the [NSView convertPoint:toView:] step.
+
 2014-05-07  Simon Fraser  <simon.fraser@apple.com>
 
         WebKit1 is flashy when compositing layers come and go
index da74f5a..59e1889 100644 (file)
@@ -429,9 +429,8 @@ void WebContextMenuClient::showContextMenu()
         return;
 
     NSView* view = frameView->documentView();
-    IntPoint point = frameView->contentsToRootView(page->contextMenuController().hitTestResult().roundedPointInInnerNodeFrame());
-    NSPoint nsScreenPoint = [view convertPoint:point toView:nil];
-    NSEvent* event = [NSEvent mouseEventWithType:NSRightMouseDown location:nsScreenPoint modifierFlags:0 timestamp:0 windowNumber:[[view window] windowNumber] context:0 eventNumber:0 clickCount:1 pressure:1];
+    IntPoint point = frameView->contentsToWindow(page->contextMenuController().hitTestResult().roundedPointInInnerNodeFrame());
+    NSEvent* event = [NSEvent mouseEventWithType:NSRightMouseDown location:point modifierFlags:0 timestamp:0 windowNumber:[[view window] windowNumber] context:0 eventNumber:0 clickCount:1 pressure:1];
 
     // Show the contextual menu for this event.
     if (NSMenu *menu = contextMenuForEvent(event, view))