Further to my earlier post, there has been some more talk over at the Metacity blog about styling windows with CSS. There seem to be a few possible ways to implement this:
- use libccss or plain libcroco for parsing, render it ourselves in GTK. Not as crazy as it sounds because we’re only interested in a fairly small subset of CSS. We could make this an external library and let other window managers use it as well.
- use libccss for parsing rendering; this doesn’t yet work entirely
- use nbtk for rendering; this doesn’t yet work entirely
- use WebKit for rendering. This would save work with rendering, but I’m a little wary of embedding a browser into the window manager.
I was also concerned that using WebKit would not allow us to restrict the CSS, which is something we need to do a great deal:
- reinterpret all URLs to prevent themes from calling home, and to provide pixmap colourisation
- allow references to theme colours (“GtkForegroundSelected”, etc)
- not allow dangerous properties to be set at all (it should not be possible for a theme to set min-height on the frame, etc)
Now someone from KDE says that this could be a great opportunity for cross-desktop interoperability: Metacity and Kwin could share theme formats. But apparently KWin already pulls in a WebKit dependency for other reasons, and the KDE person is planning to implement using WebKit anyway, and thinks that we should too.
I don’t know WebKit very well (and searching isn’t helping), but I thought some of you probably do. So what I would like to know is:
- Am I being over-cautious about the footprint implications of an optional dependency on WebKit?
- Is it possible to heavily vet the CSS which WebKit reads? I know WebKit allows host applications to modify the document in memory, but how easy is it to modify the styles?