[webkit-help] Offscreen rendering using webkit gtk+ port

Luka Napotnik luka.napotnik at gmail.com
Fri Jul 31 01:36:10 PDT 2009


Hello.

Thanks for your quick reply. The method ChromeClient::repaint() is
probably the right one. But something strange happens. When I render
the page on a cairo image surface and save the surface to a PNG file,
the image shows the correct page. But when doing the same thing with
my offscreen webkit where there's no visible widget, the image is
still not layed out. The page lacks of any style. Any suggestions?

This is the code where the frame is painted on a cairo surface that I
create before the call:
----------------------------------------------
    Frame* m_frame = core(frame);

    double x1, y1, x2, y2;

    GraphicsContext ctx(cr);
    cairo_fill_extents(cr, &x1, &y1, &x2, &y2);
    IntRect pageRect = IntRect(x1, y1, x2 - x1, y2 - y1);
    ctx.save();
    ctx.clip(pageRect);
    if (m_frame->contentRenderer()) {
        m_frame->view()->layoutIfNeededRecursive();
        m_frame->view()->paint(&ctx, pageRect);
    }
    ctx.restore();
    cairo_new_path(cr);
----------------------------------------------

Anything obvious wrong here?

Greets,
Luka

2009/7/31 Holger Freyther <zecke at selfish.org>:
> Luka Napotnik <luka.napotnik at ...> writes:
>
>
>>
>> But with the latest code I suspect some methods are not called and I get
>> an unformatted (no style, no layout) image on the cairo surface. And
>> this is useless because the pages aren't rendered correctly.
>>
>
> Please see the expose handler of webkitwebview.cpp. It is doing a call like
> FrameView::layougIfNeededRecursively. And instead of firing in
> layoutTimerFired you could add  your signal to the ChromeClient. The
> ChromeClient will get called whenever regions of the code
> change (but be aware that this might be called from within a paint too so
> you need to defer an  update a bit).
>
> _______________________________________________
> webkit-help mailing list
> webkit-help at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-help
>


More information about the webkit-help mailing list