Title: [285922] trunk/Source
Revision
285922
Author
[email protected]
Date
2021-11-17 02:38:22 -0800 (Wed, 17 Nov 2021)

Log Message

[Model] Create iOS ModelPlayer implementation
https://bugs.webkit.org/show_bug.cgi?id=233192

Reviewed by Dean Jackson.

Bug 232848 factored platform-specific code out of HTMLModelElement with the use of a new ModelPlayer
abstraction with a concrete ARKitInlinePreviewModelPlayer implementation. This first patch moved the
macOS code, and this patch moves the remaining iOS code.

To do so we make ARKitInlinePreviewModelPlayer a parent class of two platform-specific subclasses:
ARKitInlinePreviewModelPlayerMac and ARKitInlinePreviewModelPlayerIOS. We add a new enterFullscreen()
method to ModelPlayer, with an implementation in the iOS subclass. To support this new method, we
add a new platformLayerID() on ModelPlayerClient.

Source/WebCore:

* Modules/model-element/HTMLModelElement.cpp:
(WebCore::HTMLModelElement::modelDidChange):
(WebCore::HTMLModelElement::usesPlatformLayer const):
(WebCore::HTMLModelElement::platformLayerID):
(WebCore::HTMLModelElement::enterFullscreen):
* Modules/model-element/HTMLModelElement.h:
* Modules/model-element/ModelPlayer.h:
* Modules/model-element/ModelPlayerClient.h:
* Modules/model-element/ModelPlayerProvider.h:
* Modules/model-element/dummy/DummyModelPlayer.cpp:
(WebCore::DummyModelPlayer::enterFullscreen):
* Modules/model-element/dummy/DummyModelPlayer.h:
* Modules/model-element/scenekit/SceneKitModelPlayer.h:
* Modules/model-element/scenekit/SceneKitModelPlayer.mm:
(WebCore::SceneKitModelPlayer::enterFullscreen):

Source/WebKit:

* SourcesCocoa.txt:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/Model/ARKitInlinePreviewModelPlayer.h: Added.
(WebKit::ARKitInlinePreviewModelPlayer::page):
(WebKit::ARKitInlinePreviewModelPlayer::client):
* WebProcess/Model/ARKitInlinePreviewModelPlayer.mm: Added.
(WebKit::ARKitInlinePreviewModelPlayer::ARKitInlinePreviewModelPlayer):
(WebKit::ARKitInlinePreviewModelPlayer::~ARKitInlinePreviewModelPlayer):
(WebKit::ARKitInlinePreviewModelPlayer::load):
(WebKit::ARKitInlinePreviewModelPlayer::layer):
(WebKit::ARKitInlinePreviewModelPlayer::enterFullscreen):
* WebProcess/Model/WebModelPlayerProvider.cpp:
(WebKit::WebModelPlayerProvider::createModelPlayer):
* WebProcess/Model/WebModelPlayerProvider.h:
* WebProcess/Model/ios/ARKitInlinePreviewModelPlayerIOS.h: Added.
* WebProcess/Model/ios/ARKitInlinePreviewModelPlayerIOS.mm: Added.
(WebKit::ARKitInlinePreviewModelPlayerIOS::create):
(WebKit::ARKitInlinePreviewModelPlayerIOS::ARKitInlinePreviewModelPlayerIOS):
(WebKit::ARKitInlinePreviewModelPlayerIOS::~ARKitInlinePreviewModelPlayerIOS):
(WebKit::ARKitInlinePreviewModelPlayerIOS::enterFullscreen):
* WebProcess/Model/mac/ARKitInlinePreviewModelPlayerMac.h: Renamed from Source/WebKit/WebProcess/Model/mac/ARKitInlinePreviewModelPlayer.h.
* WebProcess/Model/mac/ARKitInlinePreviewModelPlayerMac.mm: Renamed from Source/WebKit/WebProcess/Model/mac/ARKitInlinePreviewModelPlayer.mm.
(WebKit::ARKitInlinePreviewModelPlayerMac::create):
(WebKit::ARKitInlinePreviewModelPlayerMac::ARKitInlinePreviewModelPlayerMac):
(WebKit::ARKitInlinePreviewModelPlayerMac::~ARKitInlinePreviewModelPlayerMac):
(WebKit::ARKitInlinePreviewModelPlayerMac::setModelElementCacheDirectory):
(WebKit::ARKitInlinePreviewModelPlayerMac::createFile):
(WebKit::ARKitInlinePreviewModelPlayerMac::clearFile):
(WebKit::ARKitInlinePreviewModelPlayerMac::load):
(WebKit::ARKitInlinePreviewModelPlayerMac::layer):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::setWebsiteDataStoreParameters):

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (285921 => 285922)


--- trunk/Source/WebCore/ChangeLog	2021-11-17 10:29:44 UTC (rev 285921)
+++ trunk/Source/WebCore/ChangeLog	2021-11-17 10:38:22 UTC (rev 285922)
@@ -1,3 +1,35 @@
+2021-11-17  Antoine Quint  <[email protected]>
+
+        [Model] Create iOS ModelPlayer implementation
+        https://bugs.webkit.org/show_bug.cgi?id=233192
+
+        Reviewed by Dean Jackson.
+
+        Bug 232848 factored platform-specific code out of HTMLModelElement with the use of a new ModelPlayer
+        abstraction with a concrete ARKitInlinePreviewModelPlayer implementation. This first patch moved the
+        macOS code, and this patch moves the remaining iOS code.
+
+        To do so we make ARKitInlinePreviewModelPlayer a parent class of two platform-specific subclasses:
+        ARKitInlinePreviewModelPlayerMac and ARKitInlinePreviewModelPlayerIOS. We add a new enterFullscreen()
+        method to ModelPlayer, with an implementation in the iOS subclass. To support this new method, we
+        add a new platformLayerID() on ModelPlayerClient.
+
+        * Modules/model-element/HTMLModelElement.cpp:
+        (WebCore::HTMLModelElement::modelDidChange):
+        (WebCore::HTMLModelElement::usesPlatformLayer const):
+        (WebCore::HTMLModelElement::platformLayerID):
+        (WebCore::HTMLModelElement::enterFullscreen):
+        * Modules/model-element/HTMLModelElement.h:
+        * Modules/model-element/ModelPlayer.h:
+        * Modules/model-element/ModelPlayerClient.h:
+        * Modules/model-element/ModelPlayerProvider.h:
+        * Modules/model-element/dummy/DummyModelPlayer.cpp:
+        (WebCore::DummyModelPlayer::enterFullscreen):
+        * Modules/model-element/dummy/DummyModelPlayer.h:
+        * Modules/model-element/scenekit/SceneKitModelPlayer.h:
+        * Modules/model-element/scenekit/SceneKitModelPlayer.mm:
+        (WebCore::SceneKitModelPlayer::enterFullscreen):
+
 2021-11-17  Rob Buis  <[email protected]>
 
         Null check clonedParent

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


--- trunk/Source/WebCore/Modules/model-element/HTMLModelElement.cpp	2021-11-17 10:29:44 UTC (rev 285921)
+++ trunk/Source/WebCore/Modules/model-element/HTMLModelElement.cpp	2021-11-17 10:38:22 UTC (rev 285922)
@@ -30,8 +30,11 @@
 
 #include "CachedResourceLoader.h"
 #include "DOMPromiseProxy.h"
+#include "Document.h"
 #include "ElementChildIterator.h"
 #include "ElementInlines.h"
+#include "GraphicsLayer.h"
+#include "GraphicsLayerCA.h"
 #include "HTMLNames.h"
 #include "HTMLParserIdioms.h"
 #include "HTMLSourceElement.h"
@@ -40,22 +43,14 @@
 #include "Model.h"
 #include "ModelPlayer.h"
 #include "ModelPlayerProvider.h"
+#include "Page.h"
+#include "RenderLayer.h"
+#include "RenderLayerBacking.h"
 #include "RenderLayerModelObject.h"
 #include "RenderModel.h"
 #include <wtf/IsoMallocInlines.h>
 #include <wtf/URL.h>
 
-#if ENABLE(ARKIT_INLINE_PREVIEW_IOS)
-#include "Chrome.h"
-#include "ChromeClient.h"
-#include "Document.h"
-#include "GraphicsLayer.h"
-#include "GraphicsLayerCA.h"
-#include "Page.h"
-#include "RenderLayer.h"
-#include "RenderLayerBacking.h"
-#endif
-
 namespace WebCore {
 
 WTF_MAKE_ISO_ALLOCATED_IMPL(HTMLModelElement);
@@ -234,9 +229,6 @@
     if (!renderer)
         return;
 
-    // NOTE: For now, createModelPlayer returning nullptr means that the GraphicsLayer::setContentsToModel() path
-    // is being used, but that needs to be phased out to allow bidirectional communication between the model player
-    // and the HTMLModelElement. Once that is phased out, createModelPlayer() should be updated to return a Ref<>.
     m_modelPlayer = page->modelPlayerProvider().createModelPlayer(*this);
     if (!m_modelPlayer)
         return;
@@ -244,13 +236,12 @@
     // FIXME: We need to tell the player if the size changes as well, so passing this
     // in with load probably doesn't make sense.
     auto size = renderer->absoluteBoundingBoxRect(false).size();
-
     m_modelPlayer->load(*m_model, size);
 }
 
 bool HTMLModelElement::usesPlatformLayer() const
 {
-    return m_modelPlayer != nullptr;
+    return m_modelPlayer && m_modelPlayer->layer();
 }
 
 PlatformLayer* HTMLModelElement::platformLayer() const
@@ -271,32 +262,33 @@
     ASSERT_UNUSED(modelPlayer, &modelPlayer == m_modelPlayer);
 }
 
-// MARK: - Fullscreen support.
-
-void HTMLModelElement::enterFullscreen()
+GraphicsLayer::PlatformLayerID HTMLModelElement::platformLayerID()
 {
-// FIXME: Add a new method to ModelPlayer for entering fullscreen and move this into the iOS ARKit inline preview ModelPlayer implementation.
-#if ENABLE(ARKIT_INLINE_PREVIEW_IOS)
     auto* page = document().page();
     if (!page)
-        return;
+        return 0;
 
     if (!is<RenderLayerModelObject>(this->renderer()))
-        return;
+        return 0;
 
     auto& renderLayerModelObject = downcast<RenderLayerModelObject>(*this->renderer());
     if (!renderLayerModelObject.isComposited() || !renderLayerModelObject.layer() || !renderLayerModelObject.layer()->backing())
-        return;
+        return 0;
 
     auto* graphicsLayer = renderLayerModelObject.layer()->backing()->graphicsLayer();
     if (!graphicsLayer)
-        return;
+        return 0;
 
-    if (auto contentLayerId = graphicsLayer->contentsLayerIDForModel())
-        page->chrome().client().takeModelElementFullscreen(contentLayerId);
-#endif
+    return graphicsLayer->contentsLayerIDForModel();
 }
 
+// MARK: - Fullscreen support.
+
+void HTMLModelElement::enterFullscreen()
+{
+    m_modelPlayer->enterFullscreen();
 }
 
+}
+
 #endif // ENABLE(MODEL_ELEMENT)

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


--- trunk/Source/WebCore/Modules/model-element/HTMLModelElement.h	2021-11-17 10:29:44 UTC (rev 285921)
+++ trunk/Source/WebCore/Modules/model-element/HTMLModelElement.h	2021-11-17 10:38:22 UTC (rev 285922)
@@ -30,6 +30,7 @@
 #include "CachedRawResource.h"
 #include "CachedRawResourceClient.h"
 #include "CachedResourceHandle.h"
+#include "GraphicsLayer.h"
 #include "HTMLElement.h"
 #include "IDLTypes.h"
 #include "ModelPlayerClient.h"
@@ -89,6 +90,7 @@
     // ModelPlayerClient overrides.
     void didFinishLoading(ModelPlayer&) final;
     void didFailLoading(ModelPlayer&, const ResourceError&) final;
+    GraphicsLayer::PlatformLayerID platformLayerID() final;
 
     URL m_sourceURL;
     CachedResourceHandle<CachedRawResource> m_resource;

Modified: trunk/Source/WebCore/Modules/model-element/ModelPlayer.h (285921 => 285922)


--- trunk/Source/WebCore/Modules/model-element/ModelPlayer.h	2021-11-17 10:29:44 UTC (rev 285921)
+++ trunk/Source/WebCore/Modules/model-element/ModelPlayer.h	2021-11-17 10:38:22 UTC (rev 285922)
@@ -40,6 +40,7 @@
 
     virtual void load(Model&, LayoutSize) = 0;
     virtual PlatformLayer* layer() = 0;
+    virtual void enterFullscreen() = 0;
 };
 
 }

Modified: trunk/Source/WebCore/Modules/model-element/ModelPlayerClient.h (285921 => 285922)


--- trunk/Source/WebCore/Modules/model-element/ModelPlayerClient.h	2021-11-17 10:29:44 UTC (rev 285921)
+++ trunk/Source/WebCore/Modules/model-element/ModelPlayerClient.h	2021-11-17 10:38:22 UTC (rev 285922)
@@ -25,6 +25,7 @@
 
 #pragma once
 
+#include "GraphicsLayer.h"
 #include <wtf/Forward.h>
 #include <wtf/WeakPtr.h>
 
@@ -39,6 +40,7 @@
 
     virtual void didFinishLoading(ModelPlayer&) = 0;
     virtual void didFailLoading(ModelPlayer&, const ResourceError&) = 0;
+    virtual GraphicsLayer::PlatformLayerID platformLayerID() = 0;
 };
 
 }

Modified: trunk/Source/WebCore/Modules/model-element/dummy/DummyModelPlayer.cpp (285921 => 285922)


--- trunk/Source/WebCore/Modules/model-element/dummy/DummyModelPlayer.cpp	2021-11-17 10:29:44 UTC (rev 285921)
+++ trunk/Source/WebCore/Modules/model-element/dummy/DummyModelPlayer.cpp	2021-11-17 10:38:22 UTC (rev 285922)
@@ -54,4 +54,8 @@
     return nullptr;
 }
 
+void DummyModelPlayer::enterFullscreen()
+{
 }
+
+}

Modified: trunk/Source/WebCore/Modules/model-element/dummy/DummyModelPlayer.h (285921 => 285922)


--- trunk/Source/WebCore/Modules/model-element/dummy/DummyModelPlayer.h	2021-11-17 10:29:44 UTC (rev 285921)
+++ trunk/Source/WebCore/Modules/model-element/dummy/DummyModelPlayer.h	2021-11-17 10:38:22 UTC (rev 285922)
@@ -41,8 +41,9 @@
     DummyModelPlayer(ModelPlayerClient&);
 
     // ModelPlayer overrides.
-    virtual void load(Model&, LayoutSize) override;
-    virtual PlatformLayer* layer() override;
+    void load(Model&, LayoutSize) override;
+    PlatformLayer* layer() override;
+    void enterFullscreen() override;
 
     WeakPtr<ModelPlayerClient> m_client;
 };

Modified: trunk/Source/WebCore/Modules/model-element/scenekit/SceneKitModelPlayer.h (285921 => 285922)


--- trunk/Source/WebCore/Modules/model-element/scenekit/SceneKitModelPlayer.h	2021-11-17 10:29:44 UTC (rev 285921)
+++ trunk/Source/WebCore/Modules/model-element/scenekit/SceneKitModelPlayer.h	2021-11-17 10:38:22 UTC (rev 285922)
@@ -55,8 +55,9 @@
     void updateScene();
 
     // ModelPlayer overrides.
-    virtual void load(Model&, LayoutSize) override;
-    virtual CALayer *layer() override;
+    void load(Model&, LayoutSize) override;
+    CALayer *layer() override;
+    void enterFullscreen() override;
 
     // SceneKitModelLoaderClient overrides.
     virtual void didFinishLoading(SceneKitModelLoader&, Ref<SceneKitModel>) override;

Modified: trunk/Source/WebCore/Modules/model-element/scenekit/SceneKitModelPlayer.mm (285921 => 285922)


--- trunk/Source/WebCore/Modules/model-element/scenekit/SceneKitModelPlayer.mm	2021-11-17 10:29:44 UTC (rev 285921)
+++ trunk/Source/WebCore/Modules/model-element/scenekit/SceneKitModelPlayer.mm	2021-11-17 10:38:22 UTC (rev 285922)
@@ -72,6 +72,10 @@
     return m_layer.get();
 }
 
+void SceneKitModelPlayer::enterFullscreen()
+{
+}
+
 // MARK: - SceneKitModelLoaderClient overrides.
 
 void SceneKitModelPlayer::didFinishLoading(SceneKitModelLoader& loader, Ref<SceneKitModel> model)

Modified: trunk/Source/WebKit/ChangeLog (285921 => 285922)


--- trunk/Source/WebKit/ChangeLog	2021-11-17 10:29:44 UTC (rev 285921)
+++ trunk/Source/WebKit/ChangeLog	2021-11-17 10:38:22 UTC (rev 285922)
@@ -1,3 +1,52 @@
+2021-11-17  Antoine Quint  <[email protected]>
+
+        [Model] Create iOS ModelPlayer implementation
+        https://bugs.webkit.org/show_bug.cgi?id=233192
+
+        Reviewed by Dean Jackson.
+
+        Bug 232848 factored platform-specific code out of HTMLModelElement with the use of a new ModelPlayer
+        abstraction with a concrete ARKitInlinePreviewModelPlayer implementation. This first patch moved the
+        macOS code, and this patch moves the remaining iOS code.
+
+        To do so we make ARKitInlinePreviewModelPlayer a parent class of two platform-specific subclasses:
+        ARKitInlinePreviewModelPlayerMac and ARKitInlinePreviewModelPlayerIOS. We add a new enterFullscreen()
+        method to ModelPlayer, with an implementation in the iOS subclass. To support this new method, we
+        add a new platformLayerID() on ModelPlayerClient.
+
+        * SourcesCocoa.txt:
+        * WebKit.xcodeproj/project.pbxproj:
+        * WebProcess/Model/ARKitInlinePreviewModelPlayer.h: Added.
+        (WebKit::ARKitInlinePreviewModelPlayer::page):
+        (WebKit::ARKitInlinePreviewModelPlayer::client):
+        * WebProcess/Model/ARKitInlinePreviewModelPlayer.mm: Added.
+        (WebKit::ARKitInlinePreviewModelPlayer::ARKitInlinePreviewModelPlayer):
+        (WebKit::ARKitInlinePreviewModelPlayer::~ARKitInlinePreviewModelPlayer):
+        (WebKit::ARKitInlinePreviewModelPlayer::load):
+        (WebKit::ARKitInlinePreviewModelPlayer::layer):
+        (WebKit::ARKitInlinePreviewModelPlayer::enterFullscreen):
+        * WebProcess/Model/WebModelPlayerProvider.cpp:
+        (WebKit::WebModelPlayerProvider::createModelPlayer):
+        * WebProcess/Model/WebModelPlayerProvider.h:
+        * WebProcess/Model/ios/ARKitInlinePreviewModelPlayerIOS.h: Added.
+        * WebProcess/Model/ios/ARKitInlinePreviewModelPlayerIOS.mm: Added.
+        (WebKit::ARKitInlinePreviewModelPlayerIOS::create):
+        (WebKit::ARKitInlinePreviewModelPlayerIOS::ARKitInlinePreviewModelPlayerIOS):
+        (WebKit::ARKitInlinePreviewModelPlayerIOS::~ARKitInlinePreviewModelPlayerIOS):
+        (WebKit::ARKitInlinePreviewModelPlayerIOS::enterFullscreen):
+        * WebProcess/Model/mac/ARKitInlinePreviewModelPlayerMac.h: Renamed from Source/WebKit/WebProcess/Model/mac/ARKitInlinePreviewModelPlayer.h.
+        * WebProcess/Model/mac/ARKitInlinePreviewModelPlayerMac.mm: Renamed from Source/WebKit/WebProcess/Model/mac/ARKitInlinePreviewModelPlayer.mm.
+        (WebKit::ARKitInlinePreviewModelPlayerMac::create):
+        (WebKit::ARKitInlinePreviewModelPlayerMac::ARKitInlinePreviewModelPlayerMac):
+        (WebKit::ARKitInlinePreviewModelPlayerMac::~ARKitInlinePreviewModelPlayerMac):
+        (WebKit::ARKitInlinePreviewModelPlayerMac::setModelElementCacheDirectory):
+        (WebKit::ARKitInlinePreviewModelPlayerMac::createFile):
+        (WebKit::ARKitInlinePreviewModelPlayerMac::clearFile):
+        (WebKit::ARKitInlinePreviewModelPlayerMac::load):
+        (WebKit::ARKitInlinePreviewModelPlayerMac::layer):
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::setWebsiteDataStoreParameters):
+
 2021-11-17  Zixing Liu  <[email protected]>
 
         [GTK][WPE] Support getting and setting HTTP headers in custom URI scheme handlers

Modified: trunk/Source/WebKit/SourcesCocoa.txt (285921 => 285922)


--- trunk/Source/WebKit/SourcesCocoa.txt	2021-11-17 10:29:44 UTC (rev 285921)
+++ trunk/Source/WebKit/SourcesCocoa.txt	2021-11-17 10:38:22 UTC (rev 285922)
@@ -655,7 +655,9 @@
 
 WebProcess/MediaCache/WebMediaKeyStorageManager.cpp
 
-WebProcess/Model/mac/ARKitInlinePreviewModelPlayer.mm
+WebProcess/Model/ARKitInlinePreviewModelPlayer.mm
+WebProcess/Model/ios/ARKitInlinePreviewModelPlayerIOS.mm
+WebProcess/Model/mac/ARKitInlinePreviewModelPlayerMac.mm
 
 WebProcess/Plugins/PDF/PDFPlugin.mm
 WebProcess/Plugins/PDF/PDFPluginAnnotation.mm

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (285921 => 285922)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2021-11-17 10:29:44 UTC (rev 285921)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2021-11-17 10:38:22 UTC (rev 285922)
@@ -4620,6 +4620,10 @@
 		7137BA7D25F153E900914EE3 /* ModelElementControllerCocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ModelElementControllerCocoa.mm; sourceTree = "<group>"; };
 		7137BA7E25F1540B00914EE3 /* ModelElementController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ModelElementController.cpp; sourceTree = "<group>"; };
 		7137BA7F25F1540C00914EE3 /* ModelElementController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ModelElementController.h; sourceTree = "<group>"; };
+		7177AD5B2743D7A9002F103B /* ARKitInlinePreviewModelPlayer.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ARKitInlinePreviewModelPlayer.mm; sourceTree = "<group>"; };
+		7177AD5C2743D7A9002F103B /* ARKitInlinePreviewModelPlayer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ARKitInlinePreviewModelPlayer.h; sourceTree = "<group>"; };
+		7177AD662743F66C002F103B /* ARKitInlinePreviewModelPlayerIOS.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ARKitInlinePreviewModelPlayerIOS.mm; sourceTree = "<group>"; };
+		7177AD672743F66C002F103B /* ARKitInlinePreviewModelPlayerIOS.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ARKitInlinePreviewModelPlayerIOS.h; sourceTree = "<group>"; };
 		71A676A422C62318007D6295 /* WKTouchActionGestureRecognizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKTouchActionGestureRecognizer.h; path = ios/WKTouchActionGestureRecognizer.h; sourceTree = "<group>"; };
 		71A676A522C62318007D6295 /* WKTouchActionGestureRecognizer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKTouchActionGestureRecognizer.mm; path = ios/WKTouchActionGestureRecognizer.mm; sourceTree = "<group>"; };
 		71BAA73125FFCCBA00D7CD5D /* WKModelView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKModelView.h; path = ios/WKModelView.h; sourceTree = "<group>"; };
@@ -5327,8 +5331,8 @@
 		BC20528011C94284008F3375 /* WKBundlePage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundlePage.cpp; sourceTree = "<group>"; };
 		BC2652121182608100243E12 /* DrawingAreaProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DrawingAreaProxy.cpp; sourceTree = "<group>"; };
 		BC2652131182608100243E12 /* DrawingAreaProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DrawingAreaProxy.h; sourceTree = "<group>"; };
-		BC2B410C2732EF9600A2D191 /* ARKitInlinePreviewModelPlayer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ARKitInlinePreviewModelPlayer.h; sourceTree = "<group>"; };
-		BC2B410D2732EF9600A2D191 /* ARKitInlinePreviewModelPlayer.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ARKitInlinePreviewModelPlayer.mm; sourceTree = "<group>"; };
+		BC2B410C2732EF9600A2D191 /* ARKitInlinePreviewModelPlayerMac.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ARKitInlinePreviewModelPlayerMac.h; sourceTree = "<group>"; };
+		BC2B410D2732EF9600A2D191 /* ARKitInlinePreviewModelPlayerMac.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ARKitInlinePreviewModelPlayerMac.mm; sourceTree = "<group>"; };
 		BC2B411A2732F66E00A2D191 /* WebModelPlayerProvider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebModelPlayerProvider.h; sourceTree = "<group>"; };
 		BC2B411B2732F66E00A2D191 /* WebModelPlayerProvider.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebModelPlayerProvider.cpp; sourceTree = "<group>"; };
 		BC2D021612AC41CB00E732A3 /* SameDocumentNavigationType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SameDocumentNavigationType.h; sourceTree = "<group>"; };
@@ -9519,6 +9523,15 @@
 			name = mac;
 			sourceTree = "<group>";
 		};
+		7177AD652743F66C002F103B /* ios */ = {
+			isa = PBXGroup;
+			children = (
+				7177AD672743F66C002F103B /* ARKitInlinePreviewModelPlayerIOS.h */,
+				7177AD662743F66C002F103B /* ARKitInlinePreviewModelPlayerIOS.mm */,
+			);
+			path = ios;
+			sourceTree = "<group>";
+		};
 		727A7F3324078527004D2931 /* cocoa */ = {
 			isa = PBXGroup;
 			children = (
@@ -10840,7 +10853,10 @@
 		BC2B410A2732EF6500A2D191 /* Model */ = {
 			isa = PBXGroup;
 			children = (
+				7177AD652743F66C002F103B /* ios */,
 				BC2B410B2732EF7500A2D191 /* mac */,
+				7177AD5C2743D7A9002F103B /* ARKitInlinePreviewModelPlayer.h */,
+				7177AD5B2743D7A9002F103B /* ARKitInlinePreviewModelPlayer.mm */,
 				BC2B411B2732F66E00A2D191 /* WebModelPlayerProvider.cpp */,
 				BC2B411A2732F66E00A2D191 /* WebModelPlayerProvider.h */,
 			);
@@ -10850,8 +10866,8 @@
 		BC2B410B2732EF7500A2D191 /* mac */ = {
 			isa = PBXGroup;
 			children = (
-				BC2B410C2732EF9600A2D191 /* ARKitInlinePreviewModelPlayer.h */,
-				BC2B410D2732EF9600A2D191 /* ARKitInlinePreviewModelPlayer.mm */,
+				BC2B410C2732EF9600A2D191 /* ARKitInlinePreviewModelPlayerMac.h */,
+				BC2B410D2732EF9600A2D191 /* ARKitInlinePreviewModelPlayerMac.mm */,
 			);
 			path = mac;
 			sourceTree = "<group>";

Copied: trunk/Source/WebKit/WebProcess/Model/ARKitInlinePreviewModelPlayer.h (from rev 285921, trunk/Source/WebKit/WebProcess/Model/mac/ARKitInlinePreviewModelPlayer.h) (0 => 285922)


--- trunk/Source/WebKit/WebProcess/Model/ARKitInlinePreviewModelPlayer.h	                        (rev 0)
+++ trunk/Source/WebKit/WebProcess/Model/ARKitInlinePreviewModelPlayer.h	2021-11-17 10:38:22 UTC (rev 285922)
@@ -0,0 +1,58 @@
+/*
+ * 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 ENABLE(ARKIT_INLINE_PREVIEW)
+
+#include <WebCore/ModelPlayer.h>
+#include <WebCore/ModelPlayerClient.h>
+#include <wtf/Compiler.h>
+
+namespace WebKit {
+
+class ARKitInlinePreviewModelPlayer : public WebCore::ModelPlayer, public CanMakeWeakPtr<ARKitInlinePreviewModelPlayer> {
+public:
+    virtual ~ARKitInlinePreviewModelPlayer();
+
+protected:
+    explicit ARKitInlinePreviewModelPlayer(WebPage&, WebCore::ModelPlayerClient&);
+
+    WebPage* page() { return m_page.get(); }
+    WebCore::ModelPlayerClient* client() { return m_client.get(); }
+
+private:
+    // WebCore::ModelPlayer overrides.
+    void load(WebCore::Model&, WebCore::LayoutSize) override;
+    PlatformLayer* layer() override;
+    void enterFullscreen() override;
+
+    WeakPtr<WebPage> m_page;
+    WeakPtr<WebCore::ModelPlayerClient> m_client;
+};
+
+}
+
+#endif

Copied: trunk/Source/WebKit/WebProcess/Model/ARKitInlinePreviewModelPlayer.mm (from rev 285921, trunk/Source/WebCore/Modules/model-element/dummy/DummyModelPlayer.h) (0 => 285922)


--- trunk/Source/WebKit/WebProcess/Model/ARKitInlinePreviewModelPlayer.mm	                        (rev 0)
+++ trunk/Source/WebKit/WebProcess/Model/ARKitInlinePreviewModelPlayer.mm	2021-11-17 10:38:22 UTC (rev 285922)
@@ -0,0 +1,60 @@
+/*
+ * 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"
+#import "ARKitInlinePreviewModelPlayer.h"
+
+#if ENABLE(ARKIT_INLINE_PREVIEW)
+
+#import "WebPage.h"
+
+namespace WebKit {
+
+ARKitInlinePreviewModelPlayer::ARKitInlinePreviewModelPlayer(WebPage& page, WebCore::ModelPlayerClient& client)
+    : m_page { page }
+    , m_client { client }
+{
+}
+
+ARKitInlinePreviewModelPlayer::~ARKitInlinePreviewModelPlayer()
+{
+}
+
+void ARKitInlinePreviewModelPlayer::load(WebCore::Model&, WebCore::LayoutSize)
+{
+}
+
+PlatformLayer* ARKitInlinePreviewModelPlayer::layer()
+{
+    return nullptr;
+}
+
+void ARKitInlinePreviewModelPlayer::enterFullscreen()
+{
+}
+
+}
+
+#endif

Modified: trunk/Source/WebKit/WebProcess/Model/WebModelPlayerProvider.cpp (285921 => 285922)


--- trunk/Source/WebKit/WebProcess/Model/WebModelPlayerProvider.cpp	2021-11-17 10:29:44 UTC (rev 285921)
+++ trunk/Source/WebKit/WebProcess/Model/WebModelPlayerProvider.cpp	2021-11-17 10:38:22 UTC (rev 285922)
@@ -30,9 +30,13 @@
 #include <WebCore/ModelPlayer.h>
 
 #if ENABLE(ARKIT_INLINE_PREVIEW_MAC)
-#include "ARKitInlinePreviewModelPlayer.h"
+#include "ARKitInlinePreviewModelPlayerMac.h"
 #endif
 
+#if ENABLE(ARKIT_INLINE_PREVIEW_IOS)
+#include "ARKitInlinePreviewModelPlayerIOS.h"
+#endif
+
 #if HAVE(SCENEKIT)
 #include <WebCore/SceneKitModelPlayer.h>
 #endif
@@ -51,17 +55,19 @@
 
 RefPtr<WebCore::ModelPlayer> WebModelPlayerProvider::createModelPlayer(WebCore::ModelPlayerClient& client)
 {
-    UNUSED_PARAM(client);
-
 #if ENABLE(ARKIT_INLINE_PREVIEW_MAC)
     if (m_page.useARKitForModel())
-        return ARKitInlinePreviewModelPlayer::create(m_page, client);
+        return ARKitInlinePreviewModelPlayerMac::create(m_page, client);
 #endif
 #if HAVE(SCENEKIT)
     if (m_page.useSceneKitForModel())
         return WebCore::SceneKitModelPlayer::create(client);
 #endif
+#if ENABLE(ARKIT_INLINE_PREVIEW_IOS)
+    return ARKitInlinePreviewModelPlayerIOS::create(m_page, client);
+#endif
 
+    UNUSED_PARAM(client);
     return nullptr;
 }
 

Copied: trunk/Source/WebKit/WebProcess/Model/ios/ARKitInlinePreviewModelPlayerIOS.h (from rev 285921, trunk/Source/WebCore/Modules/model-element/dummy/DummyModelPlayer.h) (0 => 285922)


--- trunk/Source/WebKit/WebProcess/Model/ios/ARKitInlinePreviewModelPlayerIOS.h	                        (rev 0)
+++ trunk/Source/WebKit/WebProcess/Model/ios/ARKitInlinePreviewModelPlayerIOS.h	2021-11-17 10:38:22 UTC (rev 285922)
@@ -0,0 +1,50 @@
+/*
+ * 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 ENABLE(ARKIT_INLINE_PREVIEW_IOS)
+
+#include "ARKitInlinePreviewModelPlayer.h"
+#include <WebCore/ModelPlayer.h>
+#include <WebCore/ModelPlayerClient.h>
+
+namespace WebKit {
+
+class ARKitInlinePreviewModelPlayerIOS final : public ARKitInlinePreviewModelPlayer {
+public:
+    static Ref<ARKitInlinePreviewModelPlayerIOS> create(WebPage&, WebCore::ModelPlayerClient&);
+    virtual ~ARKitInlinePreviewModelPlayerIOS();
+
+private:
+    ARKitInlinePreviewModelPlayerIOS(WebPage&, WebCore::ModelPlayerClient&);
+
+    // WebCore::ModelPlayer overrides.
+    void enterFullscreen() override;
+};
+
+}
+
+#endif

Copied: trunk/Source/WebKit/WebProcess/Model/ios/ARKitInlinePreviewModelPlayerIOS.mm (from rev 285921, trunk/Source/WebKit/WebProcess/Model/WebModelPlayerProvider.cpp) (0 => 285922)


--- trunk/Source/WebKit/WebProcess/Model/ios/ARKitInlinePreviewModelPlayerIOS.mm	                        (rev 0)
+++ trunk/Source/WebKit/WebProcess/Model/ios/ARKitInlinePreviewModelPlayerIOS.mm	2021-11-17 10:38:22 UTC (rev 285922)
@@ -0,0 +1,64 @@
+/*
+ * 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"
+#import "ARKitInlinePreviewModelPlayerIOS.h"
+
+#if ENABLE(ARKIT_INLINE_PREVIEW_IOS)
+
+#import "WebPage.h"
+#import "WebPageProxyMessages.h"
+#import <WebCore/GraphicsLayer.h>
+
+namespace WebKit {
+
+Ref<ARKitInlinePreviewModelPlayerIOS> ARKitInlinePreviewModelPlayerIOS::create(WebPage& page, WebCore::ModelPlayerClient& client)
+{
+    return adoptRef(*new ARKitInlinePreviewModelPlayerIOS(page, client));
+}
+
+ARKitInlinePreviewModelPlayerIOS::ARKitInlinePreviewModelPlayerIOS(WebPage& page, WebCore::ModelPlayerClient& client)
+    : ARKitInlinePreviewModelPlayer(page, client)
+{
+}
+
+ARKitInlinePreviewModelPlayerIOS::~ARKitInlinePreviewModelPlayerIOS()
+{
+}
+
+// MARK: - WebCore::ModelPlayer overrides.
+
+void ARKitInlinePreviewModelPlayerIOS::enterFullscreen()
+{
+    if (!client() || !page())
+        return;
+
+    if (auto layerId = client()->platformLayerID())
+        page()->takeModelElementFullscreen(layerId);
+}
+
+}
+
+#endif

Deleted: trunk/Source/WebKit/WebProcess/Model/mac/ARKitInlinePreviewModelPlayer.h (285921 => 285922)


--- trunk/Source/WebKit/WebProcess/Model/mac/ARKitInlinePreviewModelPlayer.h	2021-11-17 10:29:44 UTC (rev 285921)
+++ trunk/Source/WebKit/WebProcess/Model/mac/ARKitInlinePreviewModelPlayer.h	2021-11-17 10:38:22 UTC (rev 285922)
@@ -1,65 +0,0 @@
-/*
- * 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 ENABLE(ARKIT_INLINE_PREVIEW_MAC)
-
-#include <WebCore/ModelPlayer.h>
-#include <WebCore/ModelPlayerClient.h>
-#include <wtf/Compiler.h>
-#include <wtf/RetainPtr.h>
-
-OBJC_CLASS ASVInlinePreview;
-
-namespace WebKit {
-
-class ARKitInlinePreviewModelPlayer final : public WebCore::ModelPlayer, public CanMakeWeakPtr<ARKitInlinePreviewModelPlayer> {
-public:
-    static Ref<ARKitInlinePreviewModelPlayer> create(WebPage&, WebCore::ModelPlayerClient&);
-    virtual ~ARKitInlinePreviewModelPlayer();
-
-    static void setModelElementCacheDirectory(const String&);
-
-private:
-    ARKitInlinePreviewModelPlayer(WebPage&, WebCore::ModelPlayerClient&);
-
-    // WebCore::ModelPlayer overrides.
-    virtual void load(WebCore::Model&, WebCore::LayoutSize) override;
-    virtual PlatformLayer* layer() override;
-
-    void createFile(WebCore::Model&);
-    void clearFile();
-
-    WeakPtr<WebPage> m_page;
-    WeakPtr<WebCore::ModelPlayerClient> m_client;
-
-    String m_filePath;
-    RetainPtr<ASVInlinePreview> m_inlinePreview;
-};
-
-}
-
-#endif

Deleted: trunk/Source/WebKit/WebProcess/Model/mac/ARKitInlinePreviewModelPlayer.mm (285921 => 285922)


--- trunk/Source/WebKit/WebProcess/Model/mac/ARKitInlinePreviewModelPlayer.mm	2021-11-17 10:29:44 UTC (rev 285921)
+++ trunk/Source/WebKit/WebProcess/Model/mac/ARKitInlinePreviewModelPlayer.mm	2021-11-17 10:38:22 UTC (rev 285922)
@@ -1,177 +0,0 @@
-/*
- * 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 ENABLE(ARKIT_INLINE_PREVIEW_MAC)
-
-#import "ARKitInlinePreviewModelPlayer.h"
-
-#import "WebPage.h"
-#import "WebPageProxyMessages.h"
-#import <WebCore/Model.h>
-#import <pal/spi/mac/SystemPreviewSPI.h>
-#import <wtf/SoftLinking.h>
-#import <wtf/UUID.h>
-
-SOFT_LINK_PRIVATE_FRAMEWORK(AssetViewer);
-SOFT_LINK_CLASS(AssetViewer, ASVInlinePreview);
-
-namespace WebKit {
-
-Ref<ARKitInlinePreviewModelPlayer> ARKitInlinePreviewModelPlayer::create(WebPage& page, WebCore::ModelPlayerClient& client)
-{
-    return adoptRef(*new ARKitInlinePreviewModelPlayer(page, client));
-}
-
-ARKitInlinePreviewModelPlayer::ARKitInlinePreviewModelPlayer(WebPage& page, WebCore::ModelPlayerClient& client)
-    : m_page { page }
-    , m_client { client }
-{
-}
-
-ARKitInlinePreviewModelPlayer::~ARKitInlinePreviewModelPlayer()
-{
-    clearFile();
-}
-
-static String& sharedModelElementCacheDirectory()
-{
-    static NeverDestroyed<String> sharedModelElementCacheDirectory;
-    return sharedModelElementCacheDirectory;
-}
-
-static const String& modelElementCacheDirectory()
-{
-    return sharedModelElementCacheDirectory();
-}
-
-void ARKitInlinePreviewModelPlayer::setModelElementCacheDirectory(const String& path)
-{
-    sharedModelElementCacheDirectory() = path;
-}
-
-void ARKitInlinePreviewModelPlayer::createFile(WebCore::Model& modelSource)
-{
-    // The need for a file is only temporary due to the nature of ASVInlinePreview,
-    // https://bugs.webkit.org/show_bug.cgi?id=227567.
-
-    clearFile();
-
-    auto pathToDirectory = modelElementCacheDirectory();
-    if (pathToDirectory.isEmpty())
-        return;
-
-    auto directoryExists = FileSystem::fileExists(pathToDirectory);
-    if (directoryExists && FileSystem::fileTypeFollowingSymlinks(pathToDirectory) != FileSystem::FileType::Directory) {
-        ASSERT_NOT_REACHED();
-        return;
-    }
-    if (!directoryExists && !FileSystem::makeAllDirectories(pathToDirectory)) {
-        ASSERT_NOT_REACHED();
-        return;
-    }
-
-    // We need to support .reality files as well, https://bugs.webkit.org/show_bug.cgi?id=227568.
-    auto fileName = FileSystem::encodeForFileName(createCanonicalUUIDString()) + ".usdz";
-    auto filePath = FileSystem::pathByAppendingComponent(pathToDirectory, fileName);
-    auto file = FileSystem::openFile(filePath, FileSystem::FileOpenMode::Write);
-    if (file <= 0)
-        return;
-
-    FileSystem::writeToFile(file, modelSource.data()->data(), modelSource.data()->size());
-    FileSystem::closeFile(file);
-    m_filePath = filePath;
-}
-
-void ARKitInlinePreviewModelPlayer::clearFile()
-{
-    if (m_filePath.isEmpty())
-        return;
-
-    FileSystem::deleteFile(m_filePath);
-    m_filePath = emptyString();
-}
-
-// MARK: - WebCore::ModelPlayer overrides.
-
-void ARKitInlinePreviewModelPlayer::load(WebCore::Model& modelSource, WebCore::LayoutSize size)
-{
-    auto strongClient = m_client.get();
-    if (!strongClient)
-        return;
-
-    auto* strongPage = m_page.get();
-    if (!strongPage) {
-        strongClient->didFailLoading(*this, WebCore::ResourceError { WebCore::errorDomainWebKitInternal, 0, modelSource.url(), "WebPage destroyed"_s });
-        return;
-    }
-
-    createFile(modelSource);
-
-    m_inlinePreview = adoptNS([allocASVInlinePreviewInstance() initWithFrame:CGRectMake(0, 0, size.width(), size.height())]);
-    LOG(ModelElement, "ARKitInlinePreviewModelPlayer::modelDidChange() created preview with UUID %s and size %f x %f.", ((String)[m_inlinePreview uuid].UUIDString).utf8().data(), size.width(), size.height());
-
-    CompletionHandler<void(Expected<std::pair<String, uint32_t>, WebCore::ResourceError>)> completionHandler = [weakSelf = WeakPtr { *this }] (Expected<std::pair<String, uint32_t>, WebCore::ResourceError> result) mutable {
-        auto strongSelf = weakSelf.get();
-        if (!strongSelf)
-            return;
-
-        auto strongClient = strongSelf->m_client.get();
-        if (!strongClient)
-            return;
-
-        if (!result) {
-            LOG(ModelElement, "ARKitInlinePreviewModelPlayer::inlinePreviewDidObtainContextId() received error from UIProcess");
-            strongClient->didFailLoading(*strongSelf, result.error());
-            return;
-        }
-
-        auto& [uuid, contextId] = *result;
-        String expectedUUID = [strongSelf->m_inlinePreview uuid].UUIDString;
-
-        if (uuid != expectedUUID) {
-            LOG(ModelElement, "ARKitInlinePreviewModelPlayer::inlinePreviewDidObtainContextId() UUID mismatch, received %s but expected %s.", uuid.utf8().data(), expectedUUID.utf8().data());
-            strongClient->didFailLoading(*strongSelf, WebCore::ResourceError { WebCore::errorDomainWebKitInternal, 0, { }, makeString("ARKitInlinePreviewModelPlayer::inlinePreviewDidObtainContextId() UUID mismatch, received ", uuid, " but expected ", expectedUUID, ".") });
-            return;
-        }
-
-        [strongSelf->m_inlinePreview setRemoteContext:contextId];
-        LOG(ModelElement, "ARKitInlinePreviewModelPlayer::inlinePreviewDidObtainContextId() successfully established remote connection for UUID %s.", uuid.utf8().data());
-
-        strongClient->didFinishLoading(*strongSelf);
-    };
-    
-    strongPage->sendWithAsyncReply(Messages::WebPageProxy::ModelElementDidCreatePreview(URL::fileURLWithFileSystemPath(m_filePath), [m_inlinePreview uuid].UUIDString, size), WTFMove(completionHandler));
-}
-
-PlatformLayer* ARKitInlinePreviewModelPlayer::layer()
-{
-    return [m_inlinePreview layer];
-}
-
-}
-
-#endif

Copied: trunk/Source/WebKit/WebProcess/Model/mac/ARKitInlinePreviewModelPlayerMac.h (from rev 285921, trunk/Source/WebKit/WebProcess/Model/mac/ARKitInlinePreviewModelPlayer.h) (0 => 285922)


--- trunk/Source/WebKit/WebProcess/Model/mac/ARKitInlinePreviewModelPlayerMac.h	                        (rev 0)
+++ trunk/Source/WebKit/WebProcess/Model/mac/ARKitInlinePreviewModelPlayerMac.h	2021-11-17 10:38:22 UTC (rev 285922)
@@ -0,0 +1,63 @@
+/*
+ * 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 ENABLE(ARKIT_INLINE_PREVIEW_MAC)
+
+#include "ARKitInlinePreviewModelPlayer.h"
+#include <WebCore/ModelPlayer.h>
+#include <WebCore/ModelPlayerClient.h>
+#include <wtf/Compiler.h>
+#include <wtf/RetainPtr.h>
+
+OBJC_CLASS ASVInlinePreview;
+
+namespace WebKit {
+
+class ARKitInlinePreviewModelPlayerMac final : public ARKitInlinePreviewModelPlayer {
+public:
+    static Ref<ARKitInlinePreviewModelPlayerMac> create(WebPage&, WebCore::ModelPlayerClient&);
+    virtual ~ARKitInlinePreviewModelPlayerMac();
+
+    static void setModelElementCacheDirectory(const String&);
+
+private:
+    ARKitInlinePreviewModelPlayerMac(WebPage&, WebCore::ModelPlayerClient&);
+
+    // WebCore::ModelPlayer overrides.
+    void load(WebCore::Model&, WebCore::LayoutSize) override;
+    PlatformLayer* layer() override;
+
+    void createFile(WebCore::Model&);
+    void clearFile();
+
+    String m_filePath;
+    RetainPtr<ASVInlinePreview> m_inlinePreview;
+};
+
+}
+
+#endif

Copied: trunk/Source/WebKit/WebProcess/Model/mac/ARKitInlinePreviewModelPlayerMac.mm (from rev 285921, trunk/Source/WebKit/WebProcess/Model/mac/ARKitInlinePreviewModelPlayer.mm) (0 => 285922)


--- trunk/Source/WebKit/WebProcess/Model/mac/ARKitInlinePreviewModelPlayerMac.mm	                        (rev 0)
+++ trunk/Source/WebKit/WebProcess/Model/mac/ARKitInlinePreviewModelPlayerMac.mm	2021-11-17 10:38:22 UTC (rev 285922)
@@ -0,0 +1,175 @@
+/*
+ * 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"
+#import "ARKitInlinePreviewModelPlayerMac.h"
+
+#if ENABLE(ARKIT_INLINE_PREVIEW_MAC)
+
+#import "WebPage.h"
+#import "WebPageProxyMessages.h"
+#import <WebCore/Model.h>
+#import <pal/spi/mac/SystemPreviewSPI.h>
+#import <wtf/SoftLinking.h>
+#import <wtf/UUID.h>
+
+SOFT_LINK_PRIVATE_FRAMEWORK(AssetViewer);
+SOFT_LINK_CLASS(AssetViewer, ASVInlinePreview);
+
+namespace WebKit {
+
+Ref<ARKitInlinePreviewModelPlayerMac> ARKitInlinePreviewModelPlayerMac::create(WebPage& page, WebCore::ModelPlayerClient& client)
+{
+    return adoptRef(*new ARKitInlinePreviewModelPlayerMac(page, client));
+}
+
+ARKitInlinePreviewModelPlayerMac::ARKitInlinePreviewModelPlayerMac(WebPage& page, WebCore::ModelPlayerClient& client)
+    : ARKitInlinePreviewModelPlayer(page, client)
+{
+}
+
+ARKitInlinePreviewModelPlayerMac::~ARKitInlinePreviewModelPlayerMac()
+{
+    clearFile();
+}
+
+static String& sharedModelElementCacheDirectory()
+{
+    static NeverDestroyed<String> sharedModelElementCacheDirectory;
+    return sharedModelElementCacheDirectory;
+}
+
+static const String& modelElementCacheDirectory()
+{
+    return sharedModelElementCacheDirectory();
+}
+
+void ARKitInlinePreviewModelPlayerMac::setModelElementCacheDirectory(const String& path)
+{
+    sharedModelElementCacheDirectory() = path;
+}
+
+void ARKitInlinePreviewModelPlayerMac::createFile(WebCore::Model& modelSource)
+{
+    // The need for a file is only temporary due to the nature of ASVInlinePreview,
+    // https://bugs.webkit.org/show_bug.cgi?id=227567.
+
+    clearFile();
+
+    auto pathToDirectory = modelElementCacheDirectory();
+    if (pathToDirectory.isEmpty())
+        return;
+
+    auto directoryExists = FileSystem::fileExists(pathToDirectory);
+    if (directoryExists && FileSystem::fileTypeFollowingSymlinks(pathToDirectory) != FileSystem::FileType::Directory) {
+        ASSERT_NOT_REACHED();
+        return;
+    }
+    if (!directoryExists && !FileSystem::makeAllDirectories(pathToDirectory)) {
+        ASSERT_NOT_REACHED();
+        return;
+    }
+
+    // We need to support .reality files as well, https://bugs.webkit.org/show_bug.cgi?id=227568.
+    auto fileName = FileSystem::encodeForFileName(createCanonicalUUIDString()) + ".usdz";
+    auto filePath = FileSystem::pathByAppendingComponent(pathToDirectory, fileName);
+    auto file = FileSystem::openFile(filePath, FileSystem::FileOpenMode::Write);
+    if (file <= 0)
+        return;
+
+    FileSystem::writeToFile(file, modelSource.data()->data(), modelSource.data()->size());
+    FileSystem::closeFile(file);
+    m_filePath = filePath;
+}
+
+void ARKitInlinePreviewModelPlayerMac::clearFile()
+{
+    if (m_filePath.isEmpty())
+        return;
+
+    FileSystem::deleteFile(m_filePath);
+    m_filePath = emptyString();
+}
+
+// MARK: - WebCore::ModelPlayer overrides.
+
+void ARKitInlinePreviewModelPlayerMac::load(WebCore::Model& modelSource, WebCore::LayoutSize size)
+{
+    auto strongClient = client();
+    if (!strongClient)
+        return;
+
+    auto* strongPage = page();
+    if (!strongPage) {
+        strongClient->didFailLoading(*this, WebCore::ResourceError { WebCore::errorDomainWebKitInternal, 0, modelSource.url(), "WebPage destroyed"_s });
+        return;
+    }
+
+    createFile(modelSource);
+
+    m_inlinePreview = adoptNS([allocASVInlinePreviewInstance() initWithFrame:CGRectMake(0, 0, size.width(), size.height())]);
+    LOG(ModelElement, "ARKitInlinePreviewModelPlayer::modelDidChange() created preview with UUID %s and size %f x %f.", ((String)[m_inlinePreview uuid].UUIDString).utf8().data(), size.width(), size.height());
+
+    CompletionHandler<void(Expected<std::pair<String, uint32_t>, WebCore::ResourceError>)> completionHandler = [weakSelf = WeakPtr { *this }] (Expected<std::pair<String, uint32_t>, WebCore::ResourceError> result) mutable {
+        auto strongSelf = weakSelf.get();
+        if (!strongSelf)
+            return;
+
+        auto strongClient = strongSelf->client();
+        if (!strongClient)
+            return;
+
+        if (!result) {
+            LOG(ModelElement, "ARKitInlinePreviewModelPlayer::inlinePreviewDidObtainContextId() received error from UIProcess");
+            strongClient->didFailLoading(*strongSelf, result.error());
+            return;
+        }
+
+        auto& [uuid, contextId] = *result;
+        String expectedUUID = [strongSelf->m_inlinePreview uuid].UUIDString;
+
+        if (uuid != expectedUUID) {
+            LOG(ModelElement, "ARKitInlinePreviewModelPlayer::inlinePreviewDidObtainContextId() UUID mismatch, received %s but expected %s.", uuid.utf8().data(), expectedUUID.utf8().data());
+            strongClient->didFailLoading(*strongSelf, WebCore::ResourceError { WebCore::errorDomainWebKitInternal, 0, { }, makeString("ARKitInlinePreviewModelPlayer::inlinePreviewDidObtainContextId() UUID mismatch, received ", uuid, " but expected ", expectedUUID, ".") });
+            return;
+        }
+
+        [strongSelf->m_inlinePreview setRemoteContext:contextId];
+        LOG(ModelElement, "ARKitInlinePreviewModelPlayer::inlinePreviewDidObtainContextId() successfully established remote connection for UUID %s.", uuid.utf8().data());
+
+        strongClient->didFinishLoading(*strongSelf);
+    };
+    
+    strongPage->sendWithAsyncReply(Messages::WebPageProxy::ModelElementDidCreatePreview(URL::fileURLWithFileSystemPath(m_filePath), [m_inlinePreview uuid].UUIDString, size), WTFMove(completionHandler));
+}
+
+PlatformLayer* ARKitInlinePreviewModelPlayerMac::layer()
+{
+    return [m_inlinePreview layer];
+}
+
+}
+
+#endif

Modified: trunk/Source/WebKit/WebProcess/WebProcess.cpp (285921 => 285922)


--- trunk/Source/WebKit/WebProcess/WebProcess.cpp	2021-11-17 10:29:44 UTC (rev 285921)
+++ trunk/Source/WebKit/WebProcess/WebProcess.cpp	2021-11-17 10:38:22 UTC (rev 285922)
@@ -146,7 +146,7 @@
 #include <wtf/text/StringHash.h>
 
 #if ENABLE(ARKIT_INLINE_PREVIEW_MAC)
-#include "ARKitInlinePreviewModelPlayer.h"
+#include "ARKitInlinePreviewModelPlayerMac.h"
 #endif
 
 #if !OS(WINDOWS)
@@ -605,7 +605,7 @@
 
 #if ENABLE(ARKIT_INLINE_PREVIEW_MAC)
     if (!parameters.modelElementCacheDirectory.isEmpty())
-        ARKitInlinePreviewModelPlayer::setModelElementCacheDirectory(parameters.modelElementCacheDirectory);
+        ARKitInlinePreviewModelPlayerMac::setModelElementCacheDirectory(parameters.modelElementCacheDirectory);
 #endif
 
     setResourceLoadStatisticsEnabled(parameters.resourceLoadStatisticsEnabled);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to