WebKit Bugzilla
Attachment 371781 Details for
Bug 198731
: [iOS] Use PDFKit SPI for taking snapshots when the hosting app is not entitled for global capture
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-198731-20190610145853.patch (text/plain), 6.42 KB, created by
Andy Estes
on 2019-06-10 14:58:55 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Andy Estes
Created:
2019-06-10 14:58:55 PDT
Size:
6.42 KB
patch
obsolete
>Subversion Revision: 246240 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index caffdadc064c5c777f7d8171ac8fb38000f48ad1..a1298364e1843196ab261acc5b64624939ae848d 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,29 @@ >+2019-06-10 Andy Estes <aestes@apple.com> >+ >+ [iOS] Use PDFKit SPI for taking snapshots when the hosting app is not entitled for global capture >+ https://bugs.webkit.org/show_bug.cgi?id=198731 >+ <rdar://problem/46215174> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ PDFHostViewController renders PDF contents in a view service, and apps are unable to >+ snapshot views rendered out-of-process without an entitlement. >+ >+ When an app is missing this entitlement and calls WKWebView's >+ takeSnapshotWithConfiguration: API when a PDF is displayed, fall back to calling >+ PDFHostViewController's snapshotting SPI. >+ >+ Testing is blocked by <https://webkit.org/b/175204>. >+ >+ * UIProcess/API/Cocoa/WKWebView.mm: >+ (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]): >+ * UIProcess/Cocoa/WKWebViewContentProvider.h: >+ * UIProcess/ios/WKPDFView.mm: >+ (+[WKPDFView web_requiresCustomSnapshotting]): >+ (-[WKPDFView web_snapshotRectInContentViewCoordinates:snapshotWidth:completionHandler:]): >+ * UIProcess/ios/WKSystemPreviewView.mm: >+ (+[WKSystemPreviewView web_requiresCustomSnapshotting]): >+ > 2019-06-08 Dean Jackson <dino@apple.com> > > Drag starting state can get stuck even though the drag has ended >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm b/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >index b2bf98f73edb30ee6f41935a89979aaeeedd0418..48ba322f97da7411b285149edb4362497a9a69c6 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >@@ -6188,6 +6188,11 @@ - (void)_snapshotRect:(CGRect)rectInViewCoordinates intoImageOfWidth:(CGFloat)im > CGFloat imageHeight = imageScale * snapshotRectInContentCoordinates.size.height; > CGSize imageSize = CGSizeMake(imageWidth, imageHeight); > >+ if ([[_customContentView class] web_requiresCustomSnapshotting]) { >+ [_customContentView web_snapshotRectInContentViewCoordinates:snapshotRectInContentCoordinates snapshotWidth:imageWidth completionHandler:completionHandler]; >+ return; >+ } >+ > #if HAVE(CORE_ANIMATION_RENDER_SERVER) && HAVE(IOSURFACE) > // If we are parented and thus won't incur a significant penalty from paging in tiles, snapshot the view hierarchy directly. > if (NSString *displayName = self.window.screen.displayConfiguration.name) { >@@ -6206,6 +6211,7 @@ - (void)_snapshotRect:(CGRect)rectInViewCoordinates intoImageOfWidth:(CGFloat)im > #endif > > if (_customContentView) { >+ ASSERT(![[_customContentView class] web_requiresCustomSnapshotting]); > UIGraphicsBeginImageContextWithOptions(imageSize, YES, 1); > > UIView *customContentView = _customContentView.get(); >diff --git a/Source/WebKit/UIProcess/Cocoa/WKWebViewContentProvider.h b/Source/WebKit/UIProcess/Cocoa/WKWebViewContentProvider.h >index 0a3b1c94e97632f6d43409ecd7c67b836f20cfd5..8d8a94273748219cf4737e9a17272ce6bccbee74 100644 >--- a/Source/WebKit/UIProcess/Cocoa/WKWebViewContentProvider.h >+++ b/Source/WebKit/UIProcess/Cocoa/WKWebViewContentProvider.h >@@ -52,6 +52,7 @@ struct UIEdgeInsets; > - (void)web_findString:(NSString *)string options:(_WKFindOptions)options maxCount:(NSUInteger)maxCount; > - (void)web_hideFindUI; > @property (nonatomic, readonly) UIView *web_contentView; >+@property (nonatomic, readonly, class) BOOL web_requiresCustomSnapshotting; > > @optional > - (void)web_scrollViewDidScroll:(UIScrollView *)scrollView; >@@ -60,6 +61,7 @@ struct UIEdgeInsets; > - (void)web_scrollViewDidZoom:(UIScrollView *)scrollView; > - (void)web_beginAnimatedResizeWithUpdates:(void (^)(void))updateBlock; > - (BOOL)web_handleKeyEvent:(UIEvent *)event; >+- (void)web_snapshotRectInContentViewCoordinates:(CGRect)contentViewCoordinates snapshotWidth:(CGFloat)snapshotWidth completionHandler:(void (^)(CGImageRef))completionHandler; > @property (nonatomic, readonly) NSData *web_dataRepresentation; > @property (nonatomic, readonly) NSString *web_suggestedFilename; > @property (nonatomic, readonly) BOOL web_isBackground; >diff --git a/Source/WebKit/UIProcess/ios/WKPDFView.mm b/Source/WebKit/UIProcess/ios/WKPDFView.mm >index 6c500fdad47d532103021f91b0df31b63cbade74..aebf6e53b23f013074ca528972494e88795702d4 100644 >--- a/Source/WebKit/UIProcess/ios/WKPDFView.mm >+++ b/Source/WebKit/UIProcess/ios/WKPDFView.mm >@@ -45,6 +45,7 @@ > #import <wtf/MainThread.h> > #import <wtf/RetainPtr.h> > #import <wtf/WeakObjCPtr.h> >+#import <wtf/cocoa/Entitlements.h> > #import <wtf/cocoa/NSURLExtras.h> > > @interface WKPDFView () <PDFHostViewControllerDelegate, WKActionSheetAssistantDelegate> >@@ -357,6 +358,12 @@ - (UIView *)web_contentView > return self._contentView; > } > >++ (BOOL)web_requiresCustomSnapshotting >+{ >+ static bool hasGlobalCaptureEntitlement = WTF::processHasEntitlement("com.apple.QuartzCore.global-capture"); >+ return !hasGlobalCaptureEntitlement; >+} >+ > - (void)web_scrollViewDidScroll:(UIScrollView *)scrollView > { > [_hostViewController updatePDFViewLayout]; >@@ -384,6 +391,14 @@ - (void)web_beginAnimatedResizeWithUpdates:(void (^)(void))updateBlock > [_hostViewController endPDFViewRotation]; > } > >+- (void)web_snapshotRectInContentViewCoordinates:(CGRect)rectInContentViewCoordinates snapshotWidth:(CGFloat)snapshotWidth completionHandler:(void (^)(CGImageRef))completionHandler >+{ >+ CGRect rectInHostViewCoordinates = [self._contentView convertRect:rectInContentViewCoordinates toView:[_hostViewController view]]; >+ [_hostViewController snapshotViewRect:rectInHostViewCoordinates snapshotWidth:@(snapshotWidth) afterScreenUpdates:NO withResult:^(UIImage *image) { >+ completionHandler(image.CGImage); >+ }]; >+} >+ > - (NSData *)web_dataRepresentation > { > return _data.get(); >diff --git a/Source/WebKit/UIProcess/ios/WKSystemPreviewView.mm b/Source/WebKit/UIProcess/ios/WKSystemPreviewView.mm >index ba2e6da011f37851c2126d7a40ec3b5547aabf9f..14f04b995bc97a6482f9b91ed1790d5321928035 100644 >--- a/Source/WebKit/UIProcess/ios/WKSystemPreviewView.mm >+++ b/Source/WebKit/UIProcess/ios/WKSystemPreviewView.mm >@@ -144,6 +144,11 @@ - (UIView *)web_contentView > return self; > } > >++ (BOOL)web_requiresCustomSnapshotting >+{ >+ return false; >+} >+ > - (void)web_setMinimumSize:(CGSize)size > { > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 198731
:
371781
|
371786