[Webkit-unassigned] [Bug 23211] Add QWebFrame::renderContents to API
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu Jan 22 20:44:40 PST 2009
https://bugs.webkit.org/show_bug.cgi?id=23211
zimmermann at kde.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #26567|review? |review+
Flag| |
------- Comment #2 from zimmermann at kde.org 2009-01-22 20:44 PDT -------
(From update of attachment 26567)
> diff --git a/WebKit/qt/Api/qwebframe.cpp b/WebKit/qt/Api/qwebframe.cpp
> index 2ec76cf..1de9496 100644
> --- a/WebKit/qt/Api/qwebframe.cpp
> +++ b/WebKit/qt/Api/qwebframe.cpp
> @@ -781,6 +781,33 @@ void QWebFrame::render(QPainter *painter)
> }
>
> /*!
> + \since 4.6
> + Render the frame's \a contents into \a painter while clipping to \a contents.
> +*/
> +void QWebFrame::renderContents(QPainter *painter, const QRegion &contents)
> +{
> + if (!d->frame->view() || !d->frame->contentRenderer())
> + return;
> +
> + d->frame->view()->layoutIfNeededRecursive();
> +
> + GraphicsContext ctx(painter);
I'd name it 'context', as we dislike abbrevations in WebCore.
> + QVector<QRect> vector = contents.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->paintContents(&ctx, vector.at(i));
> +
> + if (i > 0)
> + painter->restore();
> + }
> +}
I'd rewrite the function as follows, to save some cycles:
QVector<QRect> vector = contents.rects();
if (vector.isEmpty())
return;
WebCore::FrameView* view = d->frame->view();
view->paintContents(&context, vector.first());
for (int i = 0; i < vector.size(); ++i) {
const QRect& clipRect = vector.at(i);
painter->save();
painter->setClipRect(clipRect, Qt::IntersectClip);
view->paintContents(&context, clipRect);
painter->restore();
}
}
r=me, with those changes.
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the webkit-unassigned
mailing list