Diff
Modified: trunk/ChangeLog (291472 => 291473)
--- trunk/ChangeLog 2022-03-18 08:32:16 UTC (rev 291472)
+++ trunk/ChangeLog 2022-03-18 08:35:25 UTC (rev 291473)
@@ -1,3 +1,17 @@
+2022-03-18 Carlos Garcia Campos <cgar...@igalia.com>
+
+ Add a public build option for PDF.js
+ https://bugs.webkit.org/show_bug.cgi?id=238023
+
+ Reviewed by Michael Catanzaro.
+
+ PDF.js increases the binary size of the library quite a bit, so embedders might want to disable it if they know
+ they don't need PDF support at all.
+
+ * Source/cmake/OptionsGTK.cmake:
+ * Source/cmake/OptionsWPE.cmake:
+ * Source/cmake/WebKitFeatures.cmake:
+
2022-03-17 Zan Dobersek <zdober...@igalia.com>
[GTK][WPE] Also enable USE_TEXTURE_MAPPER_DMABUF alongside other DMABuf-related defines
Modified: trunk/Source/WTF/ChangeLog (291472 => 291473)
--- trunk/Source/WTF/ChangeLog 2022-03-18 08:32:16 UTC (rev 291472)
+++ trunk/Source/WTF/ChangeLog 2022-03-18 08:35:25 UTC (rev 291473)
@@ -1,3 +1,13 @@
+2022-03-18 Carlos Garcia Campos <cgar...@igalia.com>
+
+ Add a public build option for PDF.js
+ https://bugs.webkit.org/show_bug.cgi?id=238023
+
+ Reviewed by Michael Catanzaro.
+
+ * Scripts/Preferences/WebPreferencesInternal.yaml:
+ * wtf/PlatformEnable.h:
+
2022-03-17 Keith Miller <keith_mil...@apple.com>
tryReserveUncommittedAligned should round up to alignment not bytes requested
Modified: trunk/Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml (291472 => 291473)
--- trunk/Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml 2022-03-18 08:32:16 UTC (rev 291472)
+++ trunk/Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml 2022-03-18 08:35:25 UTC (rev 291473)
@@ -708,6 +708,7 @@
type: bool
humanReadableName: "Enable PDF.js viewer"
humanReadableDescription: "Enable PDF.js viewer"
+ condition: ENABLE(PDFJS)
defaultValue:
WebKitLegacy:
default: false
Modified: trunk/Source/WTF/wtf/PlatformEnable.h (291472 => 291473)
--- trunk/Source/WTF/wtf/PlatformEnable.h 2022-03-18 08:32:16 UTC (rev 291472)
+++ trunk/Source/WTF/wtf/PlatformEnable.h 2022-03-18 08:35:25 UTC (rev 291473)
@@ -884,6 +884,10 @@
#endif
#endif
+#if !defined(ENABLE_PDFJS) && (PLATFORM(COCOA) || PLATFORM(GTK) || PLATFORM(WPE))
+#define ENABLE_PDFJS 1
+#endif
+
/* This feature works by embedding the OpcodeID in the 32 bit just before the generated LLint code
that executes each opcode. It cannot be supported by the CLoop since there's no way to embed the
OpcodeID word in the CLoop's switch statement cases. It is also currently not implemented for MSVC.
Modified: trunk/Source/WebCore/ChangeLog (291472 => 291473)
--- trunk/Source/WebCore/ChangeLog 2022-03-18 08:32:16 UTC (rev 291472)
+++ trunk/Source/WebCore/ChangeLog 2022-03-18 08:35:25 UTC (rev 291473)
@@ -1,3 +1,21 @@
+2022-03-18 Carlos Garcia Campos <cgar...@igalia.com>
+
+ Add a public build option for PDF.js
+ https://bugs.webkit.org/show_bug.cgi?id=238023
+
+ Reviewed by Michael Catanzaro.
+
+ * dom/DOMImplementation.cpp:
+ (WebCore::DOMImplementation::createDocument):
+ * html/PDFDocument.cpp:
+ * html/PDFDocument.h:
+ * loader/ResourceLoader.cpp:
+ (WebCore::ResourceLoader::isPDFJSResourceLoad const):
+ * page/SecurityOrigin.cpp:
+ (WebCore::shouldTreatAsUniqueOrigin):
+ * platform/LegacySchemeRegistry.cpp:
+ (WebCore::builtinSecureSchemes):
+
2022-03-18 Diego Pino Garcia <dp...@igalia.com>
Unreviewed, fix non-unified build after r291467
Modified: trunk/Source/WebCore/dom/DOMImplementation.cpp (291472 => 291473)
--- trunk/Source/WebCore/dom/DOMImplementation.cpp 2022-03-18 08:32:16 UTC (rev 291472)
+++ trunk/Source/WebCore/dom/DOMImplementation.cpp 2022-03-18 08:35:25 UTC (rev 291473)
@@ -153,8 +153,10 @@
if (equalLettersIgnoringASCIICase(contentType, "text/plain"))
return TextDocument::create(frame, settings, url, documentIdentifier);
+#if ENABLE(PDFJS)
if (frame && settings.pdfJSViewerEnabled() && MIMETypeRegistry::isPDFMIMEType(contentType))
return PDFDocument::create(*frame, url);
+#endif
bool isImage = MIMETypeRegistry::isSupportedImageMIMEType(contentType);
if (frame && isImage && !MIMETypeRegistry::isPDFOrPostScriptMIMEType(contentType))
Modified: trunk/Source/WebCore/html/PDFDocument.cpp (291472 => 291473)
--- trunk/Source/WebCore/html/PDFDocument.cpp 2022-03-18 08:32:16 UTC (rev 291472)
+++ trunk/Source/WebCore/html/PDFDocument.cpp 2022-03-18 08:35:25 UTC (rev 291473)
@@ -25,6 +25,8 @@
#include "config.h"
#include "PDFDocument.h"
+#if ENABLE(PDFJS)
+
#include "AddEventListenerOptions.h"
#include "DOMWindow.h"
#include "DocumentLoader.h"
@@ -227,4 +229,6 @@
contentDocument->body()->appendChild(script);
}
-}
+} // namepsace WebCore
+
+#endif // ENABLE(PDFJS)
Modified: trunk/Source/WebCore/html/PDFDocument.h (291472 => 291473)
--- trunk/Source/WebCore/html/PDFDocument.h 2022-03-18 08:32:16 UTC (rev 291472)
+++ trunk/Source/WebCore/html/PDFDocument.h 2022-03-18 08:35:25 UTC (rev 291473)
@@ -24,6 +24,8 @@
#pragma once
+#if ENABLE(PDFJS)
+
#include "HTMLDocument.h"
namespace WebCore {
@@ -65,3 +67,5 @@
static bool isType(const WebCore::Document& document) { return document.isPDFDocument(); }
static bool isType(const WebCore::Node& node) { return is<WebCore::Document>(node) && isType(downcast<WebCore::Document>(node)); }
SPECIALIZE_TYPE_TRAITS_END()
+
+#endif // ENABLE(PDFJS)
Modified: trunk/Source/WebCore/loader/ResourceLoader.cpp (291472 => 291473)
--- trunk/Source/WebCore/loader/ResourceLoader.cpp 2022-03-18 08:32:16 UTC (rev 291472)
+++ trunk/Source/WebCore/loader/ResourceLoader.cpp 2022-03-18 08:35:25 UTC (rev 291473)
@@ -869,7 +869,7 @@
bool ResourceLoader::isPDFJSResourceLoad() const
{
-#if PLATFORM(COCOA) || PLATFORM(GTK) || PLATFORM(WPE)
+#if ENABLE(PDFJS)
if (!m_request.url().protocolIs("webkit-pdfjs-viewer"))
return false;
Modified: trunk/Source/WebCore/page/SecurityOrigin.cpp (291472 => 291473)
--- trunk/Source/WebCore/page/SecurityOrigin.cpp 2022-03-18 08:32:16 UTC (rev 291472)
+++ trunk/Source/WebCore/page/SecurityOrigin.cpp 2022-03-18 08:35:25 UTC (rev 291473)
@@ -121,8 +121,10 @@
#endif
#if PLATFORM(GTK) || PLATFORM(WPE)
|| url.protocolIs("resource")
+#if ENABLE(PDFJS)
|| url.protocolIs("webkit-pdfjs-viewer")
#endif
+#endif
|| url.protocolIs("blob"))
return false;
Modified: trunk/Source/WebCore/platform/LegacySchemeRegistry.cpp (291472 => 291473)
--- trunk/Source/WebCore/platform/LegacySchemeRegistry.cpp 2022-03-18 08:32:16 UTC (rev 291472)
+++ trunk/Source/WebCore/platform/LegacySchemeRegistry.cpp 2022-03-18 08:35:25 UTC (rev 291473)
@@ -143,7 +143,7 @@
#if PLATFORM(GTK) || PLATFORM(WPE)
"resource"_s,
#endif
-#if PLATFORM(COCOA) || PLATFORM(GTK) || PLATFORM(WPE)
+#if ENABLE(PDFJS)
"webkit-pdfjs-viewer"_s,
#endif
};
Modified: trunk/Source/WebKit/ChangeLog (291472 => 291473)
--- trunk/Source/WebKit/ChangeLog 2022-03-18 08:32:16 UTC (rev 291472)
+++ trunk/Source/WebKit/ChangeLog 2022-03-18 08:35:25 UTC (rev 291473)
@@ -1,5 +1,25 @@
2022-03-18 Carlos Garcia Campos <cgar...@igalia.com>
+ Add a public build option for PDF.js
+ https://bugs.webkit.org/show_bug.cgi?id=238023
+
+ Reviewed by Michael Catanzaro.
+
+ * PlatformGTK.cmake:
+ * PlatformWPE.cmake:
+ * WebProcess/Network/WebLoaderStrategy.cpp:
+ (WebKit::WebLoaderStrategy::scheduleLoad):
+ * WebProcess/Network/WebLoaderStrategy.h:
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebKit::WebFrameLoaderClient::objectContentType):
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::updatePreferences):
+ (WebKit::WebPage::canShowMIMEType const):
+ * WebProcess/WebPage/mac/WebPageMac.mm:
+ (WebKit::WebPage::shouldUsePDFPlugin const):
+
+2022-03-18 Carlos Garcia Campos <cgar...@igalia.com>
+
Remove AuxiliaryProcess termination timeout
https://bugs.webkit.org/show_bug.cgi?id=238012
Modified: trunk/Source/WebKit/PlatformGTK.cmake (291472 => 291473)
--- trunk/Source/WebKit/PlatformGTK.cmake 2022-03-18 08:32:16 UTC (rev 291472)
+++ trunk/Source/WebKit/PlatformGTK.cmake 2022-03-18 08:35:25 UTC (rev 291473)
@@ -1,6 +1,9 @@
include(InspectorGResources.cmake)
-include(PdfJSGResources.cmake)
+if (ENABLE_PDFJS)
+ include(PdfJSGResources.cmake)
+endif ()
+
set(WebKit_OUTPUT_NAME webkit2gtk-${WEBKITGTK_API_VERSION})
set(WebProcess_OUTPUT_NAME WebKitWebProcess)
set(NetworkProcess_OUTPUT_NAME WebKitNetworkProcess)
@@ -54,8 +57,6 @@
list(APPEND WebKit_DERIVED_SOURCES
${WebKit2Gtk_DERIVED_SOURCES_DIR}/InspectorGResourceBundle.c
- ${WebKit2Gtk_DERIVED_SOURCES_DIR}/PdfJSGResourceBundle.c
- ${WebKit2Gtk_DERIVED_SOURCES_DIR}/PdfJSGResourceBundleExtras.c
${WebKit2Gtk_DERIVED_SOURCES_DIR}/WebKitDirectoryInputStreamData.cpp
${WebKit2Gtk_DERIVED_SOURCES_DIR}/WebKitResourcesGResourceBundle.c
@@ -71,6 +72,15 @@
)
endif ()
+if (ENABLE_PDFJS)
+ list(APPEND WebKit_DERIVED_SOURCES
+ ${WebKit2Gtk_DERIVED_SOURCES_DIR}/PdfJSGResourceBundle.c
+ ${WebKit2Gtk_DERIVED_SOURCES_DIR}/PdfJSGResourceBundleExtras.c
+ )
+
+ WEBKIT_BUILD_PDFJS_GRESOURCES(${WebKit2Gtk_DERIVED_SOURCES_DIR})
+endif ()
+
set(WebKit_DirectoryInputStream_DATA
${WEBKIT_DIR}/NetworkProcess/soup/Resources/directory.css
${WEBKIT_DIR}/NetworkProcess/soup/Resources/directory.js
@@ -563,7 +573,6 @@
)
WEBKIT_BUILD_INSPECTOR_GRESOURCES(${WebKit2Gtk_DERIVED_SOURCES_DIR})
-WEBKIT_BUILD_PDFJS_GRESOURCES(${WebKit2Gtk_DERIVED_SOURCES_DIR})
set(WebKitResources "")
list(APPEND WebKitResources "<file alias=\"css/gtk-theme.css\">gtk-theme.css</file>\n")
Modified: trunk/Source/WebKit/PlatformWPE.cmake (291472 => 291473)
--- trunk/Source/WebKit/PlatformWPE.cmake 2022-03-18 08:32:16 UTC (rev 291472)
+++ trunk/Source/WebKit/PlatformWPE.cmake 2022-03-18 08:35:25 UTC (rev 291473)
@@ -1,7 +1,10 @@
include(InspectorGResources.cmake)
-include(PdfJSGResources.cmake)
include(GNUInstallDirs)
+if (ENABLE_PDFJS)
+ include(PdfJSGResources.cmake)
+endif ()
+
set(WebKit_OUTPUT_NAME WPEWebKit-${WPE_API_VERSION})
set(WebProcess_OUTPUT_NAME WPEWebProcess)
set(NetworkProcess_OUTPUT_NAME WPENetworkProcess)
@@ -110,8 +113,6 @@
)
list(APPEND WebKit_DERIVED_SOURCES
- ${WebKit_DERIVED_SOURCES_DIR}/PdfJSGResourceBundle.c
- ${WebKit_DERIVED_SOURCES_DIR}/PdfJSGResourceBundleExtras.c
${WebKit_DERIVED_SOURCES_DIR}/WebKitResourcesGResourceBundle.c
${WebKit_DERIVED_SOURCES_DIR}/WebKitDirectoryInputStreamData.cpp
@@ -119,8 +120,15 @@
${DERIVED_SOURCES_WPE_API_DIR}/WebKitWebProcessEnumTypes.cpp
)
-WEBKIT_BUILD_PDFJS_GRESOURCES(${WebKit_DERIVED_SOURCES_DIR})
+if (ENABLE_PDFJS)
+ list(APPEND WebKit_DERIVED_SOURCES
+ ${WebKit_DERIVED_SOURCES_DIR}/PdfJSGResourceBundle.c
+ ${WebKit_DERIVED_SOURCES_DIR}/PdfJSGResourceBundleExtras.c
+ )
+ WEBKIT_BUILD_PDFJS_GRESOURCES(${WebKit_DERIVED_SOURCES_DIR})
+endif ()
+
set(WebKit_DirectoryInputStream_DATA
${WEBKIT_DIR}/NetworkProcess/soup/Resources/directory.css
${WEBKIT_DIR}/NetworkProcess/soup/Resources/directory.js
Modified: trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp (291472 => 291473)
--- trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp 2022-03-18 08:32:16 UTC (rev 291472)
+++ trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp 2022-03-18 08:35:25 UTC (rev 291473)
@@ -231,8 +231,10 @@
}
#endif
+#if ENABLE(PDFJS)
if (tryLoadingUsingPDFJSHandler(resourceLoader, trackingParameters))
return;
+#endif
if (!tryLoadingUsingURLSchemeHandler(resourceLoader, trackingParameters)) {
WEBLOADERSTRATEGY_RELEASE_LOG("scheduleLoad: URL will be scheduled with the NetworkProcess");
@@ -272,6 +274,7 @@
return true;
}
+#if ENABLE(PDFJS)
bool WebLoaderStrategy::tryLoadingUsingPDFJSHandler(ResourceLoader& resourceLoader, const WebResourceLoader::TrackingParameters& trackingParameters)
{
if (!resourceLoader.request().url().protocolIs("webkit-pdfjs-viewer"))
@@ -283,6 +286,7 @@
startLocalLoad(resourceLoader);
return true;
}
+#endif
static void addParametersShared(const Frame* frame, NetworkResourceLoadParameters& parameters)
{
Modified: trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.h (291472 => 291473)
--- trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.h 2022-03-18 08:32:16 UTC (rev 291472)
+++ trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.h 2022-03-18 08:35:25 UTC (rev 291473)
@@ -99,7 +99,9 @@
void internallyFailedLoadTimerFired();
void startLocalLoad(WebCore::ResourceLoader&);
bool tryLoadingUsingURLSchemeHandler(WebCore::ResourceLoader&, const WebResourceLoader::TrackingParameters&);
+#if ENABLE(PDFJS)
bool tryLoadingUsingPDFJSHandler(WebCore::ResourceLoader&, const WebResourceLoader::TrackingParameters&);
+#endif
struct SyncLoadResult {
WebCore::ResourceResponse response;
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (291472 => 291473)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2022-03-18 08:32:16 UTC (rev 291472)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2022-03-18 08:35:25 UTC (rev 291473)
@@ -1710,11 +1710,12 @@
return ObjectContentType::Frame;
}
}
+#if ENABLE(PDFJS)
if (auto* webPage = m_frame->page()) {
if (webPage->corePage()->settings().pdfJSViewerEnabled() && MIMETypeRegistry::isPDFMIMEType(mimeType))
return ObjectContentType::Frame;
}
-
+#endif
if (MIMETypeRegistry::isSupportedImageMIMEType(mimeType))
return ObjectContentType::Image;
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (291472 => 291473)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2022-03-18 08:32:16 UTC (rev 291472)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2022-03-18 08:35:25 UTC (rev 291473)
@@ -4116,7 +4116,9 @@
#if ENABLE(MATHML)
settings.setMathMLEnabled(false);
#endif
+#if ENABLE(PDFJS)
settings.setPdfJSViewerEnabled(true);
+#endif
settings.setAllowedMediaContainerTypes(store.getStringValueForKey(WebPreferencesKey::mediaContainerTypesAllowedInCaptivePortalModeKey()));
settings.setAllowedMediaCodecTypes(store.getStringValueForKey(WebPreferencesKey::mediaCodecTypesAllowedInCaptivePortalModeKey()));
@@ -6459,8 +6461,10 @@
if (pluginsSupport(mimeType, PluginData::OnlyApplicationPlugins))
return true;
+#if ENABLE(PDFJS)
if (m_page->settings().pdfJSViewerEnabled() && MIMETypeRegistry::isPDFMIMEType(mimeType))
return true;
+#endif
return false;
}
Modified: trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm (291472 => 291473)
--- trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm 2022-03-18 08:32:16 UTC (rev 291472)
+++ trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm 2022-03-18 08:35:25 UTC (rev 291473)
@@ -206,7 +206,9 @@
bool WebPage::shouldUsePDFPlugin(const String& contentType, StringView path) const
{
return pdfPluginEnabled()
+#if ENABLE(PDFJS)
&& !corePage()->settings().pdfJSViewerEnabled()
+#endif
&& getPDFLayerControllerClass()
&& (MIMETypeRegistry::isPDFOrPostScriptMIMEType(contentType)
|| (contentType.isEmpty()
Modified: trunk/Source/cmake/OptionsGTK.cmake (291472 => 291473)
--- trunk/Source/cmake/OptionsGTK.cmake 2022-03-18 08:32:16 UTC (rev 291472)
+++ trunk/Source/cmake/OptionsGTK.cmake 2022-03-18 08:35:25 UTC (rev 291473)
@@ -122,6 +122,7 @@
# changing the value of the option.
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DRAG_SUPPORT PUBLIC ON)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_GAMEPAD PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_PDFJS PUBLIC ON)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SPELLCHECK PUBLIC ON)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_TOUCH_EVENTS PUBLIC ON)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_CRYPTO PUBLIC ON)
Modified: trunk/Source/cmake/OptionsWPE.cmake (291472 => 291473)
--- trunk/Source/cmake/OptionsWPE.cmake 2022-03-18 08:32:16 UTC (rev 291472)
+++ trunk/Source/cmake/OptionsWPE.cmake 2022-03-18 08:35:25 UTC (rev 291473)
@@ -35,6 +35,7 @@
# changing the value of the option.
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ACCESSIBILITY PUBLIC ON)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ENCRYPTED_MEDIA PUBLIC ${ENABLE_EXPERIMENTAL_FEATURES})
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_PDFJS PUBLIC ON)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBDRIVER PUBLIC ON)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_CRYPTO PUBLIC ON)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_XSLT PUBLIC ON)
Modified: trunk/Source/cmake/WebKitFeatures.cmake (291472 => 291473)
--- trunk/Source/cmake/WebKitFeatures.cmake 2022-03-18 08:32:16 UTC (rev 291472)
+++ trunk/Source/cmake/WebKitFeatures.cmake 2022-03-18 08:35:25 UTC (rev 291473)
@@ -190,6 +190,7 @@
WEBKIT_OPTION_DEFINE(ENABLE_OVERFLOW_SCROLLING_TOUCH "Toggle accelerated scrolling support" PRIVATE OFF)
WEBKIT_OPTION_DEFINE(ENABLE_PAYMENT_REQUEST "Toggle Payment Request support" PRIVATE OFF)
WEBKIT_OPTION_DEFINE(ENABLE_PDFKIT_PLUGIN "Toggle PDFKit plugin support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_PDFJS "Toggle PDF documents support using PDF.js" PRIVATE OFF)
WEBKIT_OPTION_DEFINE(ENABLE_PERIODIC_MEMORY_MONITOR "Toggle periodical memory monitor support" PRIVATE OFF)
WEBKIT_OPTION_DEFINE(ENABLE_PICTURE_IN_PICTURE_API "Toggle Picture-in-Picture API support" PRIVATE OFF)
WEBKIT_OPTION_DEFINE(ENABLE_POINTER_LOCK "Toggle pointer lock support" PRIVATE OFF)