[webkit-gtk] hovering-over-link signal and HitTestResult in WebKit2 API

Carlos Garcia Campos cgarcia at igalia.com
Thu Feb 2 05:56:20 PST 2012


El vie, 27-01-2012 a las 06:11 -0800, Martin Robinson escribió:
> On Fri, Jan 27, 2012 at 5:56 AM, Carlos Garcia Campos
> <cgarcia at igalia.com> wrote:
> > That also made me think about how to expose HitTestResult in the API. In
> > WebKit1 it's only used by webkit_web_view_get_hit_test_result() (it
> > sounds like a getter, but it actually performs a hit test and returns
> > the result). In WK2 there's no API to make a hit test from the UI
> > process, and I'm not sure it's actually needed. However, I think a
> > HitTestResult object can be useful in the API, probably with a different
> > name WebKitWebElement or something like that. This could be passed as an
> > argument to the WebKitWebView::hovering-over-element signal, and it
> > could be used for the context menu API.
> 
> I think this is a good idea, but we should use a name that reflects
> the fact that it's not an actual DOM object.

Both ChromeClient and C API use mouseDidMoverOverElement and they
receive a HitTestResult. We don't have DOM bindings in wk2 and even if
we had some day, the name would be something like WebKitDOMElement. Mac
exposes mouseDidMoveOverElement in the UI delegate using a dictionary
that contains hit test result information. So I still propose to use:

WebKitWebView::element-hovered: signal that receives the mouse modifiers
and a WebKitWebElement object.

WebKitWebElement could be similar to HitTestResult in wk1 API:

WebKitWebElementContext: with flags DOCUMENT, LINK, IMAGE, MEDIA,
SELECTION, EDITABLE

gboolean webkit_web_element_is_document();
gboolean webkit_web_element_is_link();
gboolean webkit_web_element_is_image();
gboolean webkit_web_element_is_media();
gboolean webkit_web_element_is_selection();
gboolean webkit_web_element_is_editable();

That just checks the flags, so more than one can return TRUE for the
same element like an image that is a link.

const gchar *webkit_web_element_get_link_uri();
const gchar *webkit_web_element_get_link_title();
const gchar *webkit_web_element_get_link_label();
const gchar *webkit_web_element_get_image_uri();
const gchar *webkit_web_element_get_media_uri();

What do you think?

-- 
Carlos Garcia Campos
http://pgp.rediris.es:11371/pks/lookup?op=get&search=0xF3D322D0EC4582C3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.webkit.org/pipermail/webkit-gtk/attachments/20120202/1addfaab/attachment.bin>


More information about the webkit-gtk mailing list