Title: [231157] trunk/Source/WebKit
- Revision
- 231157
- Author
- aes...@apple.com
- Date
- 2018-04-30 09:16:40 -0700 (Mon, 30 Apr 2018)
Log Message
[iOS] Try to unlock PDF documents before printing them
https://bugs.webkit.org/show_bug.cgi?id=185084
<rdar://problem/39356622>
Reviewed by Dan Bernstein.
* UIProcess/ios/WKPDFView.mm:
(-[WKPDFView pdfHostViewController:documentDidUnlockWithPassword:]):
Stored the password that successfully unlocked the current PDF document.
(-[WKPDFView _wk_printedDocument]):
Used the stored password to unlock the CGPDFDocument we create for printing.
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (231156 => 231157)
--- trunk/Source/WebKit/ChangeLog 2018-04-30 15:16:14 UTC (rev 231156)
+++ trunk/Source/WebKit/ChangeLog 2018-04-30 16:16:40 UTC (rev 231157)
@@ -1,3 +1,20 @@
+2018-04-30 Andy Estes <aes...@apple.com>
+
+ [iOS] Try to unlock PDF documents before printing them
+ https://bugs.webkit.org/show_bug.cgi?id=185084
+ <rdar://problem/39356622>
+
+ Reviewed by Dan Bernstein.
+
+ * UIProcess/ios/WKPDFView.mm:
+ (-[WKPDFView pdfHostViewController:documentDidUnlockWithPassword:]):
+
+ Stored the password that successfully unlocked the current PDF document.
+
+ (-[WKPDFView _wk_printedDocument]):
+
+ Used the stored password to unlock the CGPDFDocument we create for printing.
+
2018-04-28 Andy Estes <aes...@apple.com>
[iOS] Present an action sheet when long-pressing on PDF links
Modified: trunk/Source/WebKit/UIProcess/ios/WKPDFView.mm (231156 => 231157)
--- trunk/Source/WebKit/UIProcess/ios/WKPDFView.mm 2018-04-30 15:16:14 UTC (rev 231156)
+++ trunk/Source/WebKit/UIProcess/ios/WKPDFView.mm 2018-04-30 16:16:40 UTC (rev 231157)
@@ -57,6 +57,7 @@
RetainPtr<PDFHostViewController> _hostViewController;
CGSize _overlaidAccessoryViewsInset;
RetainPtr<UIView> _pageNumberIndicator;
+ RetainPtr<NSString> _password;
WebKit::InteractionInformationAtPosition _positionInformation;
RetainPtr<NSString> _suggestedFilename;
WebKit::WeakObjCPtr<WKWebView> _webView;
@@ -359,6 +360,11 @@
[self _scrollToURLFragment:[_webView URL].fragment];
}
+- (void)pdfHostViewController:(PDFHostViewController *)controller documentDidUnlockWithPassword:(NSString *)password
+{
+ _password = adoptNS([password copy]);
+}
+
- (void)pdfHostViewController:(PDFHostViewController *)controller findStringUpdate:(NSUInteger)numFound done:(BOOL)done
{
// FIXME: We should stop searching once numFound exceeds _findStringMaxCount, but PDFKit doesn't
@@ -498,7 +504,10 @@
- (CGPDFDocumentRef)_wk_printedDocument
{
auto dataProvider = adoptCF(CGDataProviderCreateWithCFData((CFDataRef)_data.get()));
- return adoptCF(CGPDFDocumentCreateWithProvider(dataProvider.get())).autorelease();
+ auto pdfDocument = adoptCF(CGPDFDocumentCreateWithProvider(dataProvider.get()));
+ if (!CGPDFDocumentIsUnlocked(pdfDocument.get()))
+ CGPDFDocumentUnlockWithPassword(pdfDocument.get(), [_password UTF8String]);
+ return pdfDocument.autorelease();
}
@end
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes