Changeset 216462 in webkit
- Timestamp:
- May 8, 2017 4:15:00 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r216458 r216462 1 2017-05-08 Jonathan Bedard <jbedard@apple.com> 2 3 Implement PlatformWebView::windowSnapshotImage and createBitmapContextFromWebView for iOS devices 4 https://bugs.webkit.org/show_bug.cgi?id=169421 5 <rdar://problem/30950171> 6 7 Reviewed by Tim Horton. 8 9 * platform/ios-device/TestExpectations: Mark compositing tests as failures, this 10 is due to a bug tracked in https://bugs.webkit.org/show_bug.cgi?id=170772. 11 1 12 2017-05-08 Chris Dumez <cdumez@apple.com> 2 13 -
trunk/LayoutTests/platform/ios-device/TestExpectations
r214474 r216462 4 4 # 5 5 6 # https://bugs.webkit.org/show_bug.cgi?id=170772 7 compositing/geometry/clipped-out-perspective.html [ ImageOnlyFailure ] 8 compositing/hidpi-subpixel-transform-origin.html [ ImageOnlyFailure ] 9 compositing/regions/position-layer-inside-region-overflow-hidden.html [ ImageOnlyFailure ] 10 compositing/regions/position-layers-inside-region-overflow-hidden.html [ ImageOnlyFailure ] 11 compositing/regions/position-layers-inside-regions-overflow-hidden.html [ ImageOnlyFailure ] 12 -
trunk/Tools/ChangeLog
r216447 r216462 1 2017-05-08 Jonathan Bedard <jbedard@apple.com> 2 3 Implement PlatformWebView::windowSnapshotImage and createBitmapContextFromWebView for iOS devices 4 https://bugs.webkit.org/show_bug.cgi?id=169421 5 <rdar://problem/30950171> 6 7 Reviewed by Tim Horton. 8 9 * DumpRenderTree/ios/PixelDumpSupportIOS.mm: 10 (createBitmapContextFromWebView): Implement for IOSurface. 11 * WebKitTestRunner/ios/PlatformWebViewIOS.mm: 12 (WTR::PlatformWebView::windowSnapshotImage): Use snapshot API for device. 13 1 14 2017-05-08 Jonathan Bedard <jbedard@apple.com> 2 15 -
trunk/Tools/DumpRenderTree/ios/PixelDumpSupportIOS.mm
r208289 r216462 39 39 #import <MobileCoreServices/UTCoreTypes.h> 40 40 #import <QuartzCore/QuartzCore.h> 41 #import <WebCore/CoreGraphicsSPI.h> 42 #import <WebCore/GraphicsContextCG.h> 43 #import <WebCore/IOSurface.h> 44 #import <WebCore/PlatformScreen.h> 41 45 #import <WebCore/QuartzCoreSPI.h> 42 46 #import <WebKit/WebCoreThread.h> … … 57 61 [CATransaction flush]; 58 62 59 #if USE(IOSURFACE)60 return nullptr;61 #else62 63 CGFloat deviceScaleFactor = 2; // FIXME: hardcode 2x for now. In future we could respect 1x and 3x as we do on Mac. 63 CATransform3D transform = CATransform3DMakeScale(deviceScaleFactor, deviceScaleFactor, 1);64 64 65 65 CGSize viewSize = [[mainFrame webView] frame].size; 66 66 int bufferWidth = ceil(viewSize.width * deviceScaleFactor); 67 67 int bufferHeight = ceil(viewSize.height * deviceScaleFactor); 68 69 #if USE(IOSURFACE) 70 WebCore::FloatSize snapshotSize(viewSize); 71 snapshotSize.scale(deviceScaleFactor); 72 73 WebCore::IOSurface::Format snapshotFormat = WebCore::screenSupportsExtendedColor() ? WebCore::IOSurface::Format::RGB10 : WebCore::IOSurface::Format::RGBA; 74 auto surface = WebCore::IOSurface::create(WebCore::expandedIntSize(snapshotSize), WebCore::sRGBColorSpaceRef(), snapshotFormat); 75 RetainPtr<CGImageRef> cgImage = surface->createImage(); 76 77 void* bitmapBuffer = nullptr; 78 size_t bitmapRowBytes = 0; 79 auto bitmapContext = createBitmapContext(bufferWidth, bufferHeight, bitmapRowBytes, bitmapBuffer); 80 if (!bitmapContext) 81 return nullptr; 82 83 CGContextDrawImage(bitmapContext->cgContext(), CGRectMake(0, 0, bufferWidth, bufferHeight), cgImage.get()); 84 return bitmapContext; 85 #else 86 CATransform3D transform = CATransform3DMakeScale(deviceScaleFactor, deviceScaleFactor, 1); 87 static CGColorSpaceRef sRGBSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB); 68 88 69 89 CARenderServerBufferRef buffer = CARenderServerCreateBuffer(bufferWidth, bufferHeight); … … 78 98 size_t rowBytes = CARenderServerGetBufferRowBytes(buffer); 79 99 80 static CGColorSpaceRef sRGBSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);81 100 RetainPtr<CGDataProviderRef> provider = adoptCF(CGDataProviderCreateWithData(0, data, CARenderServerGetBufferDataSize(buffer), nullptr)); 82 101 -
trunk/Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm
r216335 r216462 33 33 #import <WebKit/WKImageCG.h> 34 34 #import <WebKit/WKPreferencesPrivate.h> 35 #import <WebKit/WKSnapshotConfiguration.h> 35 36 #import <WebKit/WKWebViewConfiguration.h> 36 37 #import <WebKit/WKWebViewPrivate.h> … … 305 306 BEGIN_BLOCK_OBJC_EXCEPTIONS; 306 307 #if USE(IOSURFACE) 307 return nullptr; 308 __block bool isDone = false; 309 __block RetainPtr<CGImageRef> result; 310 311 RetainPtr<WKSnapshotConfiguration> snapshotConfiguration = adoptNS([[WKSnapshotConfiguration alloc] init]); 312 [snapshotConfiguration setRect:CGRectMake(0, 0, m_view.frame.size.width, m_view.frame.size.height)]; 313 [snapshotConfiguration setSnapshotWidth:@(m_view.frame.size.width)]; 314 315 [m_view takeSnapshotWithConfiguration:snapshotConfiguration.get() completionHandler:^(UIImage *snapshotImage, NSError *error) { 316 if (!error) 317 result = [snapshotImage CGImage]; 318 isDone = true; 319 }]; 320 while (!isDone) 321 [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantPast]]; 322 return result; 323 308 324 #else 309 325 CGFloat deviceScaleFactor = 2; // FIXME: hardcode 2x for now. In future we could respect 1x and 3x as we do on Mac.
Note: See TracChangeset
for help on using the changeset viewer.