void QWebFramePrivate::renderPrivate(QPainter *painter, const QRegion &clip, bool contents) { if (!frame->view() || !frame->contentRenderer()) return; QVector<QRect> vector = clip.rects(); if (vector.isEmpty()) return; WebCore::FrameView* view = frame->view(); view->layoutIfNeededRecursive(); GraphicsContext context(painter); if (!contents) view->paint(&context, vector.first()); else view->paintContents(&context, vector.first()); for (int i = 1; i < vector.size(); ++i) { const QRect& clipRect = vector.at(i); painter->save(); painter->setClipRect(clipRect, Qt::IntersectClip); if (!contents) view->paint(&context, clipRect); else view->paintContents(&context, clipRect); painter->restore(); } }
/*! Render the frame into \a painter. */ void QWebFrame::render(QPainter *painter) { if (!d->frame->view() || !d->frame->contentRenderer()) return; d->frame->view()->layoutIfNeededRecursive(); GraphicsContext ctx(painter); WebCore::FrameView* view = d->frame->view(); view->paint(&ctx, view->frameRect()); }
/*! Render the frame into \a painter clipping to \a clip. \sa print() */ void QWebFrame::render(QPainter *painter, const QRegion &clip) { if (!d->frame->view() || !d->frame->contentRenderer()) return; d->frame->view()->layoutIfNeededRecursive(); GraphicsContext ctx(painter); QVector<QRect> vector = clip.rects(); WebCore::FrameView* view = d->frame->view(); for (int i = 0; i < vector.size(); ++i) { if (i > 0) { painter->save(); painter->setClipRect(vector.at(i), Qt::IntersectClip); } view->paint(&ctx, vector.at(i)); if (i > 0) painter->restore(); } }