After finishing some loose ends in a remarkable place I found in Bairro Alto the GObject DOM bindings are in good enough shape to start doing some damage in this world (queue video that probably won’t appear in Planet GNOME, click into my blog to see it):
What you just (hopefully) saw is a GTK+ button that, when clicked, gets all the links from its cousin WebKitWebView and makes them do a small bounce, all with the DOM APIs you know and hate^Wlove exported through GObject.
For instance, to get all links simply call webkit_dom_document_get_links on the WebKitDOMDocument associated with the WebView, which will return a WebKitDOMHTMLCollection. Now we just iterate through the elements, get the WebKitDOMCSSStyleDeclaration associated to each one, and set the CSS properties we want on each one. Simple as that! No “evaluate this string as JavaScript”, and no using the JavaScript bindings through JavaScriptCore. In fact, since we are generating our own bindings instead of using the JavaScript ones, we can get the proper semantics for GObject toolkits instead of having to live with the decisions other people made for other languages and contexts. You can see the code snippet here; I use a two-step animation instead of using the full-blown css transitions because of a small technical issue that I didn’t want to fix before pushing this post, but of course we should be doing it right in the future. In fact, we should create proper APIs for CSS animations in general, not too different from what you have in, say, Clutter.
Most of the code for this is already in Webkit trunk, and now that the initial phase of the work is done I keep improving the code incrementally and pushing the patches to bugzilla, where my compadre Gustavo promptly reviews them. Now if you’ll excuse me I’ll go to expose all events as glib signals on the DOM objects, watch this space (or the upstream bug) for more updates. Happy hacking!
Can’t wait to get my hands on this for Evolution. Thanks dude!
Awesome stuff dude!
That cheese plate looks very delicious