Changeset 86178 in webkit


Ignore:
Timestamp:
May 10, 2011 12:37:32 PM (13 years ago)
Author:
Martin Robinson
Message:

2011-05-10 Martin Robinson <mrobinson@igalia.com>

Reviewed by Xan Lopez.

[GTK][WebKit2] GTK+ 2.x widget rendering fails after r85480
https://bugs.webkit.org/show_bug.cgi?id=59990

No new tests. This is covered by existing pixel tests.

  • platform/gtk/GtkVersioning.c: (getGdkDrawableSize): Added this helper method.
  • platform/gtk/GtkVersioning.h: Added helper method declaration.
  • platform/gtk/WidgetRenderingContext.cpp: (WebCore::WidgetRenderingContext::WidgetRenderingContext): Call into the helper if there is actually a GdkDrawable. If not, disable the sanity check.
Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r86177 r86178  
     12011-05-10  Martin Robinson  <mrobinson@igalia.com>
     2
     3        Reviewed by Xan Lopez.
     4
     5        [GTK][WebKit2] GTK+ 2.x widget rendering fails after r85480
     6        https://bugs.webkit.org/show_bug.cgi?id=59990
     7
     8        No new tests. This is covered by existing pixel tests.
     9
     10        * platform/gtk/GtkVersioning.c:
     11        (getGdkDrawableSize): Added this helper method.
     12        * platform/gtk/GtkVersioning.h: Added helper method declaration.
     13        * platform/gtk/WidgetRenderingContext.cpp:
     14        (WebCore::WidgetRenderingContext::WidgetRenderingContext): Call into the helper if
     15        there is actually a GdkDrawable. If not, disable the sanity check.
     16
    1172011-05-10  Martin Robinson  <mrobinson@igalia.com>
    218
  • trunk/Source/WebCore/platform/gtk/GtkVersioning.c

    r83319 r86178  
    262262}
    263263
     264#if GTK_CHECK_VERSION(2, 24, 0)
     265void getGdkDrawableSize(GdkDrawable *drawable, int *width, int *height)
     266{
     267    g_return_if_fail(GDK_IS_PIXMAP(drawable) || GDK_IS_WINDOW(drawable));
     268
     269    if (GDK_IS_PIXMAP(drawable)) {
     270        gdk_pixmap_get_size(GDK_PIXMAP(drawable), width, height);
     271        return;
     272    }
     273
     274    GdkWindow *window = GDK_WINDOW(drawable);
     275    *width = gdk_window_get_width(window);
     276    *height = gdk_window_get_height(window);
     277}
     278#else
     279void getGdkDrawableSize(GdkDrawable *drawable, int *width, int *height)
     280{
     281    gdk_drawable_get_size(drawable, &width, &height);
     282}
     283#endif // GTK_CHECK_VERSION(2, 24, 0)
     284
    264285#endif // GTK_API_VERSION_2
    265286
  • trunk/Source/WebCore/platform/gtk/GtkVersioning.h

    r83319 r86178  
    3636GdkPixbuf* gdk_pixbuf_get_from_surface(cairo_surface_t* surface, int srcX, int srcY,
    3737                                       int width, int height);
     38void getGdkDrawableSize(GdkDrawable* drawable, int* width, int* height);
    3839#endif
    3940
  • trunk/Source/WebCore/platform/gtk/WidgetRenderingContext.cpp

    r85480 r86178  
    8484    // We never want to create a scratch buffer larger than the size of our target GdkDrawable.
    8585    // This prevents giant pixmap allocations for very large widgets in smaller views.
    86     int maxWidth = 0, maxHeight = 0;
    87 #if GTK_CHECK_VERSION(2, 24, 0)
    88     maxWidth = gdk_window_get_width(graphicsContext->gdkWindow());
    89     maxHeight = gdk_window_get_height(graphicsContext->gdkWindow());
    90 #else
    91     gdk_drawable_get_size(graphicsContext->gdkWindow(), &maxWidth, &maxHeight);
    92 #endif
    93     m_targetRect.setSize(m_targetRect.size().shrunkTo(IntSize(maxWidth, maxHeight)));
     86    // FIXME: We need to implement this check for WebKit2 as well.
     87    if (graphicsContext->gdkWindow()) {
     88        int maxWidth = 0, maxHeight = 0;
     89        getGdkDrawableSize(graphicsContext->gdkWindow(), &maxWidth, &maxHeight);
     90        m_targetRect.setSize(m_targetRect.size().shrunkTo(IntSize(maxWidth, maxHeight)));
     91    }
    9492
    9593    // Widgets sometimes need to draw outside their boundaries for things such as
Note: See TracChangeset for help on using the changeset viewer.