Changeset 181443 in webkit
- Timestamp:
- Mar 12, 2015, 10:27:26 AM (11 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
UIProcess/API/Cocoa/WKWebView.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r181442 r181443 1 2015-03-12 Ian Henderson <ian@ianhenderson.org> 2 3 PDFs don't snapshot properly in iOS Safari 4 https://bugs.webkit.org/show_bug.cgi?id=142623 5 6 Reviewed by Tim Horton. 7 8 * UIProcess/API/Cocoa/WKWebView.mm: 9 (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]): 10 If we have a _customContentView, use UIView snapshotting instead of 11 trying to snapshot the web page. 12 1 13 2015-03-12 Eric Carlson <eric.carlson@apple.com> 2 14 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
r181317 r181443 2447 2447 - (void)_snapshotRect:(CGRect)rectInViewCoordinates intoImageOfWidth:(CGFloat)imageWidth completionHandler:(void(^)(CGImageRef))completionHandler 2448 2448 { 2449 CGRect snapshotRectInContentCoordinates = [self convertRect:rectInViewCoordinates toView:_contentView.get()]; 2450 CGFloat imageHeight = imageWidth / snapshotRectInContentCoordinates.size.width * snapshotRectInContentCoordinates.size.height; 2449 CGRect snapshotRectInContentCoordinates = [self convertRect:rectInViewCoordinates toView:self._currentContentView]; 2450 CGFloat imageScale = imageWidth / snapshotRectInContentCoordinates.size.width; 2451 CGFloat imageHeight = imageScale * snapshotRectInContentCoordinates.size.height; 2451 2452 CGSize imageSize = CGSizeMake(imageWidth, imageHeight); 2453 2454 if (_customContentView) { 2455 UIGraphicsBeginImageContextWithOptions(imageSize, YES, 1); 2456 2457 UIView *customContentView = _customContentView.get(); 2458 [customContentView.backgroundColor set]; 2459 UIRectFill(CGRectMake(0, 0, imageWidth, imageHeight)); 2460 2461 CGRect destinationRect = customContentView.bounds; 2462 destinationRect.origin.x = -snapshotRectInContentCoordinates.origin.x * imageScale; 2463 destinationRect.origin.y = -snapshotRectInContentCoordinates.origin.y * imageScale; 2464 destinationRect.size.width *= imageScale; 2465 destinationRect.size.height *= imageScale; 2466 [customContentView drawViewHierarchyInRect:destinationRect afterScreenUpdates:NO]; 2467 2468 completionHandler([UIGraphicsGetImageFromCurrentImageContext() CGImage]); 2469 2470 UIGraphicsEndImageContext(); 2471 return; 2472 } 2452 2473 2453 2474 void(^copiedCompletionHandler)(CGImageRef) = [completionHandler copy];
Note:
See TracChangeset
for help on using the changeset viewer.