Title: [229182] trunk/Source
Revision
229182
Author
timothy_hor...@apple.com
Date
2018-03-02 10:33:54 -0800 (Fri, 02 Mar 2018)

Log Message

Make it possible to disable WKPDFView
https://bugs.webkit.org/show_bug.cgi?id=183281

Reviewed by Dan Bates.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _isBackground]):
(-[WKWebView _isDisplayingPDF]):
(-[WKWebView _dataForDisplayedPDF]):
(-[WKWebView _suggestedFilenameForDisplayedPDF]):
* UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
(-[WKWebViewContentProviderRegistry init]):
* UIProcess/ios/WKPDFView.h:
* UIProcess/ios/WKPDFView.mm:

* wtf/FeatureDefines.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (229181 => 229182)


--- trunk/Source/WTF/ChangeLog	2018-03-02 18:29:42 UTC (rev 229181)
+++ trunk/Source/WTF/ChangeLog	2018-03-02 18:33:54 UTC (rev 229182)
@@ -1,3 +1,13 @@
+2018-03-02  Tim Horton  <timothy_hor...@apple.com>
+
+        Make it possible to disable WKPDFView
+        https://bugs.webkit.org/show_bug.cgi?id=183281
+        <rdar://problem/38060815>
+
+        Reviewed by Dan Bates.
+
+        * wtf/FeatureDefines.h:
+
 2018-03-02  Yusuke Suzuki  <utatane....@gmail.com>
 
         [JSC] Annotate more classes with WTF_MAKE_FAST_ALLOCATED

Modified: trunk/Source/WTF/wtf/FeatureDefines.h (229181 => 229182)


--- trunk/Source/WTF/wtf/FeatureDefines.h	2018-03-02 18:29:42 UTC (rev 229181)
+++ trunk/Source/WTF/wtf/FeatureDefines.h	2018-03-02 18:33:54 UTC (rev 229182)
@@ -160,6 +160,12 @@
 #define ENABLE_DOWNLOAD_ATTRIBUTE 0
 #endif
 
+#if !defined(ENABLE_WKPDFVIEW)
+#if !PLATFORM(WATCHOS) && !PLATFORM(APPLETV)
+#define ENABLE_WKPDFVIEW 1
+#endif
+#endif
+
 #endif /* PLATFORM(IOS) */
 
 /* --------- Apple MAC port (not IOS) --------- */

Modified: trunk/Source/WebKit/ChangeLog (229181 => 229182)


--- trunk/Source/WebKit/ChangeLog	2018-03-02 18:29:42 UTC (rev 229181)
+++ trunk/Source/WebKit/ChangeLog	2018-03-02 18:33:54 UTC (rev 229182)
@@ -1,3 +1,21 @@
+2018-03-02  Tim Horton  <timothy_hor...@apple.com>
+
+        Make it possible to disable WKPDFView
+        https://bugs.webkit.org/show_bug.cgi?id=183281
+        <rdar://problem/38060815>
+
+        Reviewed by Dan Bates.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _isBackground]):
+        (-[WKWebView _isDisplayingPDF]):
+        (-[WKWebView _dataForDisplayedPDF]):
+        (-[WKWebView _suggestedFilenameForDisplayedPDF]):
+        * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
+        (-[WKWebViewContentProviderRegistry init]):
+        * UIProcess/ios/WKPDFView.h:
+        * UIProcess/ios/WKPDFView.mm:
+
 2018-03-02  Youenn Fablet  <you...@apple.com>
 
         WebProcessProxy should handle its completion handler at destruction time

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (229181 => 229182)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2018-03-02 18:29:42 UTC (rev 229181)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2018-03-02 18:33:54 UTC (rev 229182)
@@ -1294,9 +1294,10 @@
 
 - (BOOL)_isBackground
 {
+#if ENABLE(WKPDFVIEW)
     if ([self _isDisplayingPDF])
         return [(WKPDFView *)_customContentView isBackground];
-
+#endif
     return [_contentView isBackground];
 }
 
@@ -5402,22 +5403,34 @@
 
 - (BOOL)_isDisplayingPDF
 {
+#if ENABLE(WKPDFVIEW)
     return [_customContentView isKindOfClass:[WKPDFView class]];
+#else
+    return NO;
+#endif
 }
 
 - (NSData *)_dataForDisplayedPDF
 {
+#if ENABLE(WKPDFVIEW)
     if (![self _isDisplayingPDF])
         return nil;
     CGPDFDocumentRef pdfDocument = [(WKPDFView *)_customContentView pdfDocument];
     return [(NSData *)CGDataProviderCopyData(CGPDFDocumentGetDataProvider(pdfDocument)) autorelease];
+#else
+    return nil;
+#endif
 }
 
 - (NSString *)_suggestedFilenameForDisplayedPDF
 {
+#if ENABLE(WKPDFVIEW)
     if (![self _isDisplayingPDF])
         return nil;
     return [(WKPDFView *)_customContentView.get() suggestedFilename];
+#else
+    return nil;
+#endif
 }
 
 - (_WKWebViewPrintFormatter *)_webViewPrintFormatter

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm (229181 => 229182)


--- trunk/Source/WebKit/UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm	2018-03-02 18:29:42 UTC (rev 229181)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm	2018-03-02 18:33:54 UTC (rev 229182)
@@ -51,8 +51,10 @@
     if (!(self = [super init]))
         return nil;
 
+#if ENABLE(WKPDFVIEW)
     for (auto& mimeType : WebCore::MIMETypeRegistry::getPDFMIMETypes())
         [self registerProvider:[WKPDFView class] forMIMEType:mimeType];
+#endif
 
     return self;
 }

Modified: trunk/Source/WebKit/UIProcess/ios/WKPDFView.h (229181 => 229182)


--- trunk/Source/WebKit/UIProcess/ios/WKPDFView.h	2018-03-02 18:29:42 UTC (rev 229181)
+++ trunk/Source/WebKit/UIProcess/ios/WKPDFView.h	2018-03-02 18:33:54 UTC (rev 229182)
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#if PLATFORM(IOS)
+#if PLATFORM(IOS) && ENABLE(WKPDFVIEW)
 
 #import "CorePDFSPI.h"
 #import "WKActionSheetAssistant.h"
@@ -37,4 +37,4 @@
 
 @end
 
-#endif // PLATFORM(IOS)
+#endif // PLATFORM(IOS) && ENABLE(WKPDFVIEW)

Modified: trunk/Source/WebKit/UIProcess/ios/WKPDFView.mm (229181 => 229182)


--- trunk/Source/WebKit/UIProcess/ios/WKPDFView.mm	2018-03-02 18:29:42 UTC (rev 229181)
+++ trunk/Source/WebKit/UIProcess/ios/WKPDFView.mm	2018-03-02 18:33:54 UTC (rev 229182)
@@ -26,7 +26,7 @@
 #import "config.h"
 #import "WKPDFView.h"
 
-#if PLATFORM(IOS)
+#if PLATFORM(IOS) && ENABLE(WKPDFVIEW)
 
 #import "APIFindClient.h"
 #import "APIUIClient.h"
@@ -892,4 +892,4 @@
 
 #pragma clang diagnostic pop
 
-#endif /* PLATFORM(IOS) */
+#endif // PLATFORM(IOS) && ENABLE(WKPDFVIEW)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to