[webkit-dev] Page doesn't layout nor apply style

Luka Napotnik luka.napotnik at gmail.com
Fri Jul 31 05:31:59 PDT 2009


I have two WebKit sourcetrees. One that shows a simple Gtk+ window and
displays the page. Besides that the page gets painted onto a cairo
source which I save to a PNG image. The image correctly shows the

The other source tree is the same as the first but now I don't show
the Gtk+ window. Again I paint the page to a cairo surface and save it
to a PNG image. But the problem is that the page now doesn't have
layout nor any styles even when I called layoutIfNeeded() just before
paint(). I paint the page using:

 if (m_frame->contentRenderer()) {
       m_frame->view()->paint(&ctx, pageRect);

The output only shows unstyled text and even javascript sources. I
think there' s some condition that if the view is not visible then
some methods are not called. I browsed the loader/ sources a bit but
don't have a clue what could it be. Any ideas?

Here's a detailed description of my work:

"'ve been working on an offscreen hack for webkit for a while now. While
I managed to paint the pages on a cairo surface using the clutter
offscreen functions in WebKit rev. 38000, the code is now old and I
would like to migrate to the latest revisions.

The problem is that my patches don't work anymore.

My current patch works like this: the WebCore functions
RenderView::layout() and FrameView::layoutTimerFired() emit an
"update-request" event to the Gtk+ WebKitWebView widget which I added
and then forces the whole render tree to layout and calls
paintContents() to get the page on the cairo surface. This worked well
but still got some unnecessary "update-request" calls.

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.

I've browsed the source and tried to backtrace the original method call
that triggers whenever the page needs a repaint (modifications to the
DOM tree, javascript events) but failed. The problem is more complex
because there's no widget on the screen so I can't use some obvious
methods or the "expose-event" of the Gtk+ port."


More information about the webkit-dev mailing list