WebCore::IntRect InjectedBundleHitTestResult::imageRect() const { WebCore::IntRect imageRect = m_hitTestResult.imageRect(); if (imageRect.isEmpty()) return imageRect; // The image rect in WebCore::HitTestResult is in frame coordinates, but we need it in WKView // coordinates since WebKit2 clients don't have enough context to do the conversion themselves. WebFrame* webFrame = frame(); if (!webFrame) return imageRect; WebCore::Frame* coreFrame = webFrame->coreFrame(); if (!coreFrame) return imageRect; WebCore::FrameView* view = coreFrame->view(); if (!view) return imageRect; return view->contentsToRootView(imageRect); }