Title: [243731] trunk/Source/WebKit
Revision
243731
Author
[email protected]
Date
2019-04-01 19:04:30 -0700 (Mon, 01 Apr 2019)

Log Message

Add SPI to give injected bundles access to displayed PDFDocuments
https://bugs.webkit.org/show_bug.cgi?id=196471
<rdar://problem/48080768>

Patch by Remy Demarest <[email protected]> on 2019-04-01
Reviewed by Tim Horton.

* WebKit.xcodeproj/project.pbxproj:

* WebProcess/InjectedBundle/API/c/mac/WKBundlePageMac.h: Added.
* WebProcess/InjectedBundle/API/c/mac/WKBundlePageMac.mm: Added.
(WKBundlePageGetPDFDocumentInFrame):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (243730 => 243731)


--- trunk/Source/WebKit/ChangeLog	2019-04-02 01:31:54 UTC (rev 243730)
+++ trunk/Source/WebKit/ChangeLog	2019-04-02 02:04:30 UTC (rev 243731)
@@ -1,3 +1,17 @@
+2019-04-01  Remy Demarest  <[email protected]>
+
+        Add SPI to give injected bundles access to displayed PDFDocuments
+        https://bugs.webkit.org/show_bug.cgi?id=196471
+        <rdar://problem/48080768>
+
+        Reviewed by Tim Horton.
+
+        * WebKit.xcodeproj/project.pbxproj:
+
+        * WebProcess/InjectedBundle/API/c/mac/WKBundlePageMac.h: Added.
+        * WebProcess/InjectedBundle/API/c/mac/WKBundlePageMac.mm: Added.
+        (WKBundlePageGetPDFDocumentInFrame):
+
 2019-04-01  Wenson Hsieh  <[email protected]>
 
         [WebKit2] Introduce a public version of WKWebsitePolicies

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (243730 => 243731)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2019-04-02 01:31:54 UTC (rev 243730)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2019-04-02 02:04:30 UTC (rev 243731)
@@ -1550,6 +1550,8 @@
 		C5E1AFED16B21017006CC1F2 /* APIWebArchive.h in Headers */ = {isa = PBXBuildFile; fileRef = BC329D9A16ACCE9900316DE2 /* APIWebArchive.h */; };
 		C5E1AFEF16B21029006CC1F2 /* APIWebArchiveResource.h in Headers */ = {isa = PBXBuildFile; fileRef = BC329D9F16ACD47800316DE2 /* APIWebArchiveResource.h */; };
 		C5FA1ED318E1062200B3F402 /* WKAirPlayRoutePicker.h in Headers */ = {isa = PBXBuildFile; fileRef = C5FA1ED118E1062200B3F402 /* WKAirPlayRoutePicker.h */; };
+		C6A4CA0B2252899800169289 /* WKBundlePageMac.h in Headers */ = {isa = PBXBuildFile; fileRef = C6A4CA092252899800169289 /* WKBundlePageMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		C6A4CA0C2252899800169289 /* WKBundlePageMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = C6A4CA0A2252899800169289 /* WKBundlePageMac.mm */; };
 		C98C48A61B6FD4C300145103 /* WebMediaSessionFocusManager.h in Headers */ = {isa = PBXBuildFile; fileRef = C98C48A41B6FD4C300145103 /* WebMediaSessionFocusManager.h */; };
 		C98C48AA1B6FD5B500145103 /* WKMediaSessionFocusManager.h in Headers */ = {isa = PBXBuildFile; fileRef = C98C48A81B6FD5B500145103 /* WKMediaSessionFocusManager.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		C9C1833C1B74026D007036A7 /* WebMediaSessionFocusManagerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = C9C183381B73FD6A007036A7 /* WebMediaSessionFocusManagerClient.h */; };
@@ -4392,6 +4394,8 @@
 		C5BCE5DB1C50761D00CDE3FA /* InteractionInformationAtPosition.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = InteractionInformationAtPosition.mm; path = ios/InteractionInformationAtPosition.mm; sourceTree = "<group>"; };
 		C5FA1ED118E1062200B3F402 /* WKAirPlayRoutePicker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKAirPlayRoutePicker.h; path = ios/forms/WKAirPlayRoutePicker.h; sourceTree = "<group>"; };
 		C5FA1ED218E1062200B3F402 /* WKAirPlayRoutePicker.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKAirPlayRoutePicker.mm; path = ios/forms/WKAirPlayRoutePicker.mm; sourceTree = "<group>"; };
+		C6A4CA092252899800169289 /* WKBundlePageMac.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WKBundlePageMac.h; sourceTree = "<group>"; };
+		C6A4CA0A2252899800169289 /* WKBundlePageMac.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WKBundlePageMac.mm; sourceTree = "<group>"; };
 		C98C48A31B6FD4C300145103 /* WebMediaSessionFocusManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebMediaSessionFocusManager.cpp; sourceTree = "<group>"; };
 		C98C48A41B6FD4C300145103 /* WebMediaSessionFocusManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebMediaSessionFocusManager.h; sourceTree = "<group>"; };
 		C98C48A71B6FD5B500145103 /* WKMediaSessionFocusManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKMediaSessionFocusManager.cpp; sourceTree = "<group>"; };
@@ -7103,6 +7107,8 @@
 			children = (
 				1A8B66B21BC45B010082DF77 /* WKBundleMac.h */,
 				1A8B66B11BC45B010082DF77 /* WKBundleMac.mm */,
+				C6A4CA092252899800169289 /* WKBundlePageMac.h */,
+				C6A4CA0A2252899800169289 /* WKBundlePageMac.mm */,
 				7CF47FFD17276AE3008ACB91 /* WKBundlePageBannerMac.h */,
 				7CF47FFC17276AE3008ACB91 /* WKBundlePageBannerMac.mm */,
 			);
@@ -9777,6 +9783,7 @@
 				1AB474DE184D44590051B622 /* WKBundlePageUIClient.h in Headers */,
 				BCF049E711FE20F600F86A58 /* WKBundlePrivate.h in Headers */,
 				BC60C5791240A546008C5E29 /* WKBundleRangeHandle.h in Headers */,
+				C6A4CA0B2252899800169289 /* WKBundlePageMac.h in Headers */,
 				BC5D24C716CD73C5007D5461 /* WKBundleRangeHandlePrivate.h in Headers */,
 				BC14DF9F120B635F00826C0C /* WKBundleScriptWorld.h in Headers */,
 				BC4075F6124FF0270068F20A /* WKCertificateInfo.h in Headers */,
@@ -11041,6 +11048,7 @@
 				2D11B7A72126A283006F8878 /* UnifiedSource44-mm.mm in Sources */,
 				2D11B7A82126A283006F8878 /* UnifiedSource44.cpp in Sources */,
 				2D11B7A92126A283006F8878 /* UnifiedSource45-mm.mm in Sources */,
+				C6A4CA0C2252899800169289 /* WKBundlePageMac.mm in Sources */,
 				2D11B7AA2126A283006F8878 /* UnifiedSource45.cpp in Sources */,
 				2D11B7AB2126A283006F8878 /* UnifiedSource46-mm.mm in Sources */,
 				2D11B7AC2126A283006F8878 /* UnifiedSource46.cpp in Sources */,

Added: trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/mac/WKBundlePageMac.h (0 => 243731)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/mac/WKBundlePageMac.h	                        (rev 0)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/mac/WKBundlePageMac.h	2019-04-02 02:04:30 UTC (rev 243731)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2019 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
+
+#ifdef __OBJC__
+
+#include <WebKit/WKBase.h>
+#include <WebKit/WKBundlePage.h>
+
+@class PDFDocument;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT PDFDocument *WKBundlePageGetPDFDocumentInFrame(WKBundlePageRef page, WKBundleFrameRef frame);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __OBJC__

Added: trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/mac/WKBundlePageMac.mm (0 => 243731)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/mac/WKBundlePageMac.mm	                        (rev 0)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/mac/WKBundlePageMac.mm	2019-04-02 02:04:30 UTC (rev 243731)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2019 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 "WKBundlePageMac.h"
+
+#import "PluginView.h"
+#import "WKBundleAPICast.h"
+#import "WKBundleFrame.h"
+#import "WKBundlePage.h"
+#import "WKRetainPtr.h"
+#import "WebFrame.h"
+#import "WebPage.h"
+#import <WebCore/Frame.h>
+
+WK_EXPORT PDFDocument *WKBundlePageGetPDFDocumentInFrame(WKBundlePageRef page, WKBundleFrameRef frame)
+{
+    WebCore::Frame* coreFrame = WebKit::toImpl(frame)->coreFrame();
+    if (!coreFrame)
+        return nil;
+
+    WebKit::PluginView* pluginView = WebKit::toImpl(page)->pluginViewForFrame(coreFrame);
+    if (!pluginView)
+        return nil;
+
+    return pluginView->pdfDocumentForPrinting().autorelease();
+}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to