[Webkit-unassigned] [Bug 28781] Add QWebFrame::renderElement to API

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Sep 20 14:31:08 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=28781


Ariya Hidayat <ariya.hidayat at trolltech.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #39619|review?                     |review-
               Flag|                            |




--- Comment #11 from Ariya Hidayat <ariya.hidayat at trolltech.com>  2009-09-20 14:31:08 PDT ---
(From update of attachment 39619)

> +        Add QWebElement::render API which allows rendering of single
> +        element in custom position.

Is the "custom position" part necessary? The render function only takes a
QPainter, custom positioning is implied by QPainter transformation.

> +#include <qpainter.h>

Use the norm of QPainter or QtGui/QPainter like in other files.

> +void QWebElement::render(QPainter *painter)

This function needs the API documentation.

> +    // fall back to full rendering if no cached image

Comment could be better and more descriptive.

> +    pRect.move(-pRect.x(), -pRect.y());
> +    WebCore::RenderObject::PaintInfo cPaintInfo(&context, pRect, PaintPhaseBlockBackground, false, 0, 0);
> +    WebKitRenderer->paint(cPaintInfo, 0, 0);
> +    cPaintInfo.phase = PaintPhaseForeground;
> +    WebKitRenderer->paint(cPaintInfo, 0, 0);

All the variables don't have prefix, we're not using Hungarian notation in Qt
:)

> +    QImage resource(":/image.png");
> +    QPicture picture1;
> +    QPainter painter1(&picture1);
> +    imgs[0].render(&painter1);
> +    painter1.end();

The idea with QPicture is interesting, but I seriously doubt the test needs to
be complicated.

In principle, just paint to a QImage (of a given size) and compare the pixels
to what you would expect
(you know this because of your test HTML fragment, you can find out e.g. the
position of image.png)

Also no need for ImageDiff code reuse for this, as we simply needs to compare
pixel-per-pixel (ImageDiff supports "fuzzy comparison").
If a pixel is not correct, for this use case we can safely assume that
something has gone wrong.

Painting to QImage, you don't need to worry about settings the graphics system
to raster. It will be raster when doing the painting to image.


r- until these issues are addressed.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list