views:

1260

answers:

4

I'm trying to gauge the possibility of a patch to WebKit which would allow all rendered graphics to be rendered onto a fully transparent background.

The desired effect is to render web content without any background at all, it should appear to float over the desktop (or whatever is displayed behind the browser window).

Has anyone seen an app do this? (I can think of some terminal emulators that can.) If anyone has worked inside of WebKit (or possibly Gecko?) do you think it would be possible to do this?


Update: I've come to realize that Mac OSX dashboard widgets use this exact technique. So, this must be possible.


Update 2: I've compiled WebKit on linux and noticed the configure options include:

--enable-dashboard-support
enable Dashboard support default=yes

I'm getting closer. Can anyone help?


Update 3: I continue to find references to this in posts on various related mailing lists.

+1  A: 

Basically you want to be setting the ARGB colour space to be sending to the window manager. Obviously only window managers that support compositing will be able to take advantage of this.

You might want to talk to the screenlet and compiz developers they should be able to help out more.

ewanm89
I agree, that's half of it. But how do I set a background color in the web page so the final rendered image is not made to be always opaque. Is it as simple as setting BODY { opacity: 0; } ?
Mark Renouf
Should be, not sure. The compiz/screenlet guys already do rendering of desktop widget kind of windows.
ewanm89
I think they even use webkit (in fact I think there are already a desktop widget rendering solution for every major rendering engine accept maybe gecko now).
ewanm89
As far as I know screenlets are all straight Gtk/Cairo controlled by Python. I can't find any references to WebKit in their documentation.
Mark Renouf
As far as the web page goes, the opacity property applies to the content of an HTML element as well as its background, so BODY {opacity: 0;} would make everything inside your body tag invisible.I think WebKit supports colour values with alpha transparency though, so you’d do body { background-color: rgba(0,0,0,0); }.I think the default value of background colours is transparent though, so you probably don’t need to set it.
Paul D. Waite
Thanks for the help... your info was a key part of the solution!
Mark Renouf
+2  A: 

Back in Safari 1.3 and 2, there was a hidden debug menu (invoked via the Terminal: defaults write com.apple.Safari IncludeDebugMenu 1) that included a “Use Transparent Window” option.

Not sure if this was a WebKit thing or a Safari thing though.

(In Safari 3, the debug menu seems to have been replaced by the “Develop” menu (enable in Preferences > Advanced) which doesn’t have the transparent window option.)

Paul D. Waite
Thanks for the tip. This put me on the right trail. I bet the call to set_transparent function was controlled by that debug menu option back when it was available.
Mark Renouf
+6  A: 
Mark Renouf
Nice work. I'm not sure CSS3 is necessary for the transparent background; I would have though the old CSS1 `BODY{ background-color: transparent; }` would work. Haven't tried it though.
Paul D. Waite
One thing to note, this does crash when loading plugins like Flash which do not expect ARGB colorspace. The app crashes when they try to draw to the screen across the XEmbed API (X11: BadMatch error).
Mark Renouf
A: 

Just came across this post. I am trying to display a web page with Flash in it, did you ever work out if it was possible to display Flash with a RGBA colormap?

No. I have not delved further yet regarding flash. It still dies within Xlib with "BadMatch". My hope here is there may be some way to force flash to draw with the correct colormap, but perhaps someone from Adbobe could provide some provide some insight here. --(PS: Next time, add a comment on the question or an existing answer instead of adding a new answer.)
Mark Renouf
See Also: http://www.cimitan.com/blog/2008/02/17/rgba-colormap-by-default-in-gtk-call-for-a-coder/
Mark Renouf