diff options
Diffstat (limited to 'Tools/WebKitTestRunner')
| -rw-r--r-- | Tools/WebKitTestRunner/cg/TestInvocationCG.cpp | 11 | ||||
| -rw-r--r-- | Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm | 5 | ||||
| -rw-r--r-- | Tools/WebKitTestRunner/qt/PlatformWebViewQt.cpp | 4 |
3 files changed, 11 insertions, 9 deletions
diff --git a/Tools/WebKitTestRunner/cg/TestInvocationCG.cpp b/Tools/WebKitTestRunner/cg/TestInvocationCG.cpp index 631a02ec5..78b87105b 100644 --- a/Tools/WebKitTestRunner/cg/TestInvocationCG.cpp +++ b/Tools/WebKitTestRunner/cg/TestInvocationCG.cpp @@ -59,9 +59,9 @@ static CGContextRef createCGContextFromImage(WKImageRef wkImage, FlipGraphicsCon size_t rowBytes = (4 * pixelsWide + 63) & ~63; void* buffer = calloc(pixelsHigh, rowBytes); - CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); - CGContextRef context = CGBitmapContextCreate(buffer, pixelsWide, pixelsHigh, 8, rowBytes, colorSpace, kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host); - CGColorSpaceRelease(colorSpace); + // Creating this bitmap in the device color space should prevent any color conversion when the image of the web view is drawn into it. + RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB()); + CGContextRef context = CGBitmapContextCreate(buffer, pixelsWide, pixelsHigh, 8, rowBytes, colorSpace.get(), kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host); if (flip == FlipGraphicsContext) { CGContextSaveGState(context); @@ -95,15 +95,14 @@ void computeMD5HashStringForContext(CGContextRef bitmapContext, char hashString[ md5.addBytes(buffer); bitmapData += bytesPerRow; } - } else { + } else #endif + { for (unsigned row = 0; row < pixelsHigh; row++) { md5.addBytes(bitmapData, 4 * pixelsWide); bitmapData += bytesPerRow; } -#if PLATFORM(MAC) } -#endif Vector<uint8_t, 16> hash; md5.checksum(hash); diff --git a/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm b/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm index 631779072..eb7e98b41 100644 --- a/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm +++ b/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm @@ -56,7 +56,7 @@ PlatformWebView::PlatformWebView(WKContextRef contextRef, WKPageGroupRef pageGro NSRect windowRect = NSOffsetRect(rect, -10000, [(NSScreen *)[[NSScreen screens] objectAtIndex:0] frame].size.height - rect.size.height + 10000); m_window = [[WebKitTestRunnerWindow alloc] initWithContentRect:windowRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES]; m_window.platformWebView = this; - [m_window setColorSpace:[NSColorSpace genericRGBColorSpace]]; + [m_window setColorSpace:[[NSScreen mainScreen] colorSpace]]; [[m_window contentView] addSubview:m_view]; [m_window orderBack:nil]; [m_window setReleasedWhenClosed:NO]; @@ -132,6 +132,9 @@ WKRetainPtr<WKImageRef> PlatformWebView::windowSnapshotImage() { [m_view display]; RetainPtr<CGImageRef> windowSnapshotImage(AdoptCF, CGWindowListCreateImage(CGRectNull, kCGWindowListOptionIncludingWindow, [m_window windowNumber], kCGWindowImageBoundsIgnoreFraming | kCGWindowImageShouldBeOpaque)); + + // windowSnapshotImage will be in the display's color space, but WKImageCreateFromCGImage() will draw + // this image into a GenericRGB bitmap context, so the returned image is GenericRGB. return adoptWK(WKImageCreateFromCGImage(windowSnapshotImage.get(), 0)); } diff --git a/Tools/WebKitTestRunner/qt/PlatformWebViewQt.cpp b/Tools/WebKitTestRunner/qt/PlatformWebViewQt.cpp index 0b8a7d1ab..13a33f8bc 100644 --- a/Tools/WebKitTestRunner/qt/PlatformWebViewQt.cpp +++ b/Tools/WebKitTestRunner/qt/PlatformWebViewQt.cpp @@ -117,12 +117,12 @@ void PlatformWebView::setWindowFrame(WKRect wkRect) bool PlatformWebView::sendEvent(QEvent* event) { - return QCoreApplication::sendEvent(m_view->page(), event); + return QCoreApplication::sendEvent(m_view, event); } void PlatformWebView::postEvent(QEvent* event) { - QCoreApplication::postEvent(m_view->page(), event); + QCoreApplication::postEvent(m_view, event); } void PlatformWebView::addChromeInputField() |
