Interviewed by Christian Schaller
Developing WebKit: An interview with Gustavo Noronha Silva
Published on 4th of January 2012
WebKit, the open source HTML rendering engine, has quickly grown to become the leading force in mobile and embedded browsers and thanks to browsers such as Google Chrome, Apple's Safari and GNOME's Epiphany it is also a popular choice on the desktop. In this interview we talk with Collabora's leading WebKit expert Gustavo Noronha Silva about WebKit and some of the work Collabora has been doing around the project.
This is the third in a series of interviews we are posting about some of the technologies we work on at Collabora. The previous interviews are with Wim Taymans about GStreamer and Youness Alaoui about Farstream.
The goal of these interviews is to help inform our customers and partners on what is happening with some of the technologies which Collabora offers support and open source consulting services around and at the same time let everyone get to know some of the talented people working at Collabora a little better.
For those who don't know you Gustavo, can you tell us a little about yourself?
I've been working for Collabora for almost 3 years now! I'm a somewhat atypical Brazilian who doesn't really like Carnival or Soccer too much, but I'm a big fan of Brazil, its diversity, weather and culinary. I'm 28 years old. I was born and live in Belo Horizonte, the capital of the south-eastern state of Minas Gerais, famous for its hills and cheese. I love reading, hacking, playing strategy and role playing games. I have been involved quite a bit in debating politics, too.
I'm a huge fan of the Free Software movement, and a passionate advocate. I've been involved with Debian development since 2000, and became an official developer in early 2001. GNOME has been my desktop of choice from the day I got a fast enough computer to run it (I was running console only until some time around 2001, because I only had a 486).
About 11 years of Debian involvement then, what was your path into Debian and open source development?
Well, back in 1999 I wanted to learn how to write computer programs, and I got to know of the existence of the C programming language. Then I discovered that there was this "Linux" operating system that came with a C compiler by default, so I got first the Conectiva distribution, and then later the Debian distribution installed.
I started teaching myself C with help of material provided online by the local University's electrical engineering department. Somewhere down the road I started reading more about the Debian Project and the Free Software movement, and fell in love with them. I then started contributing, translating, and by 2001 I had become a Debian Developer.
So what was the first open source application you either wrote from scratch or contributed code to?
This is a funny story. After learning a bit of C and figuring out how to list directories and deal with files from the ls source code (the course I was following didn't include those) I wrote a very simple log colouring tool. The initial version was very bad - I didn't know much yet about memory allocation, for instance, so the way the configuration file was used was full of fail. Turns out someone thought it was nice enough to package it for HP-UX, and it's up there on the Interwebs to this date!
More well-known is my second one, the gksu tool, which is thankfully being fully replaced by a better solution these days (PolicyKit, looking at you =D).
You are one of the leading Webkit experts at Collabora, how did you originally become involved with Webkit development?
I was working as a web developer, but at the other end point of the communication, the browser, looked like a much more interesting thing to be working on. I had been using Epiphany, GNOME's web browser since the days when it was called Galeon, and started looking for ways to contribute to it.
A few months earlier Xan Lopez, who had become Epiphany's maintainer, announced the browser was going to switch to WebKit as its web engine. I tried the WebKit branch and noticed it was lacking a lot of basic features, so I started looking at how to use WebKitGTK+ to help further the port. It turned out WebKitGTK+ itself was still very immature in many aspects, and it was only logical, then, to start working on it as a way to improve my browser-of-choice's future. After about one year both Xan and myself had become reviewers and co-maintainers of the GTK+ port of WebKit.
Working on Webkit, which is a very successful project with a lot of corporate involvement. and with Google and Apple both relaying on Webkit for their own browsers, how easy is it being part of the Webkit ecosystem?
It's surprisingly easy, and I think that's what makes it a very successful project, in part! While Apple and Google of course have their own agendas and priorities and drive it quite heavily to further them, by virtue of having many people working on the project, the people involved are very conscious of how important being open, respectful and friendly towards smaller teams like ours is to the future of the project and the larger Web ecosystem.
We have received a large amount of help from people at both Google and Apple with everything from patch reviews to maintaining parts of our infrastructure for us, for quite a while. The first early warning system bot the GTK+ port used, for instance, was donated and maintained by Google developers for quite some time!
Can you tell us a little about whats happening in the world of WebKit currently from a development standpoint? What are the focus for the project overall?
WebKit is a very diverse project, so I have a hard time identifying what are the most relevant news at a given point in time; there is a lot of movement in implementing proposals and new standards, as always, but perhaps the biggest structural project ongoing at the moment is the migration to what we call WebKit2 - a new interface between the WebCore engine and the port-specific API layers.
WebKit2 borrows the idea of a multi-process architecture that Chrome introduced, but pushes it down the stack, so that it can be almost transparent to the API and its users. Mac, Qt and GTK+ are already very advanced in their efforts to adopt the new infrastructure.
Ok, and what is your personal focus currently in regards to Webkit development?
I have been working a lot at the Clutter port of WebKit, which is pretty much WebKitGTK+'s sibling - they share a lot of code, and will likely be merged into a single port if plans of GTK+ and Clutter themselves merging are carried through. We are working hard on using Clutter's power to implement the Accelerated Compositing infrastructure, that allows us to accelerate CSS transformations and animations using Clutter actors to represent and animate layers. I have also been working on getting more involved on the WebKit2 efforts.
So on to an easy one, which web browser do you use yourself these days?
My main browser is Epiphany for almost as long as Debian is my distro. I started using it when it was first released as Galeon, back in the early 2000s, and followed the fork when it became Epiphany.
WebKit tends to push the limits of the software stack because of its size, complexity and because it needs to deal with a huge amount of existing pages and servers. In a way, it tends to force us to keep an eye for corner cases in pretty much every piece of software. In the GNOME project we are used to being able to say "you should just not do x", when someone comes up with a bright new way to break an API, but on the Web we don't have a choice - people (often big ones like Apple and Google) are already doing things they ideally shouldn't, and you have to deal with it if you want to interoperate.
I use to joke that if Firefox does it we have to support it. For one example of a piece of our stack that has seen a great improvement is libsoup, the http library. Being used by WebKitGTK+ has been a great way to figure out where libsoup falls short in terms of interoperability and performance. It has improved quite a bit from when we first decided to use it unconditionally for WebKitGTK+ (we used to have a curl backend).
On the point of hybrid applications, HTML5 based development seems to be the latest trend with standard proposals such as WebRTC continuing to expand the scope of what an HTML5 application can do. Is HTML5 the future of all user interface development or do you feel it has more targetted future?
That's a very good question which I think lots of smart people are trying to figure out. I think there's a huge potential to be explored in HTML and CSS for interface design and implementation - it's a very rich, flexible and powerful technology that is quickly becoming ubiquitous; the web has quickly transformed itself from a very limited tool to a tool that defies even the most advanced technologies we have on, for instance, the GNOME platform.
So I think it will indeed bite a big chunk of user interface design both in quantity and relevance. But there are two things to consider: regular UI toolkits aren't going anywhere for quite a while; they are still the best tools for some jobs. Also, we're at a point in time where we have a huge and very flexible base; there is clearly a need to build coherent, predictable experiences for the new generation of applications based on the web. So I believe we will be seeing lots of toolkits, similar to what, say, jqueryui is today being built on top of this very flexible base.
How are things looking in terms of native WebRTC support in WebKit? Is there a general consensus around the idea and for putting it into Webkit?
Things seem to be looking pretty good. There hasn't been any opposition, and patches have already been landed to get the work started. Google came up with an initial implementation and Ericsson suggested a more modular approach that would make it easier to implement the feature for all the ports later on - and used our GTK+ port as the base for their development efforts. We have some Collaborans working on the feature as well, so I expect we'll see great results =).
The Collaborans working on WebRTC tell me their goal is to have it working upstream towards the beginning of the second quarter of 2012, so if they're able to keep focusing on it until then we should have something running on WebKitGTK+ =)
Collabora has been working on porting WebKit to use Clutter, what does such a port entail and what are the advantages of using Clutter as a WebKit backend?
Most of the base of the Clutter port is really the same as the GTK+ one. There's a lot of code that's shared. Building the Clutter port has been essentially implementing those things which rely on GTK+, such as providing a widget to be added to the application, getting things that are painted by WebCore to the screen in an effective way, dealing with plugin window requests, and so on.
The biggest advantage of using Clutter from a performance point of view is it provides us with a lot of ways to accelerate the way the page is composed and animations are performed - in addition to being accelerated by the GPU, Clutter animations are able to synchronize their updates with the screen's refresh rate, and thus makes for a smoother animation and less wasteful use of system resources as a result. We are working on making use of those capabilities, and on hopefully also making them available to the WebKitGTK+ port down the road, which should also help us in figuring out how Clutter and GTK+ can be mixed to provide us with the best of two worlds.
From a device maker or software developer perspective, a Clutter port of WebKit is the natural choice if the user interface is being built to use Clutter for transitions and for making the UI more flexible than a toolkit like GTK+ would allow at this point.
Work has been done on integrating GStreamer into some of the WebKit backends to support HTML5 media, how is that effort going and has there been any challenges in terms of using GStreamer with Webkit?
GStreamer has been working as the HTML media backend for the GTK+, Clutter, Qt, EFL ports for quite a while now, and works quite well for most of the web. The main challenges we faced initially were in translating the GStreamer way of working to the expectations of the HTML specification, and after that in making sure any HTTP requests had the necessary cookies/headers. This last part was drastically improved when our Sebastian Dröge wrote a new source element that plugs into WebKit's networking machinery. For the future, we are working on enabling faster video painting by using the Accelerated Compositing infrastructure. Tomeu Visozo has implemented this for the Clutter port already, and I look forward to getting it in the GTK+ port too!
Gustavo Noronha lives in Brazil and works on Debian, GNOME, WebKit and Epiphany. Gustavo is a maintainer for WebKitGTK+ and the libgksu/gksu project, and enjoys working with Python, Django and C. In his spare time, Gustavo likes reading (especially science fiction and fantasy) and playing strategy and video games.