WebCore:
[WebKit-https.git] / WebKit / win / WebView.cpp
index e84737314cd929e81483c219bc90d90b2216cac4..6770ab93ff4cd9cddd8e874ebf9cee05eb99241c 100644 (file)
@@ -1012,10 +1012,12 @@ bool WebView::handleContextMenuEvent(WPARAM wParam, LPARAM lParam)
     // not run.
     m_page->contextMenuController()->clearContextMenu();
 
-    Frame* focusedFrame = m_page->focusController()->focusedOrMainFrame();
-    focusedFrame->view()->setCursor(pointerCursor());
+    HitTestResult result = m_page->mainFrame()->eventHandler()->hitTestResultAtPoint(IntPoint(coords.x, coords.y), false);
+    Frame* targetFrame = result.innerNonSharedNode() ? result.innerNonSharedNode()->document()->frame() : m_page->focusedOrMainFrame();
+
+    targetFrame->view()->setCursor(pointerCursor());
     PlatformMouseEvent mouseEvent(m_viewWindow, WM_RBUTTONUP, wParam, lParam);
-    bool handledEvent = focusedFrame->eventHandler()->sendContextMenuEvent(mouseEvent);
+    bool handledEvent = targetFrame->eventHandler()->sendContextMenuEvent(mouseEvent);
     if (!handledEvent)
         return false;