Changeset 246300 in webkit
- Timestamp:
- Jun 10, 2019 5:45:50 PM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r246285 r246300 1 2019-06-10 Andy Estes <aestes@apple.com> 2 3 [iOS] Use PDFKit SPI for taking snapshots when the hosting app is not entitled for global capture 4 https://bugs.webkit.org/show_bug.cgi?id=198731 5 <rdar://problem/46215174> 6 7 Reviewed by Tim Horton. 8 9 * wtf/FeatureDefines.h: 10 1 11 2019-06-10 Sam Weinig <weinig@apple.com> 2 12 -
trunk/Source/WTF/wtf/FeatureDefines.h
r246285 r246300 173 173 174 174 #if !defined(ENABLE_WKPDFVIEW) 175 #if PLATFORM(IOS_FAMILY) &&!PLATFORM(WATCHOS) && !PLATFORM(APPLETV) && !PLATFORM(IOSMAC) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 120000175 #if !PLATFORM(WATCHOS) && !PLATFORM(APPLETV) && !PLATFORM(IOSMAC) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 120000 176 176 #define ENABLE_WKPDFVIEW 1 177 #endif 178 #endif 179 180 #if !defined(HAVE_PDFHOSTVIEWCONTROLLER_SNAPSHOTTING) 181 #if !PLATFORM(WATCHOS) && !PLATFORM(APPLETV) && !PLATFORM(IOSMAC) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 130000 182 #define HAVE_PDFHOSTVIEWCONTROLLER_SNAPSHOTTING 1 177 183 #endif 178 184 #endif -
trunk/Source/WebKit/ChangeLog
r246285 r246300 1 2019-06-10 Andy Estes <aestes@apple.com> 2 3 [iOS] Use PDFKit SPI for taking snapshots when the hosting app is not entitled for global capture 4 https://bugs.webkit.org/show_bug.cgi?id=198731 5 <rdar://problem/46215174> 6 7 Reviewed by Tim Horton. 8 9 PDFHostViewController renders PDF contents in a view service, and apps are unable to 10 snapshot views rendered out-of-process without an entitlement. 11 12 When an app is missing this entitlement and calls WKWebView's 13 takeSnapshotWithConfiguration: API when a PDF is displayed, fall back to calling 14 PDFHostViewController's snapshotting SPI. 15 16 Testing is blocked by <https://webkit.org/b/175204>. 17 18 * Platform/spi/ios/PDFKitSPI.h: 19 * UIProcess/API/Cocoa/WKWebView.mm: 20 (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]): 21 * UIProcess/Cocoa/WKWebViewContentProvider.h: 22 * UIProcess/ios/WKPDFView.mm: 23 (+[WKPDFView web_requiresCustomSnapshotting]): 24 (-[WKPDFView web_snapshotRectInContentViewCoordinates:snapshotWidth:completionHandler:]): 25 * UIProcess/ios/WKSystemPreviewView.mm: 26 (+[WKSystemPreviewView web_requiresCustomSnapshotting]): 27 1 28 2019-06-10 Sam Weinig <weinig@apple.com> 2 29 -
trunk/Source/WebKit/Platform/spi/ios/PDFKitSPI.h
r244955 r246300 58 58 - (void) endPDFViewRotation; 59 59 60 #if HAVE(PDFHOSTVIEWCONTROLLER_SNAPSHOTTING) 61 - (void) snapshotViewRect: (CGRect) rect snapshotWidth: (NSNumber*) width afterScreenUpdates: (BOOL) afterScreenUpdates withResult: (void (^)(UIImage* image)) completion; 62 #endif 63 60 64 @end 61 65 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
r246270 r246300 6199 6199 CGSize imageSize = CGSizeMake(imageWidth, imageHeight); 6200 6200 6201 if ([[_customContentView class] web_requiresCustomSnapshotting]) { 6202 [_customContentView web_snapshotRectInContentViewCoordinates:snapshotRectInContentCoordinates snapshotWidth:imageWidth completionHandler:completionHandler]; 6203 return; 6204 } 6205 6201 6206 #if HAVE(CORE_ANIMATION_RENDER_SERVER) && HAVE(IOSURFACE) 6202 6207 // If we are parented and thus won't incur a significant penalty from paging in tiles, snapshot the view hierarchy directly. … … 6217 6222 6218 6223 if (_customContentView) { 6224 ASSERT(![[_customContentView class] web_requiresCustomSnapshotting]); 6219 6225 UIGraphicsBeginImageContextWithOptions(imageSize, YES, 1); 6220 6226 -
trunk/Source/WebKit/UIProcess/Cocoa/WKWebViewContentProvider.h
r242339 r246300 53 53 - (void)web_hideFindUI; 54 54 @property (nonatomic, readonly) UIView *web_contentView; 55 @property (nonatomic, readonly, class) BOOL web_requiresCustomSnapshotting; 55 56 56 57 @optional … … 61 62 - (void)web_beginAnimatedResizeWithUpdates:(void (^)(void))updateBlock; 62 63 - (BOOL)web_handleKeyEvent:(UIEvent *)event; 64 - (void)web_snapshotRectInContentViewCoordinates:(CGRect)contentViewCoordinates snapshotWidth:(CGFloat)snapshotWidth completionHandler:(void (^)(CGImageRef))completionHandler; 63 65 @property (nonatomic, readonly) NSData *web_dataRepresentation; 64 66 @property (nonatomic, readonly) NSString *web_suggestedFilename; -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r246239 r246300 7566 7566 auto previewActions = adoptNS([[NSMutableArray alloc] init]); 7567 7567 for (_WKElementAction *elementAction in actions.get()) { 7568 ALLOW_DEPRECATED_DECLARATIONS_BEGIN 7568 7569 WKPreviewAction *previewAction = [WKPreviewAction actionWithIdentifier:previewIdentifierForElementAction(elementAction) title:[elementAction title] style:UIPreviewActionStyleDefault handler:^(UIPreviewAction *, UIViewController *) { 7569 7570 [elementAction runActionWithElementInfo:elementInfo.get()]; 7570 7571 }]; 7572 ALLOW_DEPRECATED_DECLARATIONS_END 7571 7573 [previewActions addObject:previewAction]; 7572 7574 } -
trunk/Source/WebKit/UIProcess/ios/WKPDFView.mm
r246116 r246300 46 46 #import <wtf/RetainPtr.h> 47 47 #import <wtf/WeakObjCPtr.h> 48 #import <wtf/cocoa/Entitlements.h> 48 49 #import <wtf/cocoa/NSURLExtras.h> 49 50 … … 358 359 } 359 360 361 + (BOOL)web_requiresCustomSnapshotting 362 { 363 #if HAVE(PDFHOSTVIEWCONTROLLER_SNAPSHOTTING) 364 static bool hasGlobalCaptureEntitlement = WTF::processHasEntitlement("com.apple.QuartzCore.global-capture"); 365 return !hasGlobalCaptureEntitlement; 366 #else 367 return false; 368 #endif 369 } 370 360 371 - (void)web_scrollViewDidScroll:(UIScrollView *)scrollView 361 372 { … … 383 394 updateBlock(); 384 395 [_hostViewController endPDFViewRotation]; 396 } 397 398 - (void)web_snapshotRectInContentViewCoordinates:(CGRect)rectInContentViewCoordinates snapshotWidth:(CGFloat)snapshotWidth completionHandler:(void (^)(CGImageRef))completionHandler 399 { 400 #if HAVE(PDFHOSTVIEWCONTROLLER_SNAPSHOTTING) 401 CGRect rectInHostViewCoordinates = [self._contentView convertRect:rectInContentViewCoordinates toView:[_hostViewController view]]; 402 [_hostViewController snapshotViewRect:rectInHostViewCoordinates snapshotWidth:@(snapshotWidth) afterScreenUpdates:NO withResult:^(UIImage *image) { 403 completionHandler(image.CGImage); 404 }]; 405 #endif 385 406 } 386 407 -
trunk/Source/WebKit/UIProcess/ios/WKSystemPreviewView.mm
r244201 r246300 145 145 } 146 146 147 + (BOOL)web_requiresCustomSnapshotting 148 { 149 return false; 150 } 151 147 152 - (void)web_setMinimumSize:(CGSize)size 148 153 {
Note: See TracChangeset
for help on using the changeset viewer.