Title: [273833] trunk/Source
Revision
273833
Author
timothy_hor...@apple.com
Date
2021-03-03 13:04:47 -0800 (Wed, 03 Mar 2021)

Log Message

Modernize WebKit2 PDFKit softlinking
https://bugs.webkit.org/show_bug.cgi?id=222643

Reviewed by Alex Christensen.

Source/WebKit:

WebKit2 has long had an unusual way of softlinking PDFKit, using NSBundle.
It has caused much trouble in the past, because it means that running
WebKit against a custom PDFKit requires either installing it into
the system, or changing the hardcoded path.

Instead of this, just use the normal softlinking macros that the rest
of WebKit uses.

* Shared/Cocoa/PDFKitSoftLink.h: Added.
* Shared/Cocoa/PDFKitSoftLink.mm: Added.
* Shared/mac/PDFKitImports.h: Removed.
* Shared/mac/PDFKitImports.mm: Removed.
* SourcesCocoa.txt:
* UIProcess/mac/WKPrintingView.mm:
(-[WKPrintingView _drawPDFDocument:page:atPoint:]):
(-[WKPrintingView drawRect:]):
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/Plugins/PDF/PDFPlugin.h:
* WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::PDFPlugin):
(WebKit::PDFPlugin::receivedNonLinearizedPDFSentinel):
(WebKit::PDFPlugin::threadEntry):
(WebKit::PDFPlugin::documentDataDidFinishLoading):
(WebKit::PDFPlugin::setActiveAnnotation):
(WebKit::PDFPlugin::nextMatchForString):
(WebKit:: const):
* WebProcess/Plugins/PDF/PDFPluginAnnotation.mm:
(WebKit::PDFPluginAnnotation::create):
* WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm:
* WebProcess/Plugins/PDF/PDFPluginPasswordField.mm:
* WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm:
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::shouldUsePDFPlugin const):
(WebKit::drawPDFPage):

Source/WTF:

* wtf/PlatformHave.h:

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (273832 => 273833)


--- trunk/Source/WTF/ChangeLog	2021-03-03 20:54:26 UTC (rev 273832)
+++ trunk/Source/WTF/ChangeLog	2021-03-03 21:04:47 UTC (rev 273833)
@@ -1,3 +1,12 @@
+2021-03-03  Tim Horton  <timothy_hor...@apple.com>
+
+        Modernize WebKit2 PDFKit softlinking
+        https://bugs.webkit.org/show_bug.cgi?id=222643
+
+        Reviewed by Alex Christensen.
+
+        * wtf/PlatformHave.h:
+
 2021-03-03  Alex Christensen  <achristen...@webkit.org>
 
         Limit HashTable entry size to 500 bytes

Modified: trunk/Source/WTF/wtf/PlatformHave.h (273832 => 273833)


--- trunk/Source/WTF/wtf/PlatformHave.h	2021-03-03 20:54:26 UTC (rev 273832)
+++ trunk/Source/WTF/wtf/PlatformHave.h	2021-03-03 21:04:47 UTC (rev 273833)
@@ -920,3 +920,7 @@
 #if PLATFORM(IOS_FAMILY) && !PLATFORM(MACCATALYST)
 #define HAVE_NSURL_TITLE 1
 #endif
+
+#if PLATFORM(MAC) || PLATFORM(IOS) || PLATFORM(MACCATALYST)
+#define HAVE_PDFKIT 1
+#endif

Modified: trunk/Source/WebKit/ChangeLog (273832 => 273833)


--- trunk/Source/WebKit/ChangeLog	2021-03-03 20:54:26 UTC (rev 273832)
+++ trunk/Source/WebKit/ChangeLog	2021-03-03 21:04:47 UTC (rev 273833)
@@ -1,3 +1,45 @@
+2021-03-03  Tim Horton  <timothy_hor...@apple.com>
+
+        Modernize WebKit2 PDFKit softlinking
+        https://bugs.webkit.org/show_bug.cgi?id=222643
+
+        Reviewed by Alex Christensen.
+
+        WebKit2 has long had an unusual way of softlinking PDFKit, using NSBundle.
+        It has caused much trouble in the past, because it means that running
+        WebKit against a custom PDFKit requires either installing it into
+        the system, or changing the hardcoded path.
+
+        Instead of this, just use the normal softlinking macros that the rest
+        of WebKit uses.
+
+        * Shared/Cocoa/PDFKitSoftLink.h: Added.
+        * Shared/Cocoa/PDFKitSoftLink.mm: Added.
+        * Shared/mac/PDFKitImports.h: Removed.
+        * Shared/mac/PDFKitImports.mm: Removed.
+        * SourcesCocoa.txt:
+        * UIProcess/mac/WKPrintingView.mm:
+        (-[WKPrintingView _drawPDFDocument:page:atPoint:]):
+        (-[WKPrintingView drawRect:]):
+        * WebKit.xcodeproj/project.pbxproj:
+        * WebProcess/Plugins/PDF/PDFPlugin.h:
+        * WebProcess/Plugins/PDF/PDFPlugin.mm:
+        (WebKit::PDFPlugin::PDFPlugin):
+        (WebKit::PDFPlugin::receivedNonLinearizedPDFSentinel):
+        (WebKit::PDFPlugin::threadEntry):
+        (WebKit::PDFPlugin::documentDataDidFinishLoading):
+        (WebKit::PDFPlugin::setActiveAnnotation):
+        (WebKit::PDFPlugin::nextMatchForString):
+        (WebKit:: const):
+        * WebProcess/Plugins/PDF/PDFPluginAnnotation.mm:
+        (WebKit::PDFPluginAnnotation::create):
+        * WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm:
+        * WebProcess/Plugins/PDF/PDFPluginPasswordField.mm:
+        * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm:
+        * WebProcess/WebPage/mac/WebPageMac.mm:
+        (WebKit::WebPage::shouldUsePDFPlugin const):
+        (WebKit::drawPDFPage):
+
 2021-03-03  Alex Christensen  <achristen...@webkit.org>
 
         Limit HashTable entry size to 500 bytes

Added: trunk/Source/WebKit/Shared/Cocoa/PDFKitSoftLink.h (0 => 273833)


--- trunk/Source/WebKit/Shared/Cocoa/PDFKitSoftLink.h	                        (rev 0)
+++ trunk/Source/WebKit/Shared/Cocoa/PDFKitSoftLink.h	2021-03-03 21:04:47 UTC (rev 273833)
@@ -0,0 +1,45 @@
+/*
+* Copyright (C) 2021 Apple Inc. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+* 1. Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+* 2. Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in the
+*    documentation and/or other materials provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+* THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#pragma once
+
+#if HAVE(PDFKIT)
+
+#import <PDFKit/PDFKit.h>
+
+#import <wtf/SoftLinking.h>
+
+SOFT_LINK_FRAMEWORK_FOR_HEADER(WebKit, PDFKit)
+
+ALLOW_DEPRECATED_DECLARATIONS_BEGIN
+SOFT_LINK_CLASS_FOR_HEADER(WebKit, PDFAnnotationLink)
+SOFT_LINK_CLASS_FOR_HEADER(WebKit, PDFDocument)
+SOFT_LINK_CLASS_FOR_HEADER(WebKit, PDFLayerController)
+SOFT_LINK_CLASS_FOR_HEADER(WebKit, PDFAnnotationTextWidget)
+SOFT_LINK_CLASS_FOR_HEADER(WebKit, PDFAnnotationChoiceWidget)
+SOFT_LINK_CLASS_FOR_HEADER(WebKit, PDFSelection)
+ALLOW_DEPRECATED_DECLARATIONS_END
+
+#endif // HAVE(PDFKIT)

Added: trunk/Source/WebKit/Shared/Cocoa/PDFKitSoftLink.mm (0 => 273833)


--- trunk/Source/WebKit/Shared/Cocoa/PDFKitSoftLink.mm	                        (rev 0)
+++ trunk/Source/WebKit/Shared/Cocoa/PDFKitSoftLink.mm	2021-03-03 21:04:47 UTC (rev 273833)
@@ -0,0 +1,43 @@
+/*
+* Copyright (C) 2021 Apple Inc. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+* 1. Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+* 2. Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in the
+*    documentation and/or other materials provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+* THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#import "config.h"
+
+#if HAVE(PDFKIT)
+
+#import <wtf/SoftLinking.h>
+
+SOFT_LINK_FRAMEWORK_FOR_SOURCE(WebKit, PDFKit)
+
+ALLOW_DEPRECATED_DECLARATIONS_BEGIN
+SOFT_LINK_CLASS_FOR_SOURCE(WebKit, PDFKit, PDFAnnotationLink)
+SOFT_LINK_CLASS_FOR_SOURCE(WebKit, PDFKit, PDFDocument)
+SOFT_LINK_CLASS_FOR_SOURCE(WebKit, PDFKit, PDFLayerController)
+SOFT_LINK_CLASS_FOR_SOURCE(WebKit, PDFKit, PDFAnnotationTextWidget)
+SOFT_LINK_CLASS_FOR_SOURCE(WebKit, PDFKit, PDFAnnotationChoiceWidget)
+SOFT_LINK_CLASS_FOR_SOURCE(WebKit, PDFKit, PDFSelection)
+ALLOW_DEPRECATED_DECLARATIONS_END
+
+#endif // HAVE(PDFKIT)

Deleted: trunk/Source/WebKit/Shared/mac/PDFKitImports.h (273832 => 273833)


--- trunk/Source/WebKit/Shared/mac/PDFKitImports.h	2021-03-03 20:54:26 UTC (rev 273832)
+++ trunk/Source/WebKit/Shared/mac/PDFKitImports.h	2021-03-03 21:04:47 UTC (rev 273833)
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef PDFKitImports_h
-#define PDFKitImports_h
-
-#if PLATFORM(MAC)
-
-namespace WebKit {
-
-NSString *pdfKitFrameworkPath();
-Class classFromPDFKit(NSString *className);
-Class pdfAnnotationLinkClass();
-Class pdfDocumentClass();
-
-#if ENABLE(PDFKIT_PLUGIN)
-Class pdfLayerControllerClass();
-Class pdfAnnotationTextWidgetClass();
-Class pdfAnnotationChoiceWidgetClass();
-Class pdfSelectionClass();
-#endif
-
-}
-
-#endif // PLATFORM(MAC)
-
-#endif // PDFKitImports_h

Deleted: trunk/Source/WebKit/Shared/mac/PDFKitImports.mm (273832 => 273833)


--- trunk/Source/WebKit/Shared/mac/PDFKitImports.mm	2021-03-03 20:54:26 UTC (rev 273832)
+++ trunk/Source/WebKit/Shared/mac/PDFKitImports.mm	2021-03-03 21:04:47 UTC (rev 273833)
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "config.h"
-#import "PDFKitImports.h"
-
-#if PLATFORM(MAC)
-
-namespace WebKit {
-
-NSString *pdfKitFrameworkPath()
-{
-    NSString *systemLibraryPath = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSSystemDomainMask, NO) objectAtIndex:0];
-    return [systemLibraryPath stringByAppendingPathComponent:@"Frameworks/Quartz.framework/Frameworks/PDFKit.framework"];
-}
-
-Class classFromPDFKit(NSString *className)
-{
-    static NSBundle *pdfKitBundle = [NSBundle bundleWithPath:pdfKitFrameworkPath()];
-    [pdfKitBundle load];
-    return [pdfKitBundle classNamed:className];
-}
-
-Class pdfAnnotationLinkClass()
-{
-    static Class pdfAnnotationLinkClass = classFromPDFKit(@"PDFAnnotationLink");
-    ASSERT(pdfAnnotationLinkClass);
-    return pdfAnnotationLinkClass;
-}
-
-Class pdfDocumentClass()
-{
-    static Class pdfDocumentClass = classFromPDFKit(@"PDFDocument");
-    ASSERT(pdfDocumentClass);
-    return pdfDocumentClass;
-}
-    
-#if ENABLE(PDFKIT_PLUGIN)
-Class pdfLayerControllerClass()
-{
-    static Class pdfLayerControllerClass = classFromPDFKit(@"PDFLayerController");
-    ASSERT(pdfLayerControllerClass);
-    return pdfLayerControllerClass;
-}
-
-Class pdfAnnotationTextWidgetClass()
-{
-    static Class pdfAnnotationTextWidgetClass = classFromPDFKit(@"PDFAnnotationTextWidget");
-    ASSERT(pdfAnnotationTextWidgetClass);
-    return pdfAnnotationTextWidgetClass;
-}
-
-Class pdfAnnotationChoiceWidgetClass()
-{
-    static Class pdfAnnotationChoiceWidgetClass = classFromPDFKit(@"PDFAnnotationChoiceWidget");
-    ASSERT(pdfAnnotationChoiceWidgetClass);
-    return pdfAnnotationChoiceWidgetClass;
-}
-
-Class pdfSelectionClass()
-{
-    static Class pdfSelectionClass = classFromPDFKit(@"PDFSelection");
-    ASSERT(pdfSelectionClass);
-    return pdfSelectionClass;
-}
-
-#endif
-
-}
-
-#endif // PLATFORM(MAC)

Modified: trunk/Source/WebKit/SourcesCocoa.txt (273832 => 273833)


--- trunk/Source/WebKit/SourcesCocoa.txt	2021-03-03 20:54:26 UTC (rev 273832)
+++ trunk/Source/WebKit/SourcesCocoa.txt	2021-03-03 21:04:47 UTC (rev 273833)
@@ -159,6 +159,7 @@
 Shared/Cocoa/DataDetectionResult.mm
 Shared/Cocoa/InsertTextOptions.cpp
 Shared/Cocoa/LoadParametersCocoa.mm
+Shared/Cocoa/PDFKitSoftLink.mm
 Shared/Cocoa/SandboxExtensionCocoa.mm
 Shared/Cocoa/SandboxInitialiationParametersCocoa.mm
 Shared/Cocoa/SandboxUtilities.mm
@@ -204,7 +205,6 @@
 Shared/mac/NativeWebWheelEventMac.mm
 Shared/mac/ObjCObjectGraph.mm
 Shared/mac/PasteboardTypes.mm
-Shared/mac/PDFKitImports.mm
 Shared/mac/PrintInfoMac.mm
 Shared/mac/SecItemRequestData.cpp
 Shared/mac/SecItemResponseData.cpp

Modified: trunk/Source/WebKit/UIProcess/mac/WKPrintingView.mm (273832 => 273833)


--- trunk/Source/WebKit/UIProcess/mac/WKPrintingView.mm	2021-03-03 20:54:26 UTC (rev 273832)
+++ trunk/Source/WebKit/UIProcess/mac/WKPrintingView.mm	2021-03-03 21:04:47 UTC (rev 273833)
@@ -30,7 +30,7 @@
 
 #import "APIData.h"
 #import "Logging.h"
-#import "PDFKitImports.h"
+#import "PDFKitSoftLink.h"
 #import "PrintInfo.h"
 #import "ShareableBitmap.h"
 #import "WebPageProxy.h"
@@ -486,7 +486,7 @@
     }
 
     for (PDFAnnotation *annotation in [pdfPage annotations]) {
-        if (![annotation isKindOfClass:WebKit::pdfAnnotationLinkClass()])
+        if (![annotation isKindOfClass:WebKit::getPDFAnnotationLinkClass()])
             continue;
 
         ALLOW_DEPRECATED_DECLARATIONS_BEGIN
@@ -584,7 +584,7 @@
 
     if (!_printedPagesPDFDocument) {
         RetainPtr<NSData> pdfData = adoptNS([[NSData alloc] initWithBytes:_printedPagesData.data() length:_printedPagesData.size()]);
-        _printedPagesPDFDocument = adoptNS([[WebKit::pdfDocumentClass() alloc] initWithData:pdfData.get()]);
+        _printedPagesPDFDocument = adoptNS([WebKit::allocPDFDocumentInstance() initWithData:pdfData.get()]);
 
         unsigned pageCount = [_printedPagesPDFDocument pageCount];
         _linkDestinationsPerPage.clear();
@@ -592,7 +592,7 @@
         for (unsigned i = 0; i < pageCount; i++) {
             PDFPage *page = [_printedPagesPDFDocument pageAtIndex:i];
             for (PDFAnnotation *annotation in page.annotations) {
-                if (![annotation isKindOfClass:WebKit::pdfAnnotationLinkClass()])
+                if (![annotation isKindOfClass:WebKit::getPDFAnnotationLinkClass()])
                     continue;
 
                 ALLOW_DEPRECATED_DECLARATIONS_BEGIN

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (273832 => 273833)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2021-03-03 20:54:26 UTC (rev 273832)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2021-03-03 21:04:47 UTC (rev 273833)
@@ -1949,7 +1949,6 @@
 		E18E690C169B563F009B6670 /* SecItemShimProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = E18E690A169B563F009B6670 /* SecItemShimProxy.h */; };
 		E18E6917169B667B009B6670 /* SecItemShimProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E18E6913169B667B009B6670 /* SecItemShimProxyMessageReceiver.cpp */; };
 		E18E6918169B667B009B6670 /* SecItemShimProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = E18E6914169B667B009B6670 /* SecItemShimProxyMessages.h */; };
-		E19582D3153CBFD700B60875 /* PDFKitImports.h in Headers */ = {isa = PBXBuildFile; fileRef = E19582D2153CBFD700B60875 /* PDFKitImports.h */; };
 		E19BDA86193665E300B97F57 /* com.apple.appstore.CodeRedeemerNetscapePlugin.sb in Copy Plug-in Sandbox Profiles */ = {isa = PBXBuildFile; fileRef = E19BDA8419365F4B00B97F57 /* com.apple.appstore.CodeRedeemerNetscapePlugin.sb */; };
 		E1AEA22F14687BDB00804569 /* WKFullKeyboardAccessWatcher.h in Headers */ = {isa = PBXBuildFile; fileRef = E1AEA22D14687BDB00804569 /* WKFullKeyboardAccessWatcher.h */; };
 		E1B78471163F24690007B692 /* RemoteNetworkingContext.h in Headers */ = {isa = PBXBuildFile; fileRef = E1B78470163F24690007B692 /* RemoteNetworkingContext.h */; };
@@ -3140,6 +3139,8 @@
 		2D3EF4411917646300034184 /* WebMemoryPressureHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebMemoryPressureHandler.h; sourceTree = "<group>"; };
 		2D429BFA1721E2BA00EC681F /* PDFPluginPasswordField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PDFPluginPasswordField.h; path = PDF/PDFPluginPasswordField.h; sourceTree = "<group>"; };
 		2D429BFB1721E2BA00EC681F /* PDFPluginPasswordField.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = PDFPluginPasswordField.mm; path = PDF/PDFPluginPasswordField.mm; sourceTree = "<group>"; };
+		2D440B8225EF235E00A98D87 /* PDFKitSoftLink.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = PDFKitSoftLink.mm; sourceTree = "<group>"; };
+		2D440B8325EF235E00A98D87 /* PDFKitSoftLink.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PDFKitSoftLink.h; sourceTree = "<group>"; };
 		2D47B56A1810714E003A3AEE /* RemoteLayerBackingStore.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteLayerBackingStore.mm; sourceTree = "<group>"; };
 		2D47B56B1810714E003A3AEE /* RemoteLayerBackingStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteLayerBackingStore.h; sourceTree = "<group>"; };
 		2D4AF0882044C3C4006C8817 /* FrontBoardServicesSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FrontBoardServicesSPI.h; sourceTree = "<group>"; };
@@ -5780,8 +5781,6 @@
 		E18E6914169B667B009B6670 /* SecItemShimProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SecItemShimProxyMessages.h; path = DerivedSources/WebKit2/SecItemShimProxyMessages.h; sourceTree = BUILT_PRODUCTS_DIR; };
 		E18E6947169B77C8009B6670 /* SecItemShim.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SecItemShim.cpp; sourceTree = "<group>"; };
 		E18E6948169B77C8009B6670 /* SecItemShim.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SecItemShim.h; sourceTree = "<group>"; };
-		E19582D2153CBFD700B60875 /* PDFKitImports.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PDFKitImports.h; sourceTree = "<group>"; };
-		E19582D4153CC05300B60875 /* PDFKitImports.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PDFKitImports.mm; sourceTree = "<group>"; };
 		E1967E37150AB5E200C73169 /* com.apple.WebProcess.sb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = com.apple.WebProcess.sb; path = DerivedSources/WebKit2/com.apple.WebProcess.sb; sourceTree = BUILT_PRODUCTS_DIR; };
 		E19BDA8419365F4B00B97F57 /* com.apple.appstore.CodeRedeemerNetscapePlugin.sb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = com.apple.appstore.CodeRedeemerNetscapePlugin.sb; sourceTree = "<group>"; };
 		E19BDA88193686A400B97F57 /* SandboxUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SandboxUtilities.h; sourceTree = "<group>"; };
@@ -8143,6 +8142,8 @@
 				CE550E12228373C800D28791 /* InsertTextOptions.h */,
 				C1663E5A24AEA74200C6A3B2 /* LaunchServicesDatabaseXPCConstants.h */,
 				2D1087621D2C641B00B85F82 /* LoadParametersCocoa.mm */,
+				2D440B8325EF235E00A98D87 /* PDFKitSoftLink.h */,
+				2D440B8225EF235E00A98D87 /* PDFKitSoftLink.mm */,
 				7AB4EA3F22777C460085BBAA /* SandboxExtensionCocoa.mm */,
 				7AB4EA4122777FC70085BBAA /* SandboxInitialiationParametersCocoa.mm */,
 				E19BDA88193686A400B97F57 /* SandboxUtilities.h */,
@@ -10285,8 +10286,6 @@
 				C574A57F12E66681002DFE98 /* PasteboardTypes.h */,
 				C574A58012E66681002DFE98 /* PasteboardTypes.mm */,
 				C1E123B920A11572002646F4 /* PDFContextMenu.h */,
-				E19582D2153CBFD700B60875 /* PDFKitImports.h */,
-				E19582D4153CC05300B60875 /* PDFKitImports.mm */,
 				E1CC1B8F12D7EADF00625838 /* PrintInfoMac.mm */,
 				51D1304F1382EAC000351EDD /* SecItemRequestData.cpp */,
 				51D130501382EAC000351EDD /* SecItemRequestData.h */,
@@ -11959,7 +11958,6 @@
 				A1798B3E222D97A2000764BD /* PaymentAuthorizationPresenter.h in Headers */,
 				A1798B43222D98DF000764BD /* PaymentAuthorizationViewController.h in Headers */,
 				C1E123BA20A11573002646F4 /* PDFContextMenu.h in Headers */,
-				E19582D3153CBFD700B60875 /* PDFKitImports.h in Headers */,
 				5C298DA01C3DF02100470AFE /* PendingDownload.h in Headers */,
 				832ED18C1E2FE157006BA64A /* PerActivityStateCPUUsageSampler.h in Headers */,
 				7AFBD36F21E546F8005DBACB /* PersistencyUtils.h in Headers */,

Modified: trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.h (273832 => 273833)


--- trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.h	2021-03-03 20:54:26 UTC (rev 273832)
+++ trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.h	2021-03-03 21:04:47 UTC (rev 273833)
@@ -28,7 +28,6 @@
 #if ENABLE(PDFKIT_PLUGIN)
 
 #include "DataReference.h"
-#include "PDFKitImports.h"
 #include "PDFPluginIdentifier.h"
 #include "Plugin.h"
 #include "WebEvent.h"

Modified: trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm (273832 => 273833)


--- trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm	2021-03-03 20:54:26 UTC (rev 273832)
+++ trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm	2021-03-03 21:04:47 UTC (rev 273833)
@@ -34,6 +34,7 @@
 #import "Logging.h"
 #import "PDFAnnotationTextWidgetDetails.h"
 #import "PDFContextMenu.h"
+#import "PDFKitSoftLink.h"
 #import "PDFLayerControllerSPI.h"
 #import "PDFPluginAnnotation.h"
 #import "PDFPluginPasswordField.h"
@@ -596,7 +597,7 @@
     , m_containerLayer(adoptNS([[CALayer alloc] init]))
     , m_contentLayer(adoptNS([[CALayer alloc] init]))
     , m_scrollCornerLayer(adoptNS([[WKPDFPluginScrollbarLayer alloc] initWithPDFPlugin:this]))
-    , m_pdfLayerController(adoptNS([[pdfLayerControllerClass() alloc] init]))
+    , m_pdfLayerController(adoptNS([allocPDFLayerControllerInstance() init]))
     , m_pdfLayerControllerDelegate(adoptNS([[WKPDFLayerControllerDelegate alloc] initWithPDFPlugin:this]))
 #if HAVE(INCREMENTAL_PDF_APIS)
     , m_streamLoaderClient(adoptRef(*new PDFPluginStreamLoaderClient(*this)))
@@ -738,7 +739,7 @@
     if (!m_documentFinishedLoading || m_pdfDocument)
         return;
 
-    m_pdfDocument = adoptNS([[pdfDocumentClass() alloc] initWithData:rawData()]);
+    m_pdfDocument = adoptNS([allocPDFDocumentInstance() initWithData:rawData()]);
     installPDFDocument();
     tryRunScriptsInPDFDocument();
 }
@@ -878,7 +879,7 @@
 
     RetainPtr<CGDataProviderRef> dataProvider = adoptCF(CGDataProviderCreateMultiRangeDirectAccess(this, kCGDataProviderIndeterminateSize, &dataProviderCallbacks));
     CGDataProviderSetProperty(dataProvider.get(), kCGDataProviderHasHighLatency, kCFBooleanTrue);
-    m_backgroundThreadDocument = adoptNS([[pdfDocumentClass() alloc] initWithProvider:dataProvider.get()]);
+    m_backgroundThreadDocument = adoptNS([allocPDFDocumentInstance() initWithProvider:dataProvider.get()]);
 
     // [PDFDocument initWithProvider:] will return nil in cases where the PDF is non-linearized.
     // In those cases we'll just keep buffering the entire PDF on the main thread.
@@ -1599,7 +1600,7 @@
     } else
 #endif
     {
-        m_pdfDocument = adoptNS([[pdfDocumentClass() alloc] initWithData:rawData()]);
+        m_pdfDocument = adoptNS([allocPDFDocumentInstance() initWithData:rawData()]);
         installPDFDocument();
     }
 
@@ -2464,7 +2465,7 @@
 
     if (annotation) {
         ALLOW_DEPRECATED_DECLARATIONS_BEGIN
-        if ([annotation isKindOfClass:pdfAnnotationTextWidgetClass()] && static_cast<PDFAnnotationTextWidget *>(annotation).isReadOnly) {
+        if ([annotation isKindOfClass:getPDFAnnotationTextWidgetClass()] && static_cast<PDFAnnotationTextWidget *>(annotation).isReadOnly) {
             m_activeAnnotation = nullptr;
             return;
         }
@@ -2690,7 +2691,7 @@
         foundSelection = [m_pdfDocument findString:target fromSelection:initialSelection withOptions:options];
 
     if (!foundSelection && wrapSearch) {
-        auto emptySelection = adoptNS([[pdfSelectionClass() alloc] initWithDocument:m_pdfDocument.get()]);
+        auto emptySelection = adoptNS([allocPDFSelectionInstance() initWithDocument:m_pdfDocument.get()]);
         foundSelection = [m_pdfDocument findString:target fromSelection:emptySelection.get() withOptions:options];
     }
 
@@ -2850,7 +2851,7 @@
     NSPoint pointInPageSpace = [[m_pdfLayerController layout] convertPoint:pointInLayoutSpace toPage:currentPage forScaleFactor:1.0];
 
     for (PDFAnnotation *annotation in currentPage.annotations) {
-        if (![annotation isKindOfClass:pdfAnnotationLinkClass()])
+        if (![annotation isKindOfClass:getPDFAnnotationLinkClass()])
             continue;
 
         NSRect bounds = annotation.bounds;

Modified: trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPluginAnnotation.mm (273832 => 273833)


--- trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPluginAnnotation.mm	2021-03-03 20:54:26 UTC (rev 273832)
+++ trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPluginAnnotation.mm	2021-03-03 21:04:47 UTC (rev 273833)
@@ -28,7 +28,7 @@
 
 #if ENABLE(PDFKIT_PLUGIN)
 
-#import "PDFKitImports.h"
+#import "PDFKitSoftLink.h"
 #import "PDFLayerControllerSPI.h"
 #import "PDFPlugin.h"
 #import "PDFPluginChoiceAnnotation.h"
@@ -53,9 +53,9 @@
 
 RefPtr<PDFPluginAnnotation> PDFPluginAnnotation::create(PDFAnnotation *annotation, PDFLayerController *pdfLayerController, PDFPlugin* plugin)
 {
-    if ([annotation isKindOfClass:pdfAnnotationTextWidgetClass()])
+    if ([annotation isKindOfClass:getPDFAnnotationTextWidgetClass()])
         return PDFPluginTextAnnotation::create(annotation, pdfLayerController, plugin);
-    if ([annotation isKindOfClass:pdfAnnotationChoiceWidgetClass()])
+    if ([annotation isKindOfClass:getPDFAnnotationChoiceWidgetClass()])
         return PDFPluginChoiceAnnotation::create(annotation, pdfLayerController, plugin);
 
     return nullptr;

Modified: trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm (273832 => 273833)


--- trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm	2021-03-03 20:54:26 UTC (rev 273832)
+++ trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm	2021-03-03 21:04:47 UTC (rev 273833)
@@ -28,7 +28,6 @@
 #import "config.h"
 #import "PDFPluginChoiceAnnotation.h"
 
-#import "PDFKitImports.h"
 #import "PDFLayerControllerSPI.h"
 #import <Quartz/Quartz.h>
 #import <WebCore/CSSPrimitiveValue.h>

Modified: trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPluginPasswordField.mm (273832 => 273833)


--- trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPluginPasswordField.mm	2021-03-03 20:54:26 UTC (rev 273832)
+++ trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPluginPasswordField.mm	2021-03-03 21:04:47 UTC (rev 273833)
@@ -28,7 +28,6 @@
 
 #if ENABLE(PDFKIT_PLUGIN)
 
-#import "PDFKitImports.h"
 #import "PDFLayerControllerSPI.h"
 #import "PDFPlugin.h"
 #import <Quartz/Quartz.h>

Modified: trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm (273832 => 273833)


--- trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm	2021-03-03 20:54:26 UTC (rev 273832)
+++ trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm	2021-03-03 21:04:47 UTC (rev 273833)
@@ -29,7 +29,6 @@
 #if ENABLE(PDFKIT_PLUGIN)
 
 #import "PDFAnnotationTextWidgetDetails.h"
-#import "PDFKitImports.h"
 #import "PDFLayerControllerSPI.h"
 #import "PDFPlugin.h"
 #import <Quartz/Quartz.h>

Modified: trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm (273832 => 273833)


--- trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm	2021-03-03 20:54:26 UTC (rev 273832)
+++ trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm	2021-03-03 21:04:47 UTC (rev 273833)
@@ -35,7 +35,7 @@
 #import "FontInfo.h"
 #import "FrameInfoData.h"
 #import "InjectedBundleHitTestResult.h"
-#import "PDFKitImports.h"
+#import "PDFKitSoftLink.h"
 #import "PDFPlugin.h"
 #import "PageBanner.h"
 #import "PluginView.h"
@@ -199,7 +199,7 @@
 bool WebPage::shouldUsePDFPlugin(const String& contentType, StringView path) const
 {
     return pdfPluginEnabled()
-        && classFromPDFKit(@"PDFLayerController")
+        && getPDFLayerControllerClass()
         && (MIMETypeRegistry::isPDFOrPostScriptMIMEType(contentType)
             || (contentType.isEmpty()
                 && (path.endsWithIgnoringASCIICase(".pdf") || path.endsWithIgnoringASCIICase(".ps"))));
@@ -733,7 +733,7 @@
     CGAffineTransform transform = CGContextGetCTM(context);
 
     for (PDFAnnotation *annotation in [pdfPage annotations]) {
-        if (![annotation isKindOfClass:pdfAnnotationLinkClass()])
+        if (![annotation isKindOfClass:getPDFAnnotationLinkClass()])
             continue;
 
         ALLOW_DEPRECATED_DECLARATIONS_BEGIN
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to