Unreviewed, rolling out r97082.

http://trac.webkit.org/changeset/97082
https://bugs.webkit.org/show_bug.cgi?id=69784

broke Windows build (Requested by smfr on #webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2011-10-10

* WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:
* WebKitTestRunner/cg/TestInvocationCG.cpp: Renamed from Tools/WebKitTestRunner/cg/TestInvocationCG.mm.
(WTR::createCGContextFromImage):
(WTR::computeMD5HashStringForContext):
(WTR::dumpBitmap):
(WTR::paintRepaintRectOverlay):
(WTR::TestInvocation::dumpPixelsAndCompareWithExpected):
* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(WTR::PlatformWebView::PlatformWebView):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@97089 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 9eea0335
2011-10-10 Sheriff Bot <webkit.review.bot@gmail.com>
Unreviewed, rolling out r97082.
http://trac.webkit.org/changeset/97082
https://bugs.webkit.org/show_bug.cgi?id=69784
broke Windows build (Requested by smfr on #webkit).
* WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:
* WebKitTestRunner/cg/TestInvocationCG.cpp: Renamed from Tools/WebKitTestRunner/cg/TestInvocationCG.mm.
(WTR::createCGContextFromImage):
(WTR::computeMD5HashStringForContext):
(WTR::dumpBitmap):
(WTR::paintRepaintRectOverlay):
(WTR::TestInvocation::dumpPixelsAndCompareWithExpected):
* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(WTR::PlatformWebView::PlatformWebView):
2011-10-10 Simon Fraser <simon.fraser@apple.com>
3D transforms are flattened in WebKit2 snapshots
......@@ -54,7 +54,7 @@
BC8DAD7B1316D91000EC96FC /* InjectedBundleMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC8DAD771316D7B900EC96FC /* InjectedBundleMac.mm */; };
BC8FD8CA120E527F00F3E71A /* EventSendingController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC8FD8C9120E527F00F3E71A /* EventSendingController.cpp */; };
BC8FD8D2120E545B00F3E71A /* JSEventSendingController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC8FD8D0120E545B00F3E71A /* JSEventSendingController.cpp */; };
BC9192051333E4F8003011DC /* TestInvocationCG.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC9192041333E4F8003011DC /* TestInvocationCG.mm */; };
BC9192051333E4F8003011DC /* TestInvocationCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC9192041333E4F8003011DC /* TestInvocationCG.cpp */; };
BC952C0D11F3B965003398B4 /* JSWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC952C0C11F3B965003398B4 /* JSWrapper.cpp */; };
BC952F1F11F3C652003398B4 /* JSLayoutTestController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC952F1D11F3C652003398B4 /* JSLayoutTestController.cpp */; };
BCC997A411D3C8F60017BCA2 /* InjectedBundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCC997A011D3C8F60017BCA2 /* InjectedBundle.cpp */; };
......@@ -138,7 +138,7 @@
BC8FD8CB120E52B000F3E71A /* EventSendingController.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = EventSendingController.idl; sourceTree = "<group>"; };
BC8FD8D0120E545B00F3E71A /* JSEventSendingController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSEventSendingController.cpp; path = DerivedSources/WebKitTestRunner/JSEventSendingController.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
BC8FD8D1120E545B00F3E71A /* JSEventSendingController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSEventSendingController.h; path = DerivedSources/WebKitTestRunner/JSEventSendingController.h; sourceTree = BUILT_PRODUCTS_DIR; };
BC9192041333E4F8003011DC /* TestInvocationCG.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = TestInvocationCG.mm; path = cg/TestInvocationCG.mm; sourceTree = "<group>"; };
BC9192041333E4F8003011DC /* TestInvocationCG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TestInvocationCG.cpp; path = cg/TestInvocationCG.cpp; sourceTree = "<group>"; };
BC952C0B11F3B965003398B4 /* JSWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWrapper.h; sourceTree = "<group>"; };
BC952C0C11F3B965003398B4 /* JSWrapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWrapper.cpp; sourceTree = "<group>"; };
BC952C0E11F3B97B003398B4 /* JSWrappable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWrappable.h; sourceTree = "<group>"; };
......@@ -327,7 +327,7 @@
BC9192021333E4CD003011DC /* cg */ = {
isa = PBXGroup;
children = (
BC9192041333E4F8003011DC /* TestInvocationCG.mm */,
BC9192041333E4F8003011DC /* TestInvocationCG.cpp */,
);
name = cg;
sourceTree = "<group>";
......@@ -486,7 +486,7 @@
BC793431118F7F19005EA8E2 /* TestController.cpp in Sources */,
BC8C795C11D2785D004535A1 /* TestControllerMac.mm in Sources */,
BCD7D2F811921278006DB7EE /* TestInvocation.cpp in Sources */,
BC9192051333E4F8003011DC /* TestInvocationCG.mm in Sources */,
BC9192051333E4F8003011DC /* TestInvocationCG.cpp in Sources */,
5670B8281386FCA5002EB355 /* EventSenderProxy.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
......
......@@ -29,7 +29,6 @@
#include "PixelDumpSupport.h"
#include "PlatformWebView.h"
#include "TestController.h"
#include <ApplicationServices/ApplicationServices.h>
#include <ImageIO/CGImageDestination.h>
#include <WebKit2/WKImageCG.h>
#include <wtf/MD5.h>
......@@ -46,15 +45,21 @@ static const CFStringRef kUTTypePNG = CFSTR("public.png");
namespace WTR {
static CGContextRef createBitmapCGContext(size_t width, size_t height)
static CGContextRef createCGContextFromImage(WKImageRef wkImage)
{
size_t rowBytes = (4 * width + 63) & ~63;
void* buffer = calloc(height, rowBytes);
RetainPtr<CGImageRef> image(AdoptCF, WKImageCreateCGImage(wkImage));
size_t pixelsWide = CGImageGetWidth(image.get());
size_t pixelsHigh = CGImageGetHeight(image.get());
size_t rowBytes = (4 * pixelsWide + 63) & ~63;
void* buffer = calloc(pixelsHigh, rowBytes);
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef context = CGBitmapContextCreate(buffer, width, height, 8, rowBytes, colorSpace, kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host);
CGContextRef context = CGBitmapContextCreate(buffer, pixelsWide, pixelsHigh, 8, rowBytes, colorSpace, kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host);
CGColorSpaceRelease(colorSpace);
CGContextDrawImage(context, CGRectMake(0, 0, pixelsWide, pixelsHigh), image.get());
return context;
}
......@@ -139,23 +144,16 @@ static void paintRepaintRectOverlay(CGContextRef context, WKImageRef image, WKAr
void TestInvocation::dumpPixelsAndCompareWithExpected(WKImageRef image, WKArrayRef repaintRects)
{
// We don't use the image passed from the WebProcess, because it doesn't correctly capture compositing layers. Instead, snapshot
// the window via CGWindowListCreateImage.
PlatformWebView* webView = TestController::shared().mainWebView();
[webView->platformView() display];
RetainPtr<CGImageRef> windowSnapshotImage(AdoptCF, CGWindowListCreateImage(CGRectNull, kCGWindowListOptionIncludingWindow, [webView->platformWindow() windowNumber], kCGWindowImageBoundsIgnoreFraming | kCGWindowImageShouldBeOpaque));
RetainPtr<CGContextRef> context(AdoptCF, createBitmapCGContext(CGImageGetWidth(windowSnapshotImage.get()), CGImageGetHeight(windowSnapshotImage.get())));
CGContextDrawImage(context.get(), CGRectMake(0, 0, CGImageGetWidth(windowSnapshotImage.get()), CGImageGetHeight(windowSnapshotImage.get())), windowSnapshotImage.get());
CGContextRef context = createCGContextFromImage(image);
// A non-null repaintRects array means we're doing a repaint test.
if (repaintRects)
paintRepaintRectOverlay(context.get(), image, repaintRects);
paintRepaintRectOverlay(context, image, repaintRects);
char actualHash[33];
computeMD5HashStringForContext(context.get(), actualHash);
computeMD5HashStringForContext(context, actualHash);
if (!compareActualHashToExpectedAndDumpResults(actualHash))
dumpBitmap(context.get(), actualHash);
dumpBitmap(context, actualHash);
}
} // namespace WTR
......@@ -54,6 +54,7 @@ PlatformWebView::PlatformWebView(WKContextRef contextRef, WKPageGroupRef pageGro
[m_window setColorSpace:[NSColorSpace genericRGBColorSpace]];
[[m_window contentView] addSubview:m_view];
[m_window orderBack:nil];
[m_window setAutodisplay:NO];
[m_window setReleasedWhenClosed:NO];
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment