WebKitHitTestResult* kit(const WebCore::HitTestResult& result) { guint context = WEBKIT_HIT_TEST_RESULT_CONTEXT_DOCUMENT; GOwnPtr<char> linkURI(0); GOwnPtr<char> imageURI(0); GOwnPtr<char> mediaURI(0); if (!result.absoluteLinkURL().isEmpty()) { context |= WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK; linkURI.set(g_strdup(result.absoluteLinkURL().string().utf8().data())); } if (!result.absoluteImageURL().isEmpty()) { context |= WEBKIT_HIT_TEST_RESULT_CONTEXT_IMAGE; imageURI.set(g_strdup(result.absoluteImageURL().string().utf8().data())); } if (!result.absoluteMediaURL().isEmpty()) { context |= WEBKIT_HIT_TEST_RESULT_CONTEXT_MEDIA; mediaURI.set(g_strdup(result.absoluteMediaURL().string().utf8().data())); } if (result.isSelected()) context |= WEBKIT_HIT_TEST_RESULT_CONTEXT_SELECTION; if (result.isContentEditable()) context |= WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE; return WEBKIT_HIT_TEST_RESULT(g_object_new(WEBKIT_TYPE_HIT_TEST_RESULT, "link-uri", linkURI.get(), "image-uri", imageURI.get(), "media-uri", mediaURI.get(), "context", context, NULL)); }
WebKitHitTestResult* kit(const WebCore::HitTestResult& result) { guint context = WEBKIT_HIT_TEST_RESULT_CONTEXT_DOCUMENT; GOwnPtr<char> linkURI(0); GOwnPtr<char> imageURI(0); GOwnPtr<char> mediaURI(0); WebKitDOMNode* node = 0; WebCore::Frame* targetFrame; WebCore::IntPoint point; if (!result.absoluteLinkURL().isEmpty()) { context |= WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK; linkURI.set(g_strdup(result.absoluteLinkURL().string().utf8().data())); } if (!result.absoluteImageURL().isEmpty()) { context |= WEBKIT_HIT_TEST_RESULT_CONTEXT_IMAGE; imageURI.set(g_strdup(result.absoluteImageURL().string().utf8().data())); } if (!result.absoluteMediaURL().isEmpty()) { context |= WEBKIT_HIT_TEST_RESULT_CONTEXT_MEDIA; mediaURI.set(g_strdup(result.absoluteMediaURL().string().utf8().data())); } if (result.isSelected()) context |= WEBKIT_HIT_TEST_RESULT_CONTEXT_SELECTION; if (result.isContentEditable()) context |= WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE; if (result.innerNonSharedNode()) node = kit(result.innerNonSharedNode()); targetFrame = result.targetFrame(); if (targetFrame && targetFrame->view()) { // Convert document coords to widget coords. point = targetFrame->view()->contentsToWindow(result.point()); } else point = result.point(); return WEBKIT_HIT_TEST_RESULT(g_object_new(WEBKIT_TYPE_HIT_TEST_RESULT, "link-uri", linkURI.get(), "image-uri", imageURI.get(), "media-uri", mediaURI.get(), "context", context, "inner-node", node, "x", point.x(), "y", point.y(), NULL)); }