The open-source WebKit HTML rendering engine is rapidly gaining ground on the Linux platform where it is increasingly being adopted by conventional desktop applications for content display. Ongoing efforts to facilitate tighter WebKit integration are opening the door for developing rich Internet applications on Linux with the open-source GTK and Qt development toolkits.

WebKit in GTK



Development on the GTK WebKit port is progressing at a very impressive pace. We have previously looked at several noteworthy experiments related to the port, including a GStreamer-based HTML5 video element implementation, and WebKit backend support for web browsers on Maemo, Epiphany, and OLPC. These tests demonstrate the increasing efficacy of the GTK WebKit port in the context of a conventional browser, but there are also many other fascinating experiments that reveal additional contexts in which the GTK WebKit port has value.

GTK WebKit developer Alp Toker published slides last week from his presentation at the Free and Open Source Software Developers' European Meeting (FOSDEM). The presentation discusses prospects for developing hybrid desktop/web applications with WebKit and GTK. The project aims to create a robust GObject-based API that makes WebKit trivially easy to use in desktop applications. Bindings are already available for several programming languages, including C#, Python, and Vala.

Embedding a WebKit renderer in a GTK application is as easy as instantiating a WebView and packing it in a GTK ScrolledWindow or other container. In Python, Toker's slides note, this can be done in only a dozen lines of code. The WebView object, which is similar to a GtkTextView, provides full support for both rich content editing and display. Development efforts that are currently in progress will provide a full GObject-based API for programmatic manipulation of the DOM, making it easy for applications to control and modify content in embedded HTML views. It will also be possible to expose internal application functionality through JavaScript so that it can be used inside of the view.

WebKit has already been adopted experimentally by several GTK-based desktop applications that are widely used on the Linux platform. Developers report that using WebKit in Yelp, GNOME's documentation browser, led to a noticeable decrease in application startup time. Pidgin developer Sean Egan is working on creating a plugin for the instant messaging client that replaces that conventional message view with one based on WebKit that can even use themes from Adium. WebKit in Pidgin offers a much richer and more flexible user interface.

WebKit in Qt



One of the cool features we examined when we took our first look at Qt 4.4 last year is the QWebView, a WebKit rendering component that wrapped in a Qt widget API with full support for conventional signals and properties. A whitepaper published by Trolltech provides a lot of insight into the robust technical capabilities of Qt's WebKit widget.

A particularly impressive feature is support for integrating regular native Qt widgets directly into QWebView HTML layouts. This makes it possible to seamlessly interweave web content into Qt desktop applications. Qt's meta-object system handles binding so that native widgets are accessible through JavaScript and the contents of the QWebView can be manipulated through native code. Trolltech also plans to create a QWidget subclass which implements the Netscape plugin API so that Java applets, Flash movies, and other similar components can be embedded directly in regular Qt applications.

Following Nokia's recent acquisition of Trolltech, the developers have been working to increase the visibility of their WebKit development efforts. Nokia perceives Qt-based WebKit software as having particularly high relevance in mobile environments.

"The Qt WebKit Integration helps developers to combine live web content with mobile and desktop applications," said Trolltech developer Lars Knoll at the Mobile World Congress last month in Barcelona. "This erodes the boundaries between the desktop, mobile phones and the Web. It also enables graphics and Web designers to join developers in making user interfaces more advanced than ever—no matter which device or desktop application you are using."

Knoll is the original creator of KHTML, the KDE-based open-source HTML rendering engine that Apple adopted to serve as the basis for WebKit. For more of his insights, check out the interview with him that our Infinite Loop writers conducted last year at WWDC.

Some demo videos available from the Trolltech web site show off a few the cool QWebView features in action. One of the videos shows how to create a site-specific browser by dragging and dropping a QWebView widget onto a form in the Qt Designer tool. Another video demonstrates how Google maps can be integrated into a desktop application.

A more scalable solution for RIAs



Using embedded WebKit renderers in GTK applications will make it possible to rapidly implement rich media-oriented displays and reuse existing web content in destkop applications. There are obviously many contexts where rich Internet applications are a compelling and much-needed solution.

When we took a close look this morning at Adobe AIR (which also heavily uses WebKit), we noted that its lack of support for exposing native libraries through the runtime imposes serious limitations on scalability. Using embedded WebKit components in native GTK and Qt applications is an approach that offers more flexibility and permits broad use of native libraries.

It is also worth noting that Qt (and GTK to a lesser extent) is cross-platform compatible and supported on Windows, Mac OS X, and Linux. These toolkits provide a strong open-source alternative to AIR that supplies adequate portability and also offer a broader and more robust collection of widgets and tools for conventional desktop software development. As these competing solutions for rich Internet application development become more mature, they will likely influence some significant changes in the way that developers create software. The expanding spectrum of available tools and solutions for this kind of development is a very promising sign of things to come.