Changeset 167643 in webkit


Ignore:
Timestamp:
Apr 21, 2014 6:56:04 PM (10 years ago)
Author:
Martin Robinson
Message:

[GTK] Should have the ability to output composited contents during layout testing
https://bugs.webkit.org/show_bug.cgi?id=131864

Reviewed by Philippe Normand.

  • WebKitTestRunner/cairo/TestInvocationCairo.cpp:

(WTR::TestInvocation::dumpPixelsAndCompareWithExpected): Add a path that paints the widget contents
to an image surface. We run the main loop a bit to match the implementation from WebKit1 and EFL.

  • WebKitTestRunner/gtk/PlatformWebViewGtk.cpp:

(WTR::PlatformWebView::windowSnapshotImage): Use the new UI-process path on GTK+.

Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r167627 r167643  
     12014-04-21  Martin Robinson  <mrobinson@igalia.com>
     2
     3        [GTK] Should have the ability to output composited contents during layout testing
     4        https://bugs.webkit.org/show_bug.cgi?id=131864
     5
     6        Reviewed by Philippe Normand.
     7
     8        * WebKitTestRunner/cairo/TestInvocationCairo.cpp:
     9        (WTR::TestInvocation::dumpPixelsAndCompareWithExpected): Add a path that paints the widget contents
     10        to an image surface. We run the main loop a bit to match the implementation from WebKit1 and EFL.
     11        * WebKitTestRunner/gtk/PlatformWebViewGtk.cpp:
     12        (WTR::PlatformWebView::windowSnapshotImage): Use the new UI-process path on GTK+.
     13
    1142014-04-21  Sam Weinig  <sam@webkit.org>
    215
  • trunk/Tools/WebKitTestRunner/cairo/TestInvocationCairo.cpp

    r163079 r167643  
    109109void TestInvocation::dumpPixelsAndCompareWithExpected(WKImageRef wkImage, WKArrayRef repaintRects)
    110110{
    111 #if PLATFORM(EFL)
     111#if PLATFORM(EFL) || PLATFORM(GTK)
    112112    UNUSED_PARAM(wkImage);
    113113    cairo_surface_t* surface = WKImageCreateCairoSurface(TestController::shared().mainWebView()->windowSnapshotImage().get());
  • trunk/Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp

    r164882 r167643  
    2929#include "PlatformWebView.h"
    3030
     31#include <WebKit2/WKImageCairo.h>
    3132#include <WebKit2/WKViewPrivate.h>
    3233#include <gtk/gtk.h>
     
    121122WKRetainPtr<WKImageRef> PlatformWebView::windowSnapshotImage()
    122123{
    123     // FIXME: implement to capture pixels in the UI process,
    124     // which may be necessary to capture things like 3D transforms.
    125     return 0;
     124    int width = gtk_widget_get_allocated_width(GTK_WIDGET(m_view));
     125    int height = gtk_widget_get_allocated_height(GTK_WIDGET(m_view));
     126
     127    while (gtk_events_pending())
     128        gtk_main_iteration();
     129
     130    cairo_surface_t* imageSurface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height);
     131
     132    cairo_t* context = cairo_create(imageSurface);
     133    gtk_widget_draw(GTK_WIDGET(m_view), context);
     134    cairo_destroy(context);
     135
     136    WKRetainPtr<WKImageRef> wkImage = adoptWK(WKImageCreateFromCairoSurface(imageSurface, 0 /* options */));
     137
     138    cairo_surface_destroy(imageSurface);
     139    return wkImage;
    126140}
    127141
Note: See TracChangeset for help on using the changeset viewer.