Title: [279477] trunk/Source
Revision
279477
Author
[email protected]
Date
2021-07-01 12:37:13 -0700 (Thu, 01 Jul 2021)

Log Message

[Model] Restrict IPC calls to ARKit SPI availability and runtime flag
https://bugs.webkit.org/show_bug.cgi?id=227581

Reviewed by Tim Horton.

Source/WebCore:

Guard all IPC calls related to <model> by the most appropriate platform-specific flag
and also ensure that those calls don't do anything unless the runtime flag is also
enabled.

* Modules/model-element/HTMLModelElement.cpp:
* Modules/model-element/HTMLModelElement.h:
* Modules/model-element/HTMLModelElementCocoa.mm:
(WebCore::HTMLModelElement::inlinePreviewDidObtainContextId):
* loader/EmptyClients.cpp:
(WebCore::EmptyChromeClient::modelElementDidCreatePreview const):
* loader/EmptyClients.h:
* page/ChromeClient.h:

Source/WebKit:

Guard all IPC calls related to <model> by the most appropriate platform-specific flag
and also ensure that those calls don't do anything unless the runtime flag is also
enabled.

* Shared/WebProcessDataStoreParameters.h:
(WebKit::WebProcessDataStoreParameters::encode const):
(WebKit::WebProcessDataStoreParameters::decode):
* UIProcess/Cocoa/ModelElementControllerCocoa.mm:
(WebKit::ModelElementController::takeModelElementFullscreen):
(WebKit::ModelElementController::modelElementDidCreatePreview):
* UIProcess/ModelElementController.cpp:
* UIProcess/ModelElementController.h:
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didAttachToRunningProcess):
(WebKit::WebPageProxy::resetState):
(WebKit::WebPageProxy::takeModelElementFullscreen):
(WebKit::WebPageProxy::modelElementDidCreatePreview):
(WebKit::WebPageProxy::modelElementPreviewDidObtainContextId):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::webProcessDataStoreParameters):
* UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary):
* UIProcess/WebsiteData/WebsiteDataStore.h:
* UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
(WebKit::WebsiteDataStoreConfiguration::WebsiteDataStoreConfiguration):
(WebKit::WebsiteDataStoreConfiguration::copy const):
* UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::modelElementDidCreatePreview const):
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::modelElementPreviewDidObtainContextId):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::setWebsiteDataStoreParameters):
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformSetWebsiteDataStoreParameters):

Source/WTF:

Define a new compile-time flag when either of the iOS or macOS ARKit SPIs are available.

* wtf/PlatformHave.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (279476 => 279477)


--- trunk/Source/WTF/ChangeLog	2021-07-01 18:52:04 UTC (rev 279476)
+++ trunk/Source/WTF/ChangeLog	2021-07-01 19:37:13 UTC (rev 279477)
@@ -1,3 +1,14 @@
+2021-07-01  Antoine Quint  <[email protected]>
+
+        [Model] Restrict IPC calls to ARKit SPI availability and runtime flag
+        https://bugs.webkit.org/show_bug.cgi?id=227581
+
+        Reviewed by Tim Horton.
+
+        Define a new compile-time flag when either of the iOS or macOS ARKit SPIs are available.
+
+        * wtf/PlatformHave.h:
+
 2021-07-01  Aditya Keerthi  <[email protected]>
 
         [iOS] <select> menus should scroll to the selected option

Modified: trunk/Source/WTF/wtf/PlatformHave.h (279476 => 279477)


--- trunk/Source/WTF/wtf/PlatformHave.h	2021-07-01 18:52:04 UTC (rev 279476)
+++ trunk/Source/WTF/wtf/PlatformHave.h	2021-07-01 19:37:13 UTC (rev 279477)
@@ -1018,7 +1018,11 @@
 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 120000
 #define HAVE_ARKIT_INLINE_PREVIEW_MAC 1
 #endif
+
+#if defined(HAVE_ARKIT_INLINE_PREVIEW_IOS) || defined(HAVE_ARKIT_INLINE_PREVIEW_MAC)
+#define HAVE_ARKIT_INLINE_PREVIEW 1
 #endif
+#endif
 
 #if PLATFORM(IOS) || PLATFORM(MACCATALYST) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 110000)
 #define HAVE_NSURLPROTOCOL_WITH_SKIPAPPSSO 1

Modified: trunk/Source/WebCore/ChangeLog (279476 => 279477)


--- trunk/Source/WebCore/ChangeLog	2021-07-01 18:52:04 UTC (rev 279476)
+++ trunk/Source/WebCore/ChangeLog	2021-07-01 19:37:13 UTC (rev 279477)
@@ -1,3 +1,23 @@
+2021-07-01  Antoine Quint  <[email protected]>
+
+        [Model] Restrict IPC calls to ARKit SPI availability and runtime flag
+        https://bugs.webkit.org/show_bug.cgi?id=227581
+
+        Reviewed by Tim Horton.
+
+        Guard all IPC calls related to <model> by the most appropriate platform-specific flag
+        and also ensure that those calls don't do anything unless the runtime flag is also
+        enabled.
+
+        * Modules/model-element/HTMLModelElement.cpp:
+        * Modules/model-element/HTMLModelElement.h:
+        * Modules/model-element/HTMLModelElementCocoa.mm:
+        (WebCore::HTMLModelElement::inlinePreviewDidObtainContextId):
+        * loader/EmptyClients.cpp:
+        (WebCore::EmptyChromeClient::modelElementDidCreatePreview const):
+        * loader/EmptyClients.h:
+        * page/ChromeClient.h:
+
 2021-07-01  Youenn Fablet  <[email protected]>
 
         ReadableStream.getReader do not throw a proper exception when parameter is of wrong type

Modified: trunk/Source/WebCore/Modules/model-element/HTMLModelElement.cpp (279476 => 279477)


--- trunk/Source/WebCore/Modules/model-element/HTMLModelElement.cpp	2021-07-01 18:52:04 UTC (rev 279476)
+++ trunk/Source/WebCore/Modules/model-element/HTMLModelElement.cpp	2021-07-01 19:37:13 UTC (rev 279477)
@@ -167,6 +167,7 @@
     return *this;
 }
 
+#if HAVE(ARKIT_INLINE_PREVIEW)
 static String& sharedModelElementCacheDirectory()
 {
     static NeverDestroyed<String> sharedModelElementCacheDirectory;
@@ -182,6 +183,7 @@
 {
     return sharedModelElementCacheDirectory();
 }
+#endif
 
 // MARK: - DOM overrides.
 

Modified: trunk/Source/WebCore/Modules/model-element/HTMLModelElement.h (279476 => 279477)


--- trunk/Source/WebCore/Modules/model-element/HTMLModelElement.h	2021-07-01 18:52:04 UTC (rev 279476)
+++ trunk/Source/WebCore/Modules/model-element/HTMLModelElement.h	2021-07-01 19:37:13 UTC (rev 279477)
@@ -61,8 +61,10 @@
     RefPtr<SharedBuffer> modelData() const;
     RefPtr<Model> model() const;
 
+#if HAVE(ARKIT_INLINE_PREVIEW)
     WEBCORE_EXPORT static void setModelElementCacheDirectory(const String&);
     WEBCORE_EXPORT static const String& modelElementCacheDirectory();
+#endif
 
 #if HAVE(ARKIT_INLINE_PREVIEW_MAC)
     PlatformLayer* platformLayer() const;

Modified: trunk/Source/WebCore/Modules/model-element/HTMLModelElementCocoa.mm (279476 => 279477)


--- trunk/Source/WebCore/Modules/model-element/HTMLModelElementCocoa.mm	2021-07-01 18:52:04 UTC (rev 279476)
+++ trunk/Source/WebCore/Modules/model-element/HTMLModelElementCocoa.mm	2021-07-01 19:37:13 UTC (rev 279477)
@@ -34,6 +34,7 @@
 #include "Page.h"
 #include "RenderLayer.h"
 #include "RenderLayerModelObject.h"
+#include "Settings.h"
 #include <pal/spi/mac/SystemPreviewSPI.h>
 #include <wtf/FileSystem.h>
 #include <wtf/RetainPtr.h>
@@ -107,6 +108,9 @@
 
 void HTMLModelElement::inlinePreviewDidObtainContextId(const String& uuid, uint32_t contextId)
 {
+    if (!document().settings().modelElementEnabled())
+        return;
+
     if (uuid != (String)[m_inlinePreview uuid].UUIDString) {
         LOG(ModelElement, "HTMLModelElement::inlinePreviewDidObtainContextId() UUID mismatch, received %s but expected %s.", uuid.utf8().data(), ((String)[m_inlinePreview uuid].UUIDString).utf8().data());
         return;

Modified: trunk/Source/WebCore/loader/EmptyClients.cpp (279476 => 279477)


--- trunk/Source/WebCore/loader/EmptyClients.cpp	2021-07-01 18:52:04 UTC (rev 279476)
+++ trunk/Source/WebCore/loader/EmptyClients.cpp	2021-07-01 19:37:13 UTC (rev 279477)
@@ -578,16 +578,16 @@
 {
 }
 
-#if ENABLE(MODEL_ELEMENT)
-
+#if HAVE(ARKIT_INLINE_PREVIEW_IOS)
 void EmptyChromeClient::takeModelElementFullscreen(WebCore::GraphicsLayer::PlatformLayerID) const
 {
 }
+#endif
 
+#if HAVE(ARKIT_INLINE_PREVIEW_MAC)
 void EmptyChromeClient::modelElementDidCreatePreview(WebCore::HTMLModelElement&, const URL&, const String&, const WebCore::FloatSize&) const
 {
 }
-
 #endif
 
 void EmptyFrameLoaderClient::dispatchDecidePolicyForNewWindowAction(const NavigationAction&, const ResourceRequest&, FormState*, const String&, PolicyCheckIdentifier, FramePolicyFunction&&)

Modified: trunk/Source/WebCore/loader/EmptyClients.h (279476 => 279477)


--- trunk/Source/WebCore/loader/EmptyClients.h	2021-07-01 18:52:04 UTC (rev 279476)
+++ trunk/Source/WebCore/loader/EmptyClients.h	2021-07-01 19:37:13 UTC (rev 279477)
@@ -216,13 +216,13 @@
     void didAssociateFormControls(const Vector<RefPtr<Element>>&, Frame&) final { }
     bool shouldNotifyOnFormChanges() final { return false; }
 
-#if ENABLE(MODEL_ELEMENT)
+#if HAVE(ARKIT_INLINE_PREVIEW_IOS)
     void takeModelElementFullscreen(WebCore::GraphicsLayer::PlatformLayerID) const final;
 #endif
 
     RefPtr<Icon> createIconForFiles(const Vector<String>& /* filenames */) final { return nullptr; }
 
-#if ENABLE(MODEL_ELEMENT)
+#if HAVE(ARKIT_INLINE_PREVIEW_MAC)
     void modelElementDidCreatePreview(WebCore::HTMLModelElement&, const URL&, const String&, const WebCore::FloatSize&) const final;
 #endif
 };

Modified: trunk/Source/WebCore/page/ChromeClient.h (279476 => 279477)


--- trunk/Source/WebCore/page/ChromeClient.h	2021-07-01 18:52:04 UTC (rev 279476)
+++ trunk/Source/WebCore/page/ChromeClient.h	2021-07-01 19:37:13 UTC (rev 279477)
@@ -78,7 +78,7 @@
 #include "MediaUsageInfo.h"
 #endif
 
-#if ENABLE(MODEL_ELEMENT)
+#if HAVE(ARKIT_INLINE_PREVIEW)
 class HTMLModelElement;
 #endif
 
@@ -600,8 +600,10 @@
     virtual void textAutosizingUsesIdempotentModeChanged() { }
 #endif
 
-#if ENABLE(MODEL_ELEMENT)
+#if HAVE(ARKIT_INLINE_PREVIEW_IOS)
     virtual void takeModelElementFullscreen(WebCore::GraphicsLayer::PlatformLayerID) const { }
+#endif
+#if HAVE(ARKIT_INLINE_PREVIEW_MAC)
     virtual void modelElementDidCreatePreview(WebCore::HTMLModelElement&, const URL&, const String&, const WebCore::FloatSize&) const { };
 #endif
 

Modified: trunk/Source/WebKit/ChangeLog (279476 => 279477)


--- trunk/Source/WebKit/ChangeLog	2021-07-01 18:52:04 UTC (rev 279476)
+++ trunk/Source/WebKit/ChangeLog	2021-07-01 19:37:13 UTC (rev 279477)
@@ -1,3 +1,53 @@
+2021-07-01  Antoine Quint  <[email protected]>
+
+        [Model] Restrict IPC calls to ARKit SPI availability and runtime flag
+        https://bugs.webkit.org/show_bug.cgi?id=227581
+
+        Reviewed by Tim Horton.
+
+        Guard all IPC calls related to <model> by the most appropriate platform-specific flag
+        and also ensure that those calls don't do anything unless the runtime flag is also
+        enabled.
+
+        * Shared/WebProcessDataStoreParameters.h:
+        (WebKit::WebProcessDataStoreParameters::encode const):
+        (WebKit::WebProcessDataStoreParameters::decode):
+        * UIProcess/Cocoa/ModelElementControllerCocoa.mm:
+        (WebKit::ModelElementController::takeModelElementFullscreen):
+        (WebKit::ModelElementController::modelElementDidCreatePreview):
+        * UIProcess/ModelElementController.cpp:
+        * UIProcess/ModelElementController.h:
+        * UIProcess/PageClient.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::didAttachToRunningProcess):
+        (WebKit::WebPageProxy::resetState):
+        (WebKit::WebPageProxy::takeModelElementFullscreen):
+        (WebKit::WebPageProxy::modelElementDidCreatePreview):
+        (WebKit::WebPageProxy::modelElementPreviewDidObtainContextId):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::webProcessDataStoreParameters):
+        * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
+        * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+        (WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary):
+        * UIProcess/WebsiteData/WebsiteDataStore.h:
+        * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
+        (WebKit::WebsiteDataStoreConfiguration::WebsiteDataStoreConfiguration):
+        (WebKit::WebsiteDataStoreConfiguration::copy const):
+        * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::modelElementDidCreatePreview const):
+        * WebProcess/WebCoreSupport/WebChromeClient.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::modelElementPreviewDidObtainContextId):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::setWebsiteDataStoreParameters):
+        * WebProcess/cocoa/WebProcessCocoa.mm:
+        (WebKit::WebProcess::platformSetWebsiteDataStoreParameters):
+
 2021-07-01  Per Arne  <[email protected]>
 
         [macOS] Fix sandbox violations related to IOKit filtering

Modified: trunk/Source/WebKit/Shared/WebProcessDataStoreParameters.h (279476 => 279477)


--- trunk/Source/WebKit/Shared/WebProcessDataStoreParameters.h	2021-07-01 18:52:04 UTC (rev 279476)
+++ trunk/Source/WebKit/Shared/WebProcessDataStoreParameters.h	2021-07-01 19:37:13 UTC (rev 279477)
@@ -51,7 +51,7 @@
     HashSet<WebCore::RegistrableDomain> domainsWithUserInteraction;
     HashMap<TopFrameDomain, SubResourceDomain> domainsWithStorageAccessQuirk;
 #endif
-#if ENABLE(MODEL_ELEMENT)
+#if HAVE(ARKIT_INLINE_PREVIEW)
     String modelElementCacheDirectory;
     SandboxExtension::Handle modelElementCacheDirectoryExtensionHandle;
 #endif
@@ -79,7 +79,7 @@
     encoder << domainsWithUserInteraction;
     encoder << domainsWithStorageAccessQuirk;
 #endif
-#if ENABLE(MODEL_ELEMENT)
+#if HAVE(ARKIT_INLINE_PREVIEW)
     encoder << modelElementCacheDirectory;
     encoder << modelElementCacheDirectoryExtensionHandle;
 #endif
@@ -150,7 +150,7 @@
     if (!domainsWithStorageAccessQuirk)
         return std::nullopt;
 #endif
-#if ENABLE(MODEL_ELEMENT)
+#if HAVE(ARKIT_INLINE_PREVIEW)
         String modelElementCacheDirectory;
         if (!decoder.decode(modelElementCacheDirectory))
             return std::nullopt;
@@ -181,7 +181,7 @@
         WTFMove(*domainsWithUserInteraction),
         WTFMove(*domainsWithStorageAccessQuirk),
 #endif
-#if ENABLE(MODEL_ELEMENT)
+#if HAVE(ARKIT_INLINE_PREVIEW)
         WTFMove(modelElementCacheDirectory),
         WTFMove(*modelElementCacheDirectoryExtensionHandle),
 #endif

Modified: trunk/Source/WebKit/UIProcess/Cocoa/ModelElementControllerCocoa.mm (279476 => 279477)


--- trunk/Source/WebKit/UIProcess/Cocoa/ModelElementControllerCocoa.mm	2021-07-01 18:52:04 UTC (rev 279476)
+++ trunk/Source/WebKit/UIProcess/Cocoa/ModelElementControllerCocoa.mm	2021-07-01 19:37:13 UTC (rev 279477)
@@ -26,7 +26,7 @@
 #import "config.h"
 #import "ModelElementController.h"
 
-#if ENABLE(MODEL_ELEMENT)
+#if HAVE(ARKIT_INLINE_PREVIEW)
 
 #import "Logging.h"
 #import "WebPageProxy.h"
@@ -55,6 +55,9 @@
 
 void ModelElementController::takeModelElementFullscreen(WebCore::GraphicsLayer::PlatformLayerID contentLayerId)
 {
+    if (!m_webPageProxy->preferences().modelElementEnabled())
+        return;
+
     if (!is<RemoteLayerTreeDrawingAreaProxy>(m_webPageProxy.drawingArea()))
         return;
 
@@ -123,6 +126,9 @@
 
 void ModelElementController::modelElementDidCreatePreview(const WebCore::ElementContext& context, const URL& fileURL, const String& uuid, const WebCore::FloatSize& size)
 {
+    if (!m_webPageProxy.preferences().modelElementEnabled())
+        return;
+
     auto preview = adoptNS([allocASVInlinePreviewInstance() initWithFrame:CGRectMake(0, 0, size.width(), size.height()) UUID:[[NSUUID alloc] initWithUUIDString:uuid]]);
 
     LOG(ModelElement, "Created remote preview with UUID %s.", uuid.utf8().data());

Modified: trunk/Source/WebKit/UIProcess/ModelElementController.cpp (279476 => 279477)


--- trunk/Source/WebKit/UIProcess/ModelElementController.cpp	2021-07-01 18:52:04 UTC (rev 279476)
+++ trunk/Source/WebKit/UIProcess/ModelElementController.cpp	2021-07-01 19:37:13 UTC (rev 279477)
@@ -26,7 +26,7 @@
 #include "config.h"
 #include "ModelElementController.h"
 
-#if ENABLE(MODEL_ELEMENT)
+#if HAVE(ARKIT_INLINE_PREVIEW)
 
 #include "WebPageProxy.h"
 

Modified: trunk/Source/WebKit/UIProcess/ModelElementController.h (279476 => 279477)


--- trunk/Source/WebKit/UIProcess/ModelElementController.h	2021-07-01 18:52:04 UTC (rev 279476)
+++ trunk/Source/WebKit/UIProcess/ModelElementController.h	2021-07-01 19:37:13 UTC (rev 279477)
@@ -25,7 +25,7 @@
 
 #pragma once
 
-#if ENABLE(MODEL_ELEMENT)
+#if HAVE(ARKIT_INLINE_PREVIEW)
 
 #include <WebCore/ElementContext.h>
 #include <WebCore/GraphicsLayer.h>
@@ -51,7 +51,6 @@
 #if HAVE(ARKIT_INLINE_PREVIEW_IOS)
     void takeModelElementFullscreen(WebCore::GraphicsLayer::PlatformLayerID contentLayerId);
 #endif
-
 #if HAVE(ARKIT_INLINE_PREVIEW_MAC)
     void modelElementDidCreatePreview(const WebCore::ElementContext&, const URL&, const String&, const WebCore::FloatSize&);
 #endif

Modified: trunk/Source/WebKit/UIProcess/PageClient.h (279476 => 279477)


--- trunk/Source/WebKit/UIProcess/PageClient.h	2021-07-01 18:52:04 UTC (rev 279476)
+++ trunk/Source/WebKit/UIProcess/PageClient.h	2021-07-01 19:37:13 UTC (rev 279477)
@@ -132,10 +132,6 @@
 #if HAVE(TRANSLATION_UI_SERVICES) && ENABLE(CONTEXT_MENUS)
 struct TranslationContextMenuInfo;
 #endif
-
-#if ENABLE(MODEL_ELEMENT)
-struct ElementContext;
-#endif
 }
 
 namespace WebKit {

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (279476 => 279477)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2021-07-01 18:52:04 UTC (rev 279476)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2021-07-01 19:37:13 UTC (rev 279477)
@@ -1023,9 +1023,11 @@
     m_systemPreviewController = makeUnique<SystemPreviewController>(*this);
 #endif
 
-#if ENABLE(MODEL_ELEMENT)
-    ASSERT(!m_modelElementController);
-    m_modelElementController = makeUnique<ModelElementController>(*this);
+#if HAVE(ARKIT_INLINE_PREVIEW)
+    if (m_preferences->modelElementEnabled()) {
+        ASSERT(!m_modelElementController);
+        m_modelElementController = makeUnique<ModelElementController>(*this);
+    }
 #endif
 
 #if ENABLE(WEB_AUTHN)
@@ -7776,7 +7778,7 @@
     m_systemPreviewController = nullptr;
 #endif
 
-#if ENABLE(MODEL_ELEMENT)
+#if HAVE(ARKIT_INLINE_PREVIEW)
     m_modelElementController = nullptr;
 #endif
 
@@ -10688,20 +10690,17 @@
 
 #endif
 
-#if ENABLE(MODEL_ELEMENT)
-
+#if HAVE(ARKIT_INLINE_PREVIEW_IOS)
 void WebPageProxy::takeModelElementFullscreen(WebCore::GraphicsLayer::PlatformLayerID contentLayerId)
 {
-#if HAVE(ARKIT_INLINE_PREVIEW_IOS)
     modelElementController()->takeModelElementFullscreen(contentLayerId);
+}
 #endif
-}
 
+#if HAVE(ARKIT_INLINE_PREVIEW_MAC)
 void WebPageProxy::modelElementDidCreatePreview(const WebCore::ElementContext& context, const URL& url, const String& uuid, const FloatSize& size)
 {
-#if HAVE(ARKIT_INLINE_PREVIEW_MAC)
     modelElementController()->modelElementDidCreatePreview(context, url, uuid, size);
-#endif
 }
 
 void WebPageProxy::modelElementPreviewDidObtainContextId(const WebCore::ElementContext& context, const String& uuid, uint32_t contextId)
@@ -10709,7 +10708,6 @@
     if (hasRunningProcess())
         send(Messages::WebPage::ModelElementPreviewDidObtainContextId(context, uuid, contextId));
 }
-
 #endif
 
 #if !PLATFORM(COCOA)

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (279476 => 279477)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2021-07-01 18:52:04 UTC (rev 279476)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2021-07-01 19:37:13 UTC (rev 279477)
@@ -189,7 +189,7 @@
 #include "PlatformXRSystem.h"
 #endif
 
-#if ENABLE(MODEL_ELEMENT)
+#if HAVE(ARKIT_INLINE_PREVIEW)
 #include "ModelElementController.h"
 #endif
 
@@ -573,9 +573,13 @@
     void systemPreviewActionTriggered(const WebCore::SystemPreviewInfo&, const String&);
 #endif
 
-#if ENABLE(MODEL_ELEMENT)
+#if HAVE(ARKIT_INLINE_PREVIEW)
     ModelElementController* modelElementController() { return m_modelElementController.get(); }
+#endif
+#if HAVE(ARKIT_INLINE_PREVIEW_IOS)
     void takeModelElementFullscreen(WebCore::GraphicsLayer::PlatformLayerID contentLayerId);
+#endif
+#if HAVE(ARKIT_INLINE_PREVIEW_MAC)
     void modelElementDidCreatePreview(const WebCore::ElementContext&, const URL&, const String&, const WebCore::FloatSize&);
     void modelElementPreviewDidObtainContextId(const WebCore::ElementContext&, const String&, uint32_t);
 #endif
@@ -2608,7 +2612,7 @@
     std::unique_ptr<SystemPreviewController> m_systemPreviewController;
 #endif
 
-#if ENABLE(MODEL_ELEMENT)
+#if HAVE(ARKIT_INLINE_PREVIEW)
     std::unique_ptr<ModelElementController> m_modelElementController;
 #endif
 

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in (279476 => 279477)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in	2021-07-01 18:52:04 UTC (rev 279476)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in	2021-07-01 19:37:13 UTC (rev 279477)
@@ -593,8 +593,10 @@
     ChangeUniversalAccessZoomFocus(WebCore::IntRect viewRect, WebCore::IntRect caretRect)
 #endif
 
-#if ENABLE(MODEL_ELEMENT)
+#if HAVE(ARKIT_INLINE_PREVIEW_IOS)
     TakeModelElementFullscreen(uint64_t contentLayerID)
+#endif
+#if HAVE(ARKIT_INLINE_PREVIEW_MAC)
     ModelElementDidCreatePreview(struct WebCore::ElementContext elementContext, URL url, String uuid, WebCore::FloatSize size)
 #endif
 }

Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.cpp (279476 => 279477)


--- trunk/Source/WebKit/UIProcess/WebProcessPool.cpp	2021-07-01 18:52:04 UTC (rev 279476)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.cpp	2021-07-01 19:37:13 UTC (rev 279477)
@@ -695,7 +695,7 @@
     if (!_javascript_ConfigurationDirectory.isEmpty())
         SandboxExtension::createHandleWithoutResolvingPath(_javascript_ConfigurationDirectory, SandboxExtension::Type::ReadWrite, _javascript_ConfigurationDirectoryExtensionHandle);
 
-#if ENABLE(MODEL_ELEMENT)
+#if HAVE(ARKIT_INLINE_PREVIEW)
     auto modelElementCacheDirectory = websiteDataStore.resolvedModelElementCacheDirectory();
     SandboxExtension::Handle modelElementCacheDirectoryExtensionHandle;
     if (!modelElementCacheDirectory.isEmpty())
@@ -718,7 +718,7 @@
         m_domainsWithUserInteraction,
         m_domainsWithCrossPageStorageAccessQuirk,
 #endif
-#if ENABLE(MODEL_ELEMENT)
+#if HAVE(ARKIT_INLINE_PREVIEW)
         WTFMove(modelElementCacheDirectory),
         WTFMove(modelElementCacheDirectoryExtensionHandle),
 #endif

Modified: trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm (279476 => 279477)


--- trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm	2021-07-01 18:52:04 UTC (rev 279476)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm	2021-07-01 19:37:13 UTC (rev 279477)
@@ -321,7 +321,7 @@
     return tempDirectoryFileSystemRepresentation("_javascript_CoreDebug", ShouldCreateDirectory::No);
 }
 
-#if ENABLE(MODEL_ELEMENT)
+#if HAVE(ARKIT_INLINE_PREVIEW)
 WTF::String WebsiteDataStore::defaultModelElementCacheDirectory()
 {
     return tempDirectoryFileSystemRepresentation("ModelElement", ShouldCreateDirectory::No);

Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp (279476 => 279477)


--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp	2021-07-01 18:52:04 UTC (rev 279476)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp	2021-07-01 19:37:13 UTC (rev 279477)
@@ -265,7 +265,7 @@
         m_resolvedConfiguration->setCacheStorageDirectory(resolvePathForSandboxExtension(m_configuration->cacheStorageDirectory()));
     if (!m_configuration->hstsStorageDirectory().isEmpty() && m_resolvedConfiguration->hstsStorageDirectory().isEmpty())
         m_resolvedConfiguration->setHSTSStorageDirectory(resolvePathForSandboxExtension(m_configuration->hstsStorageDirectory()));
-#if ENABLE(MODEL_ELEMENT)
+#if HAVE(ARKIT_INLINE_PREVIEW)
     if (!m_configuration->modelElementCacheDirectory().isEmpty())
         m_resolvedConfiguration->setModelElementCacheDirectory(resolveAndCreateReadWriteDirectoryForSandboxExtension(m_configuration->modelElementCacheDirectory()));
 #endif

Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h (279476 => 279477)


--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h	2021-07-01 18:52:04 UTC (rev 279476)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h	2021-07-01 19:37:13 UTC (rev 279477)
@@ -253,7 +253,7 @@
     const String& resolvedServiceWorkerRegistrationDirectory() const { return m_resolvedConfiguration->serviceWorkerRegistrationDirectory(); }
     const String& resolvedResourceLoadStatisticsDirectory() const { return m_resolvedConfiguration->resourceLoadStatisticsDirectory(); }
     const String& resolvedHSTSStorageDirectory() const { return m_resolvedConfiguration->hstsStorageDirectory(); }
-#if ENABLE(MODEL_ELEMENT)
+#if HAVE(ARKIT_INLINE_PREVIEW)
     const String& resolvedModelElementCacheDirectory() const { return m_resolvedConfiguration->modelElementCacheDirectory(); }
 #endif
 
@@ -332,7 +332,7 @@
 #if USE(GLIB)
     static WTF::String defaultHSTSDirectory();
 #endif
-#if ENABLE(MODEL_ELEMENT)
+#if HAVE(ARKIT_INLINE_PREVIEW)
     static WTF::String defaultModelElementCacheDirectory();
 #endif
     static WTF::String defaultIndexedDBDatabaseDirectory();

Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp (279476 => 279477)


--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp	2021-07-01 18:52:04 UTC (rev 279476)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp	2021-07-01 19:37:13 UTC (rev 279477)
@@ -47,7 +47,7 @@
         setResourceLoadStatisticsDirectory(WebsiteDataStore::defaultResourceLoadStatisticsDirectory());
         setDeviceIdHashSaltsStorageDirectory(WebsiteDataStore::defaultDeviceIdHashSaltsStorageDirectory());
         setJavaScriptConfigurationDirectory(WebsiteDataStore::defaultJavaScriptConfigurationDirectory());
-#if ENABLE(MODEL_ELEMENT)
+#if HAVE(ARKIT_INLINE_PREVIEW)
         setModelElementCacheDirectory(WebsiteDataStore::defaultModelElementCacheDirectory());
 #endif
     }
@@ -100,7 +100,7 @@
     if (m_proxyConfiguration)
         copy->m_proxyConfiguration = adoptCF(CFDictionaryCreateCopy(nullptr, this->m_proxyConfiguration.get()));
 #endif
-#if ENABLE(MODEL_ELEMENT)
+#if HAVE(ARKIT_INLINE_PREVIEW)
     copy->m_modelElementCacheDirectory = this->m_modelElementCacheDirectory;
 #endif
 

Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h (279476 => 279477)


--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h	2021-07-01 18:52:04 UTC (rev 279476)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h	2021-07-01 19:37:13 UTC (rev 279477)
@@ -74,7 +74,7 @@
     const String& localStorageDirectory() const { return m_localStorageDirectory; }
     void setLocalStorageDirectory(String&& directory) { m_localStorageDirectory = WTFMove(directory); }
 
-#if ENABLE(MODEL_ELEMENT)
+#if HAVE(ARKIT_INLINE_PREVIEW)
     const String& modelElementCacheDirectory() const { return m_modelElementCacheDirectory; }
     void setModelElementCacheDirectory(String&& directory) { m_modelElementCacheDirectory = WTFMove(directory); }
 #endif
@@ -184,7 +184,7 @@
     String m_serviceWorkerRegistrationDirectory;
     String m_webSQLDatabaseDirectory;
     String m_hstsStorageDirectory;
-#if ENABLE(MODEL_ELEMENT)
+#if HAVE(ARKIT_INLINE_PREVIEW)
     String m_modelElementCacheDirectory;
 #endif
 #if USE(GLIB)

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp (279476 => 279477)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp	2021-07-01 18:52:04 UTC (rev 279476)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp	2021-07-01 19:37:13 UTC (rev 279477)
@@ -1515,18 +1515,18 @@
     m_page.didHandleOrPreventMouseDownOrMouseUpEvent();
 }
 
-#if ENABLE(MODEL_ELEMENT)
-
+#if HAVE(ARKIT_INLINE_PREVIEW_IOS)
 void WebChromeClient::takeModelElementFullscreen(WebCore::GraphicsLayer::PlatformLayerID contentLayerId) const
 {
     m_page.takeModelElementFullscreen(contentLayerId);
 }
+#endif
 
+#if HAVE(ARKIT_INLINE_PREVIEW_MAC)
 void WebChromeClient::modelElementDidCreatePreview(WebCore::HTMLModelElement& element, const URL& url, const String& uuid, const WebCore::FloatSize& size) const
 {
     m_page.modelElementDidCreatePreview(element, url, uuid, size);
 }
-
 #endif
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h (279476 => 279477)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h	2021-07-01 18:52:04 UTC (rev 279476)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h	2021-07-01 19:37:13 UTC (rev 279477)
@@ -452,8 +452,10 @@
     void enumerateImmersiveXRDevices(CompletionHandler<void(const PlatformXR::Instance::DeviceList&)>&&) final;
 #endif
 
-#if ENABLE(MODEL_ELEMENT)
+#if HAVE(ARKIT_INLINE_PREVIEW_IOS)
     void takeModelElementFullscreen(WebCore::GraphicsLayer::PlatformLayerID contentLayerId) const final;
+#endif
+#if HAVE(ARKIT_INLINE_PREVIEW_MAC)
     void modelElementDidCreatePreview(WebCore::HTMLModelElement&, const URL&, const String&, const WebCore::FloatSize&) const final;
 #endif
 

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (279476 => 279477)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2021-07-01 18:52:04 UTC (rev 279476)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2021-07-01 19:37:13 UTC (rev 279477)
@@ -269,7 +269,7 @@
 #include <WebCore/AppHighlightStorage.h>
 #endif
 
-#if ENABLE(MODEL_ELEMENT)
+#if HAVE(ARKIT_INLINE_PREVIEW)
 #include <WebCore/HTMLModelElement.h>
 #endif
 
@@ -7678,13 +7678,14 @@
 }
 #endif
 
-#if ENABLE(MODEL_ELEMENT)
-
+#if HAVE(ARKIT_INLINE_PREVIEW_IOS)
 void WebPage::takeModelElementFullscreen(WebCore::GraphicsLayer::PlatformLayerID contentLayerId)
 {
     send(Messages::WebPageProxy::TakeModelElementFullscreen(contentLayerId));
 }
+#endif
 
+#if HAVE(ARKIT_INLINE_PREVIEW_MAC)
 void WebPage::modelElementDidCreatePreview(WebCore::HTMLModelElement& element, const URL& url, const String& uuid, const WebCore::FloatSize& size)
 {
     if (auto elementContext = contextForElement(element))
@@ -7693,17 +7694,10 @@
 
 void WebPage::modelElementPreviewDidObtainContextId(const WebCore::ElementContext& elementContext, const String& uuid, uint32_t contextId)
 {
-#if HAVE(ARKIT_INLINE_PREVIEW_MAC)
     auto element = elementForContext(elementContext);
     if (is<WebCore::HTMLModelElement>(element))
         downcast<WebCore::HTMLModelElement>(*element).inlinePreviewDidObtainContextId(uuid, contextId);
-#else
-    UNUSED_PARAM(elementContext);
-    UNUSED_PARAM(uuid);
-    UNUSED_PARAM(contextId);
-#endif
 }
-
 #endif
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (279476 => 279477)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2021-07-01 18:52:04 UTC (rev 279476)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2021-07-01 19:37:13 UTC (rev 279477)
@@ -210,7 +210,7 @@
 class TextCheckingRequest;
 class VisiblePosition;
 
-#if ENABLE(MODEL_ELEMENT)
+#if HAVE(ARKIT_INLINE_PREVIEW)
 class HTMLModelElement;
 #endif
 
@@ -1465,8 +1465,10 @@
     PlatformXRSystemProxy& xrSystemProxy();
 #endif
 
-#if ENABLE(MODEL_ELEMENT)
+#if HAVE(ARKIT_INLINE_PREVIEW_IOS)
     void takeModelElementFullscreen(WebCore::GraphicsLayer::PlatformLayerID contentLayerId);
+#endif
+#if HAVE(ARKIT_INLINE_PREVIEW_MAC)
     void modelElementDidCreatePreview(WebCore::HTMLModelElement&, const URL&, const String&, const WebCore::FloatSize&);
     void modelElementPreviewDidObtainContextId(const WebCore::ElementContext&, const String&, uint32_t);
 #endif

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (279476 => 279477)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in	2021-07-01 18:52:04 UTC (rev 279476)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in	2021-07-01 19:37:13 UTC (rev 279477)
@@ -644,7 +644,7 @@
     UpdateWithTextRecognitionResult(struct WebCore::TextRecognitionResult result, struct WebCore::ElementContext element, WebCore::FloatPoint location) -> (enum:uint8_t WebKit::TextRecognitionUpdateResult result) Async
 #endif
 
-#if ENABLE(MODEL_ELEMENT)
+#if HAVE(ARKIT_INLINE_PREVIEW_MAC)
     ModelElementPreviewDidObtainContextId(struct WebCore::ElementContext elementContext, String uuid, uint32_t contextId)
 #endif
 }

Modified: trunk/Source/WebKit/WebProcess/WebProcess.cpp (279476 => 279477)


--- trunk/Source/WebKit/WebProcess/WebProcess.cpp	2021-07-01 18:52:04 UTC (rev 279476)
+++ trunk/Source/WebKit/WebProcess/WebProcess.cpp	2021-07-01 19:37:13 UTC (rev 279477)
@@ -141,7 +141,7 @@
 #include <wtf/URLParser.h>
 #include <wtf/text/StringHash.h>
 
-#if ENABLE(MODEL_ELEMENT)
+#if HAVE(ARKIT_INLINE_PREVIEW)
 #include <WebCore/HTMLModelElement.h>
 #endif
 
@@ -572,7 +572,7 @@
         WebCore::HTMLMediaElement::setMediaCacheDirectory(parameters.mediaCacheDirectory);
 #endif
 
-#if ENABLE(MODEL_ELEMENT)
+#if HAVE(ARKIT_INLINE_PREVIEW)
     if (!parameters.modelElementCacheDirectory.isEmpty())
         WebCore::HTMLModelElement::setModelElementCacheDirectory(parameters.modelElementCacheDirectory);
 #endif

Modified: trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (279476 => 279477)


--- trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2021-07-01 18:52:04 UTC (rev 279476)
+++ trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2021-07-01 19:37:13 UTC (rev 279477)
@@ -481,7 +481,7 @@
     SandboxExtension::consumePermanently(parameters.mediaCacheDirectoryExtensionHandle);
     SandboxExtension::consumePermanently(parameters.mediaKeyStorageDirectoryExtensionHandle);
     SandboxExtension::consumePermanently(parameters._javascript_ConfigurationDirectoryExtensionHandle);
-#if ENABLE(MODEL_ELEMENT)
+#if HAVE(ARKIT_INLINE_PREVIEW)
     SandboxExtension::consumePermanently(parameters.modelElementCacheDirectoryExtensionHandle);
 #endif
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to