Title: [131307] trunk/Tools
Revision
131307
Author
kbal...@webkit.org
Date
2012-10-15 09:22:23 -0700 (Mon, 15 Oct 2012)

Log Message

[Qt] Implement pixel snapshot generation in WTR
https://bugs.webkit.org/show_bug.cgi?id=95992

Reviewed by Jocelyn Turcotte.

Switch the Qt implementation of the PlatformWebView to use
QQuickWindow::grabWindow to generate the pixel results. This way
we will go through the scenegraph and test the actual rendering backend.
We use QQuickWindowPrivate::setRenderWithoutShowing to avoid the need of
showing the window.

* WebKitTestRunner/Target.pri: Had to added a bunch
of modules to be able to use QQuickWindowPrivate.
* WebKitTestRunner/qt/PlatformWebViewQt.cpp:
(WTR::WrapperWindow::handleStatusChanged):
(WTR::PlatformWebView::windowSnapshotImage):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (131306 => 131307)


--- trunk/Tools/ChangeLog	2012-10-15 16:15:44 UTC (rev 131306)
+++ trunk/Tools/ChangeLog	2012-10-15 16:22:23 UTC (rev 131307)
@@ -1,5 +1,24 @@
 2012-10-15  Balazs Kelemen  <kbal...@webkit.org>
 
+        [Qt] Implement pixel snapshot generation in WTR
+        https://bugs.webkit.org/show_bug.cgi?id=95992
+
+        Reviewed by Jocelyn Turcotte.
+
+        Switch the Qt implementation of the PlatformWebView to use
+        QQuickWindow::grabWindow to generate the pixel results. This way
+        we will go through the scenegraph and test the actual rendering backend.
+        We use QQuickWindowPrivate::setRenderWithoutShowing to avoid the need of
+        showing the window.
+
+        * WebKitTestRunner/Target.pri: Had to added a bunch
+        of modules to be able to use QQuickWindowPrivate.
+        * WebKitTestRunner/qt/PlatformWebViewQt.cpp:
+        (WTR::WrapperWindow::handleStatusChanged):
+        (WTR::PlatformWebView::windowSnapshotImage):
+
+2012-10-15  Balazs Kelemen  <kbal...@webkit.org>
+
         [Qt][WTR] Do a forced repaint before generating pixel results
         https://bugs.webkit.org/show_bug.cgi?id=98654
 

Modified: trunk/Tools/WebKitTestRunner/Target.pri (131306 => 131307)


--- trunk/Tools/WebKitTestRunner/Target.pri	2012-10-15 16:15:44 UTC (rev 131306)
+++ trunk/Tools/WebKitTestRunner/Target.pri	2012-10-15 16:22:23 UTC (rev 131307)
@@ -31,7 +31,7 @@
 
 DESTDIR = $${ROOT_BUILD_DIR}/bin
 
-QT = core gui gui-private widgets network testlib quick quick-private webkitwidgets
+QT = core core-private gui gui-private widgets network testlib quick quick-private webkitwidgets qml-private v8-private
 
 WEBKIT += wtf _javascript_core webkit2
 

Modified: trunk/Tools/WebKitTestRunner/qt/PlatformWebViewQt.cpp (131306 => 131307)


--- trunk/Tools/WebKitTestRunner/qt/PlatformWebViewQt.cpp	2012-10-15 16:15:44 UTC (rev 131306)
+++ trunk/Tools/WebKitTestRunner/qt/PlatformWebViewQt.cpp	2012-10-15 16:22:23 UTC (rev 131307)
@@ -34,6 +34,7 @@
 #include <QEventLoop>
 #include <QQmlProperty>
 #include <QtQuick/QQuickView>
+#include <QtQuick/private/qquickwindow_p.h>
 #include <WebKit2/WKImageQt.h>
 #include <qpa/qwindowsysteminterface.h>
 
@@ -61,6 +62,11 @@
         m_view->setParentItem(rootObject());
         QQmlProperty::write(m_view, "anchors.fill", qVariantFromValue(rootObject()));
 
+        setSurfaceType(OpenGLSurface);
+        create();
+
+        QQuickWindowPrivate::get(this)->setRenderWithoutShowing(true);
+
         QWindowSystemInterface::handleWindowActivated(this);
         m_view->page()->setFocus(true);
     }
@@ -152,9 +158,7 @@
 
 WKRetainPtr<WKImageRef> PlatformWebView::windowSnapshotImage()
 {
-    // FIXME: implement to capture pixels in the UI process,
-    // which may be necessary to capture things like 3D transforms.
-    return adoptWK(WKImageCreateFromQImage(QImage()));
+    return adoptWK(WKImageCreateFromQImage(m_window->grabWindow()));
 }
 
 } // namespace WTR
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to