[webkit-dev] help with porting
Luka Napotnik
luka.napotnik at gmail.com
Mon May 26 03:14:49 PDT 2008
Hello again Julien.
I've created my own widget from GtkWidget and set the "load-finished"
signal from webkit to a callback which then uses the
webkit_web_frame_show() function from clutter.
The problem is when I save the surface to a PNG image and open it,
there's only black color. I've attached the sources.
Could you please take a quick look at the sources. I really don't know
what I'm doing wrong. I've looked into the clutter code and nothing
special was there that could hint why this is happening to me.
Greets,
Luka
Dne 23.05.2008 (pet) ob 14:11 +0200 je Julien Sanchez zapisal(a):
> Hello Luka,
>
> I used the following path from clutter repository:
> http://svn.o-hand.com/view/clutter/trunk/clutter-webkit/webkit-frame-show-cairo.patch?rev=2031&view=markup
>
> As a rough prototype, I adapted an "OffscreenWebkit" class inspired from
> the ClutterWebkitClass from clutter-webkit
> (http://svn.o-hand.com/view/clutter/trunk/clutter-webkit/clutter-webkit.c?rev=2030&view=markup)
>
> and more especially in load_finished_cb:
>
> static void load_finished_cb (WebKitWebView *web_view,
> WebKitWebFrame *frame,
> OffscreenWebkit *webkit)
> {
> g_print ("load_finished_cb\n");
> OffscreenWebkitPrivate *priv = OFFSCREEN_WEBKIT_GET_PRIVATE(webkit);
> cairo_surface_t *surf = cairo_image_surface_create(CAIRO_FORMAT_RGB24,
> priv->width, priv->height);
> cairo_t* cr_surf = cairo_create(surf);
> cairo_rectangle (cr_surf, 0, 0, priv->width, priv->height);
> webkit_web_frame_show (frame, cr_surf);
> cairo_surface_write_to_png(surf, "webkitsurf.png");
> cairo_surface_destroy(surf);
>
> surf =
> cairo_pdf_surface_create("webkitsurf.pdf", priv->width, priv->height);
> cr_surf = cairo_create(surf);
> cairo_rectangle (cr_surf, 0, 0, priv->width, priv->height);
> webkit_web_frame_show (frame, cr_surf);
> cairo_surface_show_page(surf);
>
> cairo_surface_finish(surf);
> cairo_surface_destroy(surf);
>
> g_main_loop_quit(loop);
> }
>
> It works but I wonder if it is possible to to the same without an X
> server (I just tried with the gtk-directfb port :./configure
> --enable-debug --with-target=directfb but it does not work. I don't know
> how to use directfb and if it will be efficient.
>
> Julien
>
> Le vendredi 23 mai 2008 à 13:32 +0200, Luka Napotnik a écrit :
> > Hello Julien.
> >
> > So you didn't draw the webkitview widget at all but stil managed to get
> > a cairo drawing from the engine? If so, could you please tell me how did
> > you do that?
> >
> > Greets,
> > Luka
> >
> > Dne 23.05.2008 (pet) ob 12:58 +0200 je Julien Sanchez zapisal(a):
> > > Hello,
> > >
> > > I'm interested too in such a port because I'm trying to render simple
> > > html (no plugins or widgets) into image and pdf backends.
> > > For the moment, I made a simple hack (inspired from Clutter project) to
> > > render into a cairo surface. It works from the command line but it still
> > > depends from X (and GTK) and I don't know where to begin to get rid of
> > > these dependencies.
> > >
> > > Julien
> > >
> > > Le jeudi 22 mai 2008 à 09:30 -0700, Mike Emmel a écrit :
> > > > Luka I don't think it makes a difference if your running a lot of
> > > > thumbnails you would want to use gpu's some sort of render
> > > > farm arrangement. My port does it as a result of the design not
> > > > because of a strong desire to render with the cpu.
> > > > Also for real world web pages your going to have problems with plugins
> > > > which depend on X11 and native widget libraries.
> > > >
> > > > So although its possible with my port I can't see a single real
> > > > problem that can be solved with this approach.
> > > > Gtk/DirectFB will work for most pages if you have a flash port. Thats
> > > > the number one stumbling block.
> > > > I did my headless version of DirectFB for example to use the DirectFB
> > > > video provider for the media tags.
> > > > You can take other approaches but you would need to consider at a
> > > > minimum flash and the media tags.
> > > > For complete font support your going to have to use pango or go with
> > > > the QT port but the QT port gets you back
> > > > to the plugin issues if you don't use X11 and a lot of plugins use GTK so....
> > > >
> > > >
> > > > As far as releasing I'm not in control of the release cycle except for
> > > > creating delays as I work on stuff :(
> > > > It should be released however some time this year.
> > > >
> > > > I obviously don't disagree with your idea in fact I worked hard to
> > > > ensure my approach was adaptable so it could be used for these types
> > > > of use cases so someday we will have what your looking for if things
> > > > go well. I actually designed it to work
> > > > with all the legacy use cases I mentioned but be flexible enough to
> > > > transparently drop them when replacements without the legacy X11/Gtk
> > > > dependencies become available. So soon a framework will be available
> > > > to allow you to reverse software
> > > > bloat but I've got no idea if software developers will accept it. I
> > > > built it to deal with the problems that occur with our new embedded
> > > > devices that have capabilities rivaling desktops where bloat is a huge
> > > > problem. The fact it can do what your asking makes me confident the
> > > > design is correct in fact it solves problems your not considering.
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > On Thu, May 22, 2008 at 8:41 AM, Luka Napotnik <luka.napotnik at gmail.com> wrote:
> > > > > Wow really? Could you share the port please. I've been looking for such
> > > > > a port to save the cairo painting to a PNG image.
> > > > >
> > > > > Greets,
> > > > > Luka
> > > > >
> > > > > Dne 22.05.2008 (čet) ob 07:41 -0700 je Mike Emmel zapisal(a):
> > > > >> I actually have a WebKit port with no dependencies but Cairo.
> > > > >>
> > > > >>
> > > > >>
> > > > >> On Thu, May 22, 2008 at 7:02 AM, Luka Napotnik <luka.napotnik at gmail.com> wrote:
> > > > >> > Hello Mike.
> > > > >> >
> > > > >> > What I need is a WebKit port that is independent of any display server
> > > > >> > (X or a framebuffer). I only want to render the page to an image. And
> > > > >> > since cairo is a great graphics library I think It's a good start.
> > > > >> >
> > > > >> > Greets,
> > > > >> > Luka
> > > > >> >
> > > > >> > Dne 22.05.2008 (čet) ob 06:49 -0700 je Mike Emmel zapisal(a):
> > > > >> >> Use the GTK DirectFB backend.
> > > > >> >>
> > > > >> >> I have a memory only system that I really need to get into the trunk.
> > > > >> >> But if you have a graphics card in the system the fb0 will work.
> > > > >> >>
> > > > >> >> Its on my TODO to get the mem only system checked in and I can give
> > > > >> >> you a patch in the mean time if its a issue. Also you can use the vnc driver
> > > > >> >> as a virtual framebuffer.
> > > > >> >>
> > > > >> >> Also some of the XServers should work in a similar way so you can probably
> > > > >> >> play the same trick with the right X11 server.
> > > > >> >>
> > > > >> >>
> > > > >> >> On Thu, May 22, 2008 at 4:21 AM, Luka Napotnik <luka.napotnik at gmail.com> wrote:
> > > > >> >> > Hello.
> > > > >> >> >
> > > > >> >> > I am interested in porting webkit to cairo for off-screen rendering
> > > > >> >> > without a X server. As I cannot find any documents about porting to
> > > > >> >> > other platform I would really appreciate if you could help me with some
> > > > >> >> > hints about porting webkit.
> > > > >> >> >
> > > > >> >> > Greets,
> > > > >> >> > Luka
> > > > >> >> >
> > > > >> >> > _______________________________________________
> > > > >> >> > webkit-dev mailing list
> > > > >> >> > webkit-dev at lists.webkit.org
> > > > >> >> > http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
> > > > >> >> >
> > > > >> >> >
> > > > >> >
> > > > >
> > > > _______________________________________________
> > > > webkit-dev mailing list
> > > > webkit-dev at lists.webkit.org
> > > > http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
> > > >
> > >
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.c
Type: text/x-csrc
Size: 371 bytes
Desc: not available
Url : http://lists.webkit.org/pipermail/webkit-dev/attachments/20080526/029075f5/attachment.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: offscreen-webkit.c
Type: text/x-csrc
Size: 2577 bytes
Desc: not available
Url : http://lists.webkit.org/pipermail/webkit-dev/attachments/20080526/029075f5/attachment-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: offscreen-webkit.h
Type: text/x-chdr
Size: 1621 bytes
Desc: not available
Url : http://lists.webkit.org/pipermail/webkit-dev/attachments/20080526/029075f5/attachment-0002.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: To je digitalno podpisan del =?UTF-8?Q?sporo=C4=8Dila?=
Url : http://lists.webkit.org/pipermail/webkit-dev/attachments/20080526/029075f5/attachment.sig
More information about the webkit-dev
mailing list