[Webkit-unassigned] [Bug 47411] [GTK] Implement subregion rendering in WebView when using gtk3

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Oct 8 08:53:23 PDT 2010


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


Martin Robinson <mrobinson at webkit.org> changed:

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




--- Comment #2 from Martin Robinson <mrobinson at webkit.org>  2010-10-08 08:53:23 PST ---
(From update of attachment 70230)
View in context: https://bugs.webkit.org/attachment.cgi?id=70230&action=review

> WebKit/gtk/webkit/webkitwebview.cpp:495
> +static bool shouldCoalesce(GdkRectangle *rect, GdkRectangle* rects, int count)

Need to slide the asterisk on *rect over to GdkRectangle.

> WebKit/gtk/webkit/webkitwebview.cpp:515
> +static void webkit_web_view_paint(Frame* frame, gboolean transparent, GraphicsContext *ctx, GdkRectangle* clipRect, GdkRectangle* rects, int rectCount)

The method name should follow WebKit style, so camelCase. It's not a GTK+ method, so perhaps the verb should come first? paintWebView maybe.

Also need to fix the asterisk on GraphicsContext *ctx. In fact, it probably makes sense to just pass a reference here. const GraphicsContext& context. We try to avoid abbreviating context in new code.

> WebKit/gtk/webkit/webkitwebview.cpp:595
> +        if (!rectList->status && rectList->num_rectangles > 0) {
> +            GOwnPtr<GdkRectangle> rects(g_new(GdkRectangle, rectList->num_rectangles));
> +            for (int i = 0; i < rectList->num_rectangles; i++) {
> +                cairo_rectangle_t cairoRect = rectList->rectangles[i];
> +                rects.get()[i].x = static_cast<int>(cairoRect.x);
> +                rects.get()[i].y = static_cast<int>(cairoRect.y);
> +                rects.get()[i].width = static_cast<int>(cairoRect.width);
> +                rects.get()[i].height = static_cast<int>(cairoRect.height);
> +            }

Instead of converting to GdkRectangle and then paintWebView converting them to IntRects, why not just convert straight to IntRect and pass a Vector of them. The code would end up looking something like this:

Vector<IntRect> rects;
if (!rectList->status && rectList->num_rectangles > 0) {
    for (int = 0; i < rectList->num_rectangles; i++)
        rects.append(IntRect(rectList->rectangles[i]));
}
paintWebView(frame, priv->transparent, context, &clipRect, rects);

paintWebView would, of course, take a Vector<IntRect>& rects. You would need to update shouldCoalesce as well to take an IntRect and a Vector<IntRect>&. The Windows port actually does something very similar to this in getUpdateRects in WebKit/win/WebView.cpp. Maybe check that out.

-- 
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