Title: [167643] trunk/Tools
- Revision
- 167643
- Author
- [email protected]
- Date
- 2014-04-21 18:56:04 -0700 (Mon, 21 Apr 2014)
Log 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+.
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (167642 => 167643)
--- trunk/Tools/ChangeLog 2014-04-22 01:48:21 UTC (rev 167642)
+++ trunk/Tools/ChangeLog 2014-04-22 01:56:04 UTC (rev 167643)
@@ -1,3 +1,16 @@
+2014-04-21 Martin Robinson <[email protected]>
+
+ [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+.
+
2014-04-21 Sam Weinig <[email protected]>
Attempt to fix the tests.
Modified: trunk/Tools/WebKitTestRunner/cairo/TestInvocationCairo.cpp (167642 => 167643)
--- trunk/Tools/WebKitTestRunner/cairo/TestInvocationCairo.cpp 2014-04-22 01:48:21 UTC (rev 167642)
+++ trunk/Tools/WebKitTestRunner/cairo/TestInvocationCairo.cpp 2014-04-22 01:56:04 UTC (rev 167643)
@@ -108,7 +108,7 @@
void TestInvocation::dumpPixelsAndCompareWithExpected(WKImageRef wkImage, WKArrayRef repaintRects)
{
-#if PLATFORM(EFL)
+#if PLATFORM(EFL) || PLATFORM(GTK)
UNUSED_PARAM(wkImage);
cairo_surface_t* surface = WKImageCreateCairoSurface(TestController::shared().mainWebView()->windowSnapshotImage().get());
#else
Modified: trunk/Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp (167642 => 167643)
--- trunk/Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp 2014-04-22 01:48:21 UTC (rev 167642)
+++ trunk/Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp 2014-04-22 01:56:04 UTC (rev 167643)
@@ -28,6 +28,7 @@
#include "config.h"
#include "PlatformWebView.h"
+#include <WebKit2/WKImageCairo.h>
#include <WebKit2/WKViewPrivate.h>
#include <gtk/gtk.h>
@@ -120,9 +121,22 @@
WKRetainPtr<WKImageRef> PlatformWebView::windowSnapshotImage()
{
- // FIXME: implement to capture pixels in the UI process,
- // which may be necessary to capture things like 3D transforms.
- return 0;
+ int width = gtk_widget_get_allocated_width(GTK_WIDGET(m_view));
+ int height = gtk_widget_get_allocated_height(GTK_WIDGET(m_view));
+
+ while (gtk_events_pending())
+ gtk_main_iteration();
+
+ cairo_surface_t* imageSurface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height);
+
+ cairo_t* context = cairo_create(imageSurface);
+ gtk_widget_draw(GTK_WIDGET(m_view), context);
+ cairo_destroy(context);
+
+ WKRetainPtr<WKImageRef> wkImage = adoptWK(WKImageCreateFromCairoSurface(imageSurface, 0 /* options */));
+
+ cairo_surface_destroy(imageSurface);
+ return wkImage;
}
void PlatformWebView::didInitializeClients()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes