How do I get the image title attribute for the image under the cursor in WebKit2GTK

42 views Asked by At

This seems like a really dumb question, but I can't figure out what to Google. I want the xkcd hovertext, which is the title attribute of the img tag. WebKitHitTestResult has get_link_uri, get_link_title, and get_image_uri, but not get_image_title. What do I do?

EDIT: Here is the existing code, from the source for the surf browser, which grabs the link, image, or media URI but ignores the title attribute, if any

void
mousetargetchanged(WebKitWebView *v, WebKitHitTestResult *h, guint modifiers,
    Client *c)
{
    WebKitHitTestResultContext hc = webkit_hit_test_result_get_context(h);

    /* Keep the hit test to know where is the pointer on the next click */
    c->mousepos = h;

    if (hc & OnLink)
        c->targeturi = webkit_hit_test_result_get_link_uri(h);
    else if (hc & OnImg)
        c->targeturi = webkit_hit_test_result_get_image_uri(h);
    else if (hc & OnMedia)
        c->targeturi = webkit_hit_test_result_get_media_uri(h);
    else
        c->targeturi = NULL;

    c->overtitle = c->targeturi;
    updatetitle(c);
}
0

There are 0 answers