[webkit-gtk] Media controls implementation - possibilites

Zan Dobersek zandobersek at gmail.com
Sun Aug 2 04:49:58 PDT 2009

Though there is already a bug report existing for this matter[1], I'm
posting this to webkit-gtk list to present the problem to a broader

Gtk port currently does not implement media controls. These are
necessary for control of HTML5 audio and video elements when a document
does not provide custom controlling.

What actually needs to be done is to implement
RenderThemeGtk::paintMedia* functions. These paint images of play,
pause, mute, unmute, forward, backward, fullscreen buttons and the
slider track and thumb into given rects. While slider track and thumb
will probably need to be drawn through graphics context, there are
possibilities to draw the buttons with various images.

Possibilities for implementation as I've found them:
(1) Stock images
There are stock images available in the Gtk+ library for every button
that we need to draw _except_ mute and unmute buttons. While the latter
two can be found in some other icon themes, this is not guaranteed - it
is not assured these two icons will be available.
Getting stock images into WebCore::Image container can also get tricky.
>From this point of view, there are easier methods.

(2) Icons from (default) icon theme
This way, a nice integration into GNOME is guaranteed. But again, it is
not assured all the proper icons are available for use.

(3) Icons distributed with WebKit
We could produce a set of necessary icons and ship it with WebKit. This
way, we are guaranteed to have all the proper icons we need. They can
then easily be loaded with Image::loadPlatformResource and drawn. But no
integration is available with the environment, if that is actually

(4) On-the-go drawing
In this method, all the icons would be drawn through GraphicsContext's
functions. It is perhaps the most simple way of doing it. Qt port draws
it's controls this way[2].

In my opinion, the way to go is (3). 16x16 icons are not very
memory-consuming, and we also get the coolish look with all the icons
being available. With that covered, just a nice slider track and thumb
are needed to fulfill the look.

What I'd like is others' opinion - comments, discussion and ideas are

Zan Dobersek

[1] https://bugs.webkit.org/show_bug.cgi?id=26304
[2] http://labs.trolltech.com/blogs/2008/05/13/top-secret-hush-hush/

More information about the webkit-gtk mailing list