Changeset 286019 in webkit
- Timestamp:
- Nov 18, 2021 11:38:01 AM (8 months ago)
- Location:
- trunk/Source
- Files:
-
- 41 edited
- 3 copied
-
WTF/ChangeLog (modified) (1 diff)
-
WTF/wtf/PlatformEnableCocoa.h (modified) (1 diff)
-
WebCore/CMakeLists.txt (modified) (1 diff)
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/DerivedSources-input.xcfilelist (modified) (1 diff)
-
WebCore/DerivedSources-output.xcfilelist (modified) (1 diff)
-
WebCore/DerivedSources.make (modified) (1 diff)
-
WebCore/Headers.cmake (modified) (1 diff)
-
WebCore/Modules/model-element/HTMLModelElement.cpp (modified) (2 diffs)
-
WebCore/Modules/model-element/HTMLModelElement.h (modified) (3 diffs)
-
WebCore/Modules/model-element/HTMLModelElement.idl (modified) (1 diff)
-
WebCore/Modules/model-element/HTMLModelElementCamera.h (copied) (copied from trunk/Source/WebCore/Modules/model-element/HTMLModelElement.idl) (2 diffs)
-
WebCore/Modules/model-element/HTMLModelElementCamera.idl (copied) (copied from trunk/Source/WebCore/Modules/model-element/HTMLModelElement.idl) (2 diffs)
-
WebCore/Modules/model-element/ModelPlayer.h (modified) (2 diffs)
-
WebCore/Modules/model-element/dummy/DummyModelPlayer.cpp (modified) (1 diff)
-
WebCore/Modules/model-element/dummy/DummyModelPlayer.h (modified) (1 diff)
-
WebCore/Modules/model-element/scenekit/SceneKitModelPlayer.h (modified) (1 diff)
-
WebCore/Modules/model-element/scenekit/SceneKitModelPlayer.mm (modified) (1 diff)
-
WebCore/PAL/ChangeLog (modified) (1 diff)
-
WebCore/PAL/pal/spi/ios/SystemPreviewSPI.h (modified) (3 diffs)
-
WebCore/PAL/pal/spi/mac/SystemPreviewSPI.h (modified) (2 diffs)
-
WebCore/Sources.txt (modified) (1 diff)
-
WebCore/WebCore.xcodeproj/project.pbxproj (modified) (5 diffs)
-
WebCore/loader/EmptyClients.cpp (modified) (1 diff)
-
WebCore/loader/EmptyClients.h (modified) (1 diff)
-
WebCore/page/ChromeClient.h (modified) (1 diff)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/Shared/ModelIdentifier.h (copied) (copied from trunk/Source/WebCore/Modules/model-element/scenekit/SceneKitModelPlayer.h) (1 diff)
-
WebKit/UIProcess/Cocoa/ModelElementControllerCocoa.mm (modified) (9 diffs)
-
WebKit/UIProcess/ModelElementController.h (modified) (4 diffs)
-
WebKit/UIProcess/WebPageProxy.cpp (modified) (1 diff)
-
WebKit/UIProcess/WebPageProxy.h (modified) (2 diffs)
-
WebKit/UIProcess/WebPageProxy.messages.in (modified) (2 diffs)
-
WebKit/WebKit.xcodeproj/project.pbxproj (modified) (2 diffs)
-
WebKit/WebProcess/Model/ARKitInlinePreviewModelPlayer.h (modified) (3 diffs)
-
WebKit/WebProcess/Model/ARKitInlinePreviewModelPlayer.mm (modified) (1 diff)
-
WebKit/WebProcess/Model/ios/ARKitInlinePreviewModelPlayerIOS.h (modified) (1 diff)
-
WebKit/WebProcess/Model/ios/ARKitInlinePreviewModelPlayerIOS.mm (modified) (1 diff)
-
WebKit/WebProcess/Model/mac/ARKitInlinePreviewModelPlayerMac.h (modified) (1 diff)
-
WebKit/WebProcess/Model/mac/ARKitInlinePreviewModelPlayerMac.mm (modified) (1 diff)
-
WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp (modified) (1 diff)
-
WebKit/WebProcess/WebCoreSupport/WebChromeClient.h (modified) (1 diff)
-
WebKit/WebProcess/WebPage/WebPage.cpp (modified) (1 diff)
-
WebKit/WebProcess/WebPage/WebPage.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r285967 r286019 1 2021-11-18 Antoine Quint <graouts@webkit.org> 2 3 [Model] add support for getting and setting the camera 4 https://bugs.webkit.org/show_bug.cgi?id=233265 5 <rdar://problem/85426290> 6 7 Reviewed by Darin Adler. 8 9 Add a new compile-time flag for the new ARQL SPIs we are using. 10 11 * wtf/PlatformEnableCocoa.h: 12 1 13 2021-11-17 John Wilander <wilander@apple.com> 2 14 -
trunk/Source/WTF/wtf/PlatformEnableCocoa.h
r285521 r286019 744 744 #define ENABLE_ARKIT_INLINE_PREVIEW 1 745 745 #endif 746 747 #if (ENABLE(ARKIT_INLINE_PREVIEW_MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 120400) || (ENABLE(ARKIT_INLINE_PREVIEW_IOS) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 150400) 748 #define ENABLE_ARKIT_INLINE_PREVIEW_CAMERA_TRANSFORM 1 749 #endif -
trunk/Source/WebCore/CMakeLists.txt
r285734 r286019 464 464 465 465 Modules/model-element/HTMLModelElement.idl 466 Modules/model-element/HTMLModelElementCamera.idl 466 467 467 468 Modules/notifications/Notification.idl -
trunk/Source/WebCore/ChangeLog
r286018 r286019 1 2021-11-18 Antoine Quint <graouts@webkit.org> 2 3 [Model] add support for getting and setting the camera 4 https://bugs.webkit.org/show_bug.cgi?id=233265 5 <rdar://problem/85426290> 6 7 Reviewed by Darin Adler. 8 9 We add two new promise-based methods to the HTMLModelElement IDL to access and set the camera: 10 getCamera() and setCamera(). The camera is represented by a new HTMLModelElementCamera dictionary 11 which has yaw, pitch and scale members. 12 13 * CMakeLists.txt: 14 * Headers.cmake: 15 * DerivedSources-input.xcfilelist: 16 * DerivedSources-output.xcfilelist: 17 * DerivedSources.make: 18 * Modules/model-element/HTMLModelElement.cpp: 19 (WebCore::HTMLModelElement::getCamera): 20 (WebCore::HTMLModelElement::setCamera): 21 * Modules/model-element/HTMLModelElement.h: 22 * Modules/model-element/HTMLModelElement.idl: 23 * Modules/model-element/HTMLModelElementCamera.h: Copied from Source/WebCore/Modules/model-element/HTMLModelElement.idl. 24 (WebCore::HTMLModelElementCamera::encode const): 25 (WebCore::HTMLModelElementCamera::decode): 26 * Modules/model-element/HTMLModelElementCamera.idl: Copied from Source/WebCore/Modules/model-element/HTMLModelElement.idl. 27 * Modules/model-element/ModelPlayer.h: 28 * Modules/model-element/dummy/DummyModelPlayer.cpp: 29 (WebCore::DummyModelPlayer::getCamera): 30 (WebCore::DummyModelPlayer::setCamera): 31 * Modules/model-element/dummy/DummyModelPlayer.h: 32 * Modules/model-element/scenekit/SceneKitModelPlayer.h: 33 * Modules/model-element/scenekit/SceneKitModelPlayer.mm: 34 (WebCore::SceneKitModelPlayer::getCamera): 35 (WebCore::SceneKitModelPlayer::setCamera): 36 * Sources.txt: 37 * WebCore.xcodeproj/project.pbxproj: 38 * loader/EmptyClients.cpp: 39 (WebCore::EmptyChromeClient::takeModelElementFullscreen const): Deleted. 40 * loader/EmptyClients.h: 41 * page/ChromeClient.h: 42 (WebCore::ChromeClient::takeModelElementFullscreen const): Deleted. 43 1 44 2021-11-18 David Kilzer <ddkilzer@apple.com> 2 45 -
trunk/Source/WebCore/DerivedSources-input.xcfilelist
r286018 r286019 442 442 $(PROJECT_DIR)/Modules/mediastream/RTCTransformEvent.idl 443 443 $(PROJECT_DIR)/Modules/model-element/HTMLModelElement.idl 444 $(PROJECT_DIR)/Modules/model-element/HTMLModelElementCamera.idl 444 445 $(PROJECT_DIR)/Modules/modern-media-controls/controls/activity-indicator.css 445 446 $(PROJECT_DIR)/Modules/modern-media-controls/controls/airplay-button.css -
trunk/Source/WebCore/DerivedSources-output.xcfilelist
r285564 r286019 1284 1284 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSHTMLModelElement.cpp 1285 1285 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSHTMLModelElement.h 1286 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSHTMLModelElementCamera.cpp 1287 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSHTMLModelElementCamera.h 1286 1288 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSHTMLOListElement.cpp 1287 1289 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSHTMLOListElement.h -
trunk/Source/WebCore/DerivedSources.make
r286018 r286019 458 458 $(WebCore)/Modules/mediastream/RTCTransformEvent.idl \ 459 459 $(WebCore)/Modules/model-element/HTMLModelElement.idl \ 460 $(WebCore)/Modules/model-element/HTMLModelElementCamera.idl \ 460 461 $(WebCore)/Modules/notifications/Notification.idl \ 461 462 $(WebCore)/Modules/notifications/NotificationPermission.idl \ -
trunk/Source/WebCore/Headers.cmake
r286012 r286019 138 138 139 139 Modules/model-element/HTMLModelElement.h 140 Modules/model-element/HTMLModelElementCamera.h 140 141 Modules/model-element/ModelPlayer.h 141 142 Modules/model-element/ModelPlayerClient.h -
trunk/Source/WebCore/Modules/model-element/HTMLModelElement.cpp
r285986 r286019 38 38 #include "GraphicsLayer.h" 39 39 #include "GraphicsLayerCA.h" 40 #include "HTMLModelElementCamera.h" 40 41 #include "HTMLNames.h" 41 42 #include "HTMLParserIdioms.h" 42 43 #include "HTMLSourceElement.h" 44 #include "JSDOMPromiseDeferred.h" 43 45 #include "JSEventTarget.h" 44 46 #include "JSHTMLModelElement.h" 47 #include "JSHTMLModelElementCamera.h" 45 48 #include "Model.h" 46 49 #include "ModelPlayer.h" … … 361 364 } 362 365 366 // MARK: – Camera support. 367 368 void HTMLModelElement::getCamera(CameraPromise&& promise) 369 { 370 if (!m_modelPlayer) { 371 promise.reject(); 372 return; 373 } 374 375 m_modelPlayer->getCamera([promise = WTFMove(promise)] (std::optional<HTMLModelElementCamera> camera) mutable { 376 if (!camera) 377 promise.reject(); 378 else 379 promise.resolve(*camera); 380 }); 381 } 382 383 void HTMLModelElement::setCamera(HTMLModelElementCamera camera, DOMPromiseDeferred<void>&& promise) 384 { 385 if (!m_modelPlayer) { 386 promise.reject(); 387 return; 388 } 389 390 m_modelPlayer->setCamera(camera, [promise = WTFMove(promise)] (bool success) mutable { 391 if (success) 392 promise.resolve(); 393 else 394 promise.reject(); 395 }); 396 } 397 363 398 } 364 399 -
trunk/Source/WebCore/Modules/model-element/HTMLModelElement.h
r285986 r286019 33 33 #include "GraphicsLayer.h" 34 34 #include "HTMLElement.h" 35 #include "HTMLModelElementCamera.h" 35 36 #include "IDLTypes.h" 36 37 #include "ModelPlayerClient.h" … … 46 47 class MouseEvent; 47 48 49 template<typename IDLType> class DOMPromiseDeferred; 48 50 template<typename IDLType> class DOMPromiseProxyWithResolveCallback; 49 51 … … 69 71 70 72 void enterFullscreen(); 73 74 using CameraPromise = DOMPromiseDeferred<IDLDictionary<HTMLModelElementCamera>>; 75 void getCamera(CameraPromise&&); 76 void setCamera(HTMLModelElementCamera, DOMPromiseDeferred<void>&&); 71 77 72 78 bool isDraggableIgnoringAttributes() const final { return true; } -
trunk/Source/WebCore/Modules/model-element/HTMLModelElement.idl
r283463 r286019 34 34 35 35 undefined enterFullscreen(); 36 37 Promise<HTMLModelElementCamera> getCamera(); 38 Promise<undefined> setCamera(HTMLModelElementCamera camera); 36 39 }; -
trunk/Source/WebCore/Modules/model-element/HTMLModelElementCamera.h
r286018 r286019 1 1 /* 2 * Copyright (C) 202 0Apple Inc. All rights reserved.2 * Copyright (C) 2021 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 [ 27 Conditional=MODEL_ELEMENT, 28 EnabledBySetting=ModelElementEnabled, 29 Exposed=Window, 30 ] interface HTMLModelElement : HTMLElement { 31 [URL] readonly attribute USVString currentSrc; 26 #pragma once 32 27 33 readonly attribute Promise<HTMLModelElement> ready; 28 #include <optional> 34 29 35 undefined enterFullscreen(); 30 namespace WebCore { 31 32 struct HTMLModelElementCamera { 33 double pitch { 0 }; 34 double yaw { 0 }; 35 double scale { 1 }; 36 37 template<class Encoder> void encode(Encoder&) const; 38 template<class Decoder> static std::optional<HTMLModelElementCamera> decode(Decoder&); 36 39 }; 40 41 template<class Encoder> void HTMLModelElementCamera::encode(Encoder& encoder) const 42 { 43 encoder << pitch; 44 encoder << yaw; 45 encoder << scale; 46 } 47 48 template<class Decoder> std::optional<HTMLModelElementCamera> HTMLModelElementCamera::decode(Decoder& decoder) 49 { 50 std::optional<double> pitch; 51 decoder >> pitch; 52 if (!pitch) 53 return std::nullopt; 54 55 std::optional<double> yaw; 56 decoder >> yaw; 57 if (!yaw) 58 return std::nullopt; 59 60 std::optional<double> scale; 61 decoder >> scale; 62 if (!scale) 63 return std::nullopt; 64 65 return { { *pitch, *yaw, *scale } }; 66 } 67 68 } // namespace WebCore 69 -
trunk/Source/WebCore/Modules/model-element/HTMLModelElementCamera.idl
r286018 r286019 1 1 /* 2 * Copyright (C) 202 0Apple Inc. All rights reserved.2 * Copyright (C) 2021 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 27 27 Conditional=MODEL_ELEMENT, 28 28 EnabledBySetting=ModelElementEnabled, 29 Exposed=Window, 30 ] interface HTMLModelElement : HTMLElement { 31 [URL] readonly attribute USVString currentSrc; 32 33 readonly attribute Promise<HTMLModelElement> ready; 34 35 undefined enterFullscreen(); 29 JSGenerateToJSObject 30 ] dictionary HTMLModelElementCamera { 31 double pitch; 32 double yaw; 33 double scale; 36 34 }; -
trunk/Source/WebCore/Modules/model-element/ModelPlayer.h
r285986 r286019 26 26 #pragma once 27 27 28 #include "HTMLModelElementCamera.h" 28 29 #include "LayoutPoint.h" 29 30 #include "LayoutSize.h" 30 31 #include "PlatformLayer.h" 32 #include <optional> 31 33 #include <wtf/Forward.h> 32 34 #include <wtf/MonotonicTime.h> … … 48 50 virtual void handleMouseMove(const LayoutPoint&, MonotonicTime) = 0; 49 51 virtual void handleMouseUp(const LayoutPoint&, MonotonicTime) = 0; 50 52 virtual void getCamera(CompletionHandler<void(std::optional<HTMLModelElementCamera>&&)>&&) = 0; 53 virtual void setCamera(HTMLModelElementCamera, CompletionHandler<void(bool&&)>&&) = 0; 51 54 }; 52 55 -
trunk/Source/WebCore/Modules/model-element/dummy/DummyModelPlayer.cpp
r285986 r286019 71 71 } 72 72 73 void DummyModelPlayer::getCamera(CompletionHandler<void(std::optional<WebCore::HTMLModelElementCamera>&&)>&&) 74 { 73 75 } 76 77 void DummyModelPlayer::setCamera(WebCore::HTMLModelElementCamera, CompletionHandler<void(bool&&)>&&) 78 { 79 } 80 81 } -
trunk/Source/WebCore/Modules/model-element/dummy/DummyModelPlayer.h
r285986 r286019 48 48 void handleMouseMove(const LayoutPoint&, MonotonicTime) override; 49 49 void handleMouseUp(const LayoutPoint&, MonotonicTime) override; 50 void getCamera(CompletionHandler<void(std::optional<WebCore::HTMLModelElementCamera>&&)>&&) override; 51 void setCamera(WebCore::HTMLModelElementCamera, CompletionHandler<void(bool&&)>&&) override; 50 52 51 53 WeakPtr<ModelPlayerClient> m_client; -
trunk/Source/WebCore/Modules/model-element/scenekit/SceneKitModelPlayer.h
r285986 r286019 62 62 void handleMouseMove(const LayoutPoint&, MonotonicTime) override; 63 63 void handleMouseUp(const LayoutPoint&, MonotonicTime) override; 64 void getCamera(CompletionHandler<void(std::optional<HTMLModelElementCamera>&&)>&&) override; 65 void setCamera(HTMLModelElementCamera, CompletionHandler<void(bool&&)>&&) override; 64 66 65 67 // SceneKitModelLoaderClient overrides. -
trunk/Source/WebCore/Modules/model-element/scenekit/SceneKitModelPlayer.mm
r285986 r286019 89 89 } 90 90 91 void SceneKitModelPlayer::getCamera(CompletionHandler<void(std::optional<HTMLModelElementCamera>&&)>&&) 92 { 93 } 94 95 void SceneKitModelPlayer::setCamera(HTMLModelElementCamera, CompletionHandler<void(bool&&)>&&) 96 { 97 } 98 91 99 // MARK: - SceneKitModelLoaderClient overrides. 92 100 -
trunk/Source/WebCore/PAL/ChangeLog
r285986 r286019 1 2021-11-18 Antoine Quint <graouts@webkit.org> 2 3 [Model] add support for getting and setting the camera 4 https://bugs.webkit.org/show_bug.cgi?id=233265 5 <rdar://problem/85426290> 6 7 Reviewed by Darin Adler. 8 9 Add the new ARQL SPIs we are using. 10 11 * pal/spi/ios/SystemPreviewSPI.h: 12 * pal/spi/mac/SystemPreviewSPI.h: 13 1 14 2021-11-18 Antoine Quint <graouts@webkit.org> 2 15 -
trunk/Source/WebCore/PAL/pal/spi/ios/SystemPreviewSPI.h
r285319 r286019 59 59 @property (nonatomic) CGSize maxThumbnailSize; 60 60 @end 61 #endif62 61 63 62 NS_ASSUME_NONNULL_END 63 64 #endif 64 65 65 66 #if HAVE(ARKIT_QUICK_LOOK_PREVIEW_ITEM) … … 78 79 @end 79 80 81 NS_ASSUME_NONNULL_END 82 80 83 #endif 81 84 82 85 #if ENABLE(ARKIT_INLINE_PREVIEW_IOS) 86 87 #import <simd/simd.h> 88 89 NS_ASSUME_NONNULL_BEGIN 83 90 84 91 @class ASVInlinePreview; … … 98 105 - (void)touchesCancelled:(NSSet<UITouch *> *)touches withEvent:(nullable UIEvent *)event; 99 106 107 typedef void (^ASVCameraTransformReplyBlock) (simd_float3 cameraTransform, NSError * _Nullable error); 108 - (void)getCameraTransform:(ASVCameraTransformReplyBlock)reply; 109 - (void)setCameraTransform:(simd_float3)transform; 110 100 111 @end 101 102 #endif103 112 104 113 NS_ASSUME_NONNULL_END 105 114 106 115 #endif 116 117 #endif -
trunk/Source/WebCore/PAL/pal/spi/mac/SystemPreviewSPI.h
r285986 r286019 32 32 #else // USE(APPLE_INTERNAL_SDK) 33 33 34 #if ENABLE(ARKIT_INLINE_PREVIEW_MAC) 35 36 #import <simd/simd.h> 37 34 38 NS_ASSUME_NONNULL_BEGIN 35 36 #if ENABLE(ARKIT_INLINE_PREVIEW_MAC)37 39 38 40 @class ASVInlinePreview; … … 53 55 - (void)mouseUpAtLocation:(CGPoint)location timestamp:(NSTimeInterval)timestamp; 54 56 57 typedef void (^ASVCameraTransformReplyBlock) (simd_float3 cameraTransform, NSError * _Nullable error); 58 - (void)getCameraTransform:(ASVCameraTransformReplyBlock)reply; 59 - (void)setCameraTransform:(simd_float3)transform; 60 55 61 @end 62 63 NS_ASSUME_NONNULL_END 56 64 57 65 #endif // ENABLE(ARKIT_INLINE_PREVIEW_MAC) 58 66 59 NS_ASSUME_NONNULL_END60 61 67 #endif // USE(APPLE_INTERNAL_SDK) -
trunk/Source/WebCore/Sources.txt
r286012 r286019 3302 3302 JSHTMLModElement.cpp 3303 3303 JSHTMLModelElement.cpp 3304 JSHTMLModelElementCamera.cpp 3304 3305 JSHTMLOListElement.cpp 3305 3306 JSHTMLObjectElement.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r286018 r286019 2275 2275 71729F7B20F3BA4900801CE6 /* DocumentTimelineOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 71729F7A20F3BA3A00801CE6 /* DocumentTimelineOptions.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2276 2276 71729F7E20F3BB4700801CE6 /* JSDocumentTimelineOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 71729F7C20F3BAB900801CE6 /* JSDocumentTimelineOptions.h */; }; 2277 7177AD57274295D1002F103B /* HTMLModelElementCamera.h in Headers */ = {isa = PBXBuildFile; fileRef = 7177AD5627429590002F103B /* HTMLModelElementCamera.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2277 2278 7181A16C244F0F40007D8A24 /* DocumentTimelinesController.h in Headers */ = {isa = PBXBuildFile; fileRef = 7181A169244F0F2C007D8A24 /* DocumentTimelinesController.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2278 2279 71A1B6081DEE5AD70073BCFB /* modern-media-controls-localized-strings.js in Resources */ = {isa = PBXBuildFile; fileRef = 71A1B6061DEE5A820073BCFB /* modern-media-controls-localized-strings.js */; }; … … 10776 10777 71729F7D20F3BABA00801CE6 /* JSDocumentTimelineOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDocumentTimelineOptions.cpp; sourceTree = "<group>"; }; 10777 10778 7173DEBD2614DF040097DF32 /* Styleable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Styleable.cpp; sourceTree = "<group>"; }; 10779 7177AD542742952F002F103B /* HTMLModelElementCamera.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLModelElementCamera.idl; sourceTree = "<group>"; }; 10780 7177AD5627429590002F103B /* HTMLModelElementCamera.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLModelElementCamera.h; sourceTree = "<group>"; }; 10781 7177AD5827429CCA002F103B /* JSHTMLModelElementCamera.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLModelElementCamera.cpp; sourceTree = "<group>"; }; 10782 7177AD5927429CCB002F103B /* JSHTMLModelElementCamera.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLModelElementCamera.h; sourceTree = "<group>"; }; 10778 10783 7177E2461DB80D2F00919A0B /* media-controller-support.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = "media-controller-support.js"; sourceTree = "<group>"; }; 10779 10784 7177E2471DB80D2F00919A0B /* mute-support.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = "mute-support.js"; sourceTree = "<group>"; }; … … 23808 23813 71A3D17D2562B8240064E2A6 /* HTMLModelElement.h */, 23809 23814 71A3D17F2562B8240064E2A6 /* HTMLModelElement.idl */, 23815 7177AD5627429590002F103B /* HTMLModelElementCamera.h */, 23816 7177AD542742952F002F103B /* HTMLModelElementCamera.idl */, 23810 23817 BC2B41142732F06200A2D191 /* ModelPlayer.cpp */, 23811 23818 BC2B41132732F06200A2D191 /* ModelPlayer.h */, … … 26086 26093 71A3D1822562BDDB0064E2A6 /* JSHTMLModelElement.cpp */, 26087 26094 71A3D1832562BDDB0064E2A6 /* JSHTMLModelElement.h */, 26095 7177AD5827429CCA002F103B /* JSHTMLModelElementCamera.cpp */, 26096 7177AD5927429CCB002F103B /* JSHTMLModelElementCamera.h */, 26088 26097 1AE2AB1F0A1CE63B00B42B25 /* JSHTMLModElement.cpp */, 26089 26098 1AE2AB200A1CE63B00B42B25 /* JSHTMLModElement.h */, … … 33719 33728 A454424B119B3661009BE912 /* HTMLMeterElement.h in Headers */, 33720 33729 71A3D1812562B85B0064E2A6 /* HTMLModelElement.h in Headers */, 33730 7177AD57274295D1002F103B /* HTMLModelElementCamera.h in Headers */, 33721 33731 A8CFF7A70A156978000A4234 /* HTMLModElement.h in Headers */, 33722 33732 A8DF3FD4097FA0FC0052981B /* HTMLNameCollection.h in Headers */, -
trunk/Source/WebCore/loader/EmptyClients.cpp
r285637 r286019 584 584 } 585 585 586 #if ENABLE(ARKIT_INLINE_PREVIEW_IOS)587 void EmptyChromeClient::takeModelElementFullscreen(WebCore::GraphicsLayer::PlatformLayerID) const588 {589 }590 #endif591 592 586 void EmptyFrameLoaderClient::dispatchDecidePolicyForNewWindowAction(const NavigationAction&, const ResourceRequest&, FormState*, const String&, PolicyCheckIdentifier, FramePolicyFunction&&) 593 587 { -
trunk/Source/WebCore/loader/EmptyClients.h
r285637 r286019 218 218 bool shouldNotifyOnFormChanges() final { return false; } 219 219 220 #if ENABLE(ARKIT_INLINE_PREVIEW_IOS)221 void takeModelElementFullscreen(WebCore::GraphicsLayer::PlatformLayerID) const final;222 #endif223 224 220 RefPtr<Icon> createIconForFiles(const Vector<String>& /* filenames */) final { return nullptr; } 225 221 }; -
trunk/Source/WebCore/page/ChromeClient.h
r285973 r286019 606 606 #endif 607 607 608 #if ENABLE(ARKIT_INLINE_PREVIEW_IOS)609 virtual void takeModelElementFullscreen(WebCore::GraphicsLayer::PlatformLayerID) const { }610 #endif611 612 608 #if ENABLE(APPLE_PAY_AMS_UI) 613 609 virtual void startApplePayAMSUISession(const URL&, const ApplePayAMSUIRequest&, CompletionHandler<void(std::optional<bool>&&)>&& completionHandler) { completionHandler(std::nullopt); } -
trunk/Source/WebKit/ChangeLog
r286012 r286019 1 2021-11-18 Antoine Quint <graouts@webkit.org> 2 3 [Model] add support for getting and setting the camera 4 https://bugs.webkit.org/show_bug.cgi?id=233265 5 <rdar://problem/85426290> 6 7 Reviewed by Darin Adler. 8 9 The ARQL APIs we'd adopted so far were specific to either macOS or iOS. The new camera 10 methods are different since they exist on both platforms. 11 12 In order to expose a single message for both platforms, we introduce a new ModelIdentifier 13 struct which wraps the UUID string for macOS and the layer identifier for iOS. Then on 14 ModelElementController, we have the previewForModelIdentifier() method to get the matching 15 ASVInlinePreview for the provided ModelIdentifier. 16 17 This allows getCameraForModelElement() and setCameraForModelElement to be specified for both 18 iOS and macOS with a single implementation. 19 20 We also modify takeModelElementFullscreen() to take advantage of ModelIdentifier which showed 21 that we had some lingering code in ChromeClient related to this method that was no longer 22 necessary following r285922. 23 24 * Shared/ModelIdentifier.h: Copied from Source/WebCore/Modules/model-element/scenekit/SceneKitModelPlayer.h. 25 (WebKit::ModelIdentifier::encode const): 26 (WebKit::ModelIdentifier::decode): 27 * UIProcess/Cocoa/ModelElementControllerCocoa.mm: 28 (WebKit::ModelElementController::modelViewForModelIdentifier): 29 (WebKit::ModelElementController::previewForModelIdentifier): 30 (WebKit::ModelElementController::takeModelElementFullscreen): 31 (WebKit::previewHasCameraSupport): 32 (WebKit::ModelElementController::getCameraForModelElement): 33 (WebKit::ModelElementController::setCameraForModelElement): 34 * UIProcess/ModelElementController.h: 35 * UIProcess/WebPageProxy.cpp: 36 (WebKit::WebPageProxy::modelElementGetCamera): 37 (WebKit::WebPageProxy::modelElementSetCamera): 38 (WebKit::WebPageProxy::takeModelElementFullscreen): 39 * UIProcess/WebPageProxy.h: 40 * UIProcess/WebPageProxy.messages.in: 41 * WebKit.xcodeproj/project.pbxproj: 42 * WebProcess/Model/ARKitInlinePreviewModelPlayer.h: 43 * WebProcess/Model/ARKitInlinePreviewModelPlayer.mm: 44 (WebKit::ARKitInlinePreviewModelPlayer::getCamera): 45 (WebKit::ARKitInlinePreviewModelPlayer::setCamera): 46 * WebProcess/Model/ios/ARKitInlinePreviewModelPlayerIOS.h: 47 * WebProcess/Model/ios/ARKitInlinePreviewModelPlayerIOS.mm: 48 (WebKit::ARKitInlinePreviewModelPlayerIOS::modelIdentifier): 49 (WebKit::ARKitInlinePreviewModelPlayerIOS::enterFullscreen): 50 * WebProcess/Model/mac/ARKitInlinePreviewModelPlayerMac.h: 51 * WebProcess/Model/mac/ARKitInlinePreviewModelPlayerMac.mm: 52 (WebKit::ARKitInlinePreviewModelPlayerMac::modelIdentifier): 53 * WebProcess/WebCoreSupport/WebChromeClient.cpp: 54 (WebKit::WebChromeClient::takeModelElementFullscreen const): Deleted. 55 * WebProcess/WebCoreSupport/WebChromeClient.h: 56 * WebProcess/WebPage/WebPage.cpp: 57 (WebKit::WebPage::takeModelElementFullscreen): Deleted. 58 * WebProcess/WebPage/WebPage.h: 59 1 60 2021-11-18 Chris Dumez <cdumez@apple.com> 2 61 -
trunk/Source/WebKit/Shared/ModelIdentifier.h
r286018 r286019 26 26 #pragma once 27 27 28 #if HAVE(SCENEKIT) 28 namespace WebKit { 29 29 30 #include "Model.h" 31 #include "ModelPlayer.h" 32 #include "ModelPlayerClient.h" 33 #include "SceneKitModelLoaderClient.h" 34 #include <wtf/RetainPtr.h> 35 #include <wtf/URL.h> 36 #include <wtf/WeakPtr.h> 37 #include <wtf/Forward.h> 30 #if ENABLE(ARKIT_INLINE_PREVIEW) 38 31 39 OBJC_CLASS SCNMetalLayer; 32 #if ENABLE(ARKIT_INLINE_PREVIEW_IOS) 33 #import <WebCore/GraphicsLayer.h> 34 #endif 40 35 41 namespace WebCore { 36 struct ModelIdentifier { 37 #if ENABLE(ARKIT_INLINE_PREVIEW_MAC) 38 String uuid; 39 #elif ENABLE(ARKIT_INLINE_PREVIEW_IOS) 40 WebCore::GraphicsLayer::PlatformLayerID layerIdentifier; 41 #endif 42 42 43 class ModelPlayerClient; 44 class SceneKitModel; 45 class SceneKitModelLoader; 46 47 class WEBCORE_EXPORT SceneKitModelPlayer final : public ModelPlayer, public SceneKitModelLoaderClient { 48 public: 49 static Ref<SceneKitModelPlayer> create(ModelPlayerClient&); 50 virtual ~SceneKitModelPlayer(); 51 52 private: 53 SceneKitModelPlayer(ModelPlayerClient&); 54 55 void updateScene(); 56 57 // ModelPlayer overrides. 58 void load(Model&, LayoutSize) override; 59 CALayer *layer() override; 60 void enterFullscreen() override; 61 void handleMouseDown(const LayoutPoint&, MonotonicTime) override; 62 void handleMouseMove(const LayoutPoint&, MonotonicTime) override; 63 void handleMouseUp(const LayoutPoint&, MonotonicTime) override; 64 65 // SceneKitModelLoaderClient overrides. 66 virtual void didFinishLoading(SceneKitModelLoader&, Ref<SceneKitModel>) override; 67 virtual void didFailLoading(SceneKitModelLoader&, const ResourceError&) override; 68 69 WeakPtr<ModelPlayerClient> m_client; 70 71 RefPtr<SceneKitModelLoader> m_loader; 72 RefPtr<SceneKitModel> m_model; 73 74 RetainPtr<SCNMetalLayer> m_layer; 43 template<class Encoder> void encode(Encoder&) const; 44 template<class Decoder> static std::optional<ModelIdentifier> decode(Decoder&); 75 45 }; 76 46 47 template<class Encoder> void ModelIdentifier::encode(Encoder& encoder) const 48 { 49 #if ENABLE(ARKIT_INLINE_PREVIEW_MAC) 50 encoder << uuid; 51 #elif ENABLE(ARKIT_INLINE_PREVIEW_IOS) 52 encoder << layerIdentifier; 53 #endif 54 } 55 56 template<class Decoder> std::optional<ModelIdentifier> ModelIdentifier::decode(Decoder& decoder) 57 { 58 #if ENABLE(ARKIT_INLINE_PREVIEW_MAC) 59 std::optional<String> uuid; 60 decoder >> uuid; 61 if (!uuid) 62 return std::nullopt; 63 return { { WTFMove(*uuid) } }; 64 #elif ENABLE(ARKIT_INLINE_PREVIEW_IOS) 65 std::optional<WebCore::GraphicsLayer::PlatformLayerID> layerIdentifier; 66 decoder >> layerIdentifier; 67 if (!layerIdentifier) 68 return std::nullopt; 69 return { { *layerIdentifier } }; 70 #endif 77 71 } 78 72 79 73 #endif 74 75 } // namespace WebKit 76 -
trunk/Source/WebKit/UIProcess/Cocoa/ModelElementControllerCocoa.mm
r285986 r286019 31 31 #import "Logging.h" 32 32 #import "WebPageProxy.h" 33 #import <WebCore/LayoutPoint.h> 34 #import <WebCore/LayoutUnit.h> 35 #import <WebCore/ResourceError.h> 36 #import <simd/simd.h> 37 #import <wtf/MainThread.h> 38 #import <wtf/MonotonicTime.h> 33 39 34 40 #if ENABLE(ARKIT_INLINE_PREVIEW_IOS) … … 43 49 44 50 #if ENABLE(ARKIT_INLINE_PREVIEW_MAC) 45 #import <WebCore/LayoutPoint.h>46 #import <WebCore/LayoutUnit.h>47 #import <WebCore/ResourceError.h>48 51 #import <pal/spi/mac/SystemPreviewSPI.h> 49 #import <wtf/MainThread.h>50 #import <wtf/MonotonicTime.h>51 52 #endif 52 53 … … 58 59 #if ENABLE(ARKIT_INLINE_PREVIEW_IOS) 59 60 60 void ModelElementController::takeModelElementFullscreen(WebCore::GraphicsLayer::PlatformLayerID contentLayerId)61 WKModelView * ModelElementController::modelViewForModelIdentifier(ModelIdentifier modelIdentifier) 61 62 { 62 63 if (!m_webPageProxy.preferences().modelElementEnabled()) 63 return ;64 return nil; 64 65 65 66 if (!is<RemoteLayerTreeDrawingAreaProxy>(m_webPageProxy.drawingArea())) 66 return ;67 68 auto* node = downcast<RemoteLayerTreeDrawingAreaProxy>(*m_webPageProxy.drawingArea()).remoteLayerTreeHost().nodeForID( contentLayerId);67 return nil; 68 69 auto* node = downcast<RemoteLayerTreeDrawingAreaProxy>(*m_webPageProxy.drawingArea()).remoteLayerTreeHost().nodeForID(modelIdentifier.layerIdentifier); 69 70 if (!node) 70 return; 71 72 auto *view = node->uiView(); 73 if (!view) 74 return; 75 76 if (![view isKindOfClass:[WKModelView class]]) 77 return; 78 71 return nil; 72 73 return dynamic_objc_cast<WKModelView>(node->uiView()); 74 } 75 76 ASVInlinePreview * ModelElementController::previewForModelIdentifier(ModelIdentifier modelIdentifier) 77 { 78 return [modelViewForModelIdentifier(modelIdentifier) preview]; 79 } 80 81 void ModelElementController::takeModelElementFullscreen(ModelIdentifier modelIdentifier) 82 { 79 83 auto *presentingViewController = m_webPageProxy.uiClient().presentingViewController(); 80 84 if (!presentingViewController) 81 85 return; 82 86 83 WKModelView *modelView = (WKModelView *)view; 87 auto modelView = modelViewForModelIdentifier(modelIdentifier); 88 if (!modelView) 89 return; 90 84 91 CGRect initialFrame = [modelView convertRect:modelView.frame toView:nil]; 85 92 … … 99 106 [presentingViewController presentViewController:remoteViewController animated:NO completion:^(void) { 100 107 [CATransaction begin]; 101 [ view.layer.superlayer.context addFence:fenceHandle];108 [modelView.layer.superlayer.context addFence:fenceHandle]; 102 109 [CATransaction commit]; 103 110 [fenceHandle invalidate]; … … 113 120 114 121 [CATransaction begin]; 115 [ view.layer.superlayer.context addFence:dismissFenceHandle];122 [modelView.layer.superlayer.context addFence:dismissFenceHandle]; 116 123 [CATransaction setCompletionBlock:^{ 117 124 [remoteViewController dismissViewControllerAnimated:NO completion:nil]; … … 129 136 #if ENABLE(ARKIT_INLINE_PREVIEW_MAC) 130 137 138 ASVInlinePreview * ModelElementController::previewForModelIdentifier(ModelIdentifier modelIdentifier) 139 { 140 if (!m_webPageProxy.preferences().modelElementEnabled()) 141 return nullptr; 142 143 return m_inlinePreviews.get(modelIdentifier.uuid).get(); 144 } 145 131 146 void ModelElementController::modelElementDidCreatePreview(URL fileURL, String uuid, WebCore::FloatSize size, CompletionHandler<void(Expected<std::pair<String, uint32_t>, WebCore::ResourceError>)>&& completionHandler) 132 147 { … … 151 166 152 167 RELEASE_ASSERT(isMainRunLoop()); 153 [preview setupRemoteConnectionWithCompletionHandler:makeBlockPtr([weakThis = WeakPtr { *this }, preview, uuid = WTFMove(uuid), url = WTFMove(url), completionHandler = WTFMove(completionHandler)] (NSError * _NullablecontextError) mutable {168 [preview setupRemoteConnectionWithCompletionHandler:makeBlockPtr([weakThis = WeakPtr { *this }, preview, uuid = WTFMove(uuid), url = WTFMove(url), completionHandler = WTFMove(completionHandler)] (NSError *contextError) mutable { 154 169 if (contextError) { 155 170 LOG(ModelElement, "Unable to create remote connection for uuid %s: %@.", uuid.utf8().data(), contextError.localizedDescription); … … 166 181 LOG(ModelElement, "Established remote connection with UUID %s.", uuid.utf8().data()); 167 182 168 [preview preparePreviewOfFileAtURL:url.get() completionHandler:makeBlockPtr([weakThis = WTFMove(weakThis), preview, uuid = WTFMove(uuid), url = WTFMove(url), completionHandler = WTFMove(completionHandler)] (NSError * _NullableloadError) mutable {183 [preview preparePreviewOfFileAtURL:url.get() completionHandler:makeBlockPtr([weakThis = WTFMove(weakThis), preview, uuid = WTFMove(uuid), url = WTFMove(url), completionHandler = WTFMove(completionHandler)] (NSError *loadError) mutable { 169 184 if (loadError) { 170 185 LOG(ModelElement, "Unable to load file for uuid %s: %@.", uuid.utf8().data(), loadError.localizedDescription); … … 217 232 #endif 218 233 219 } 220 221 #endif 234 #if ENABLE(ARKIT_INLINE_PREVIEW) 235 236 static bool previewHasCameraSupport(ASVInlinePreview *preview) 237 { 238 #if ENABLE(ARKIT_INLINE_PREVIEW_CAMERA_TRANSFORM) 239 return [preview respondsToSelector:@selector(getCameraTransform:)]; 240 #else 241 return false; 242 #endif 243 } 244 245 void ModelElementController::getCameraForModelElement(ModelIdentifier modelIdentifier, CompletionHandler<void(Expected<WebCore::HTMLModelElementCamera, WebCore::ResourceError>)>&& completionHandler) 246 { 247 auto* preview = previewForModelIdentifier(modelIdentifier); 248 if (!preview || !previewHasCameraSupport(preview)) { 249 callOnMainRunLoop([weakThis = WeakPtr { *this }, completionHandler = WTFMove(completionHandler), error = WebCore::ResourceError { WebCore::ResourceError::Type::General }] () mutable { 250 if (weakThis) 251 completionHandler(makeUnexpected(error)); 252 }); 253 return; 254 } 255 256 [preview getCameraTransform:makeBlockPtr([weakThis = WeakPtr { *this }, completionHandler = WTFMove(completionHandler)] (simd_float3 cameraTransform, NSError *error) mutable { 257 if (error) { 258 callOnMainRunLoop([weakThis = WTFMove(weakThis), completionHandler = WTFMove(completionHandler), error = WebCore::ResourceError { WebCore::ResourceError::Type::General }] () mutable { 259 if (weakThis) 260 completionHandler(makeUnexpected(error)); 261 }); 262 return; 263 } 264 265 callOnMainRunLoop([cameraTransform, weakThis = WTFMove(weakThis), completionHandler = WTFMove(completionHandler)] () mutable { 266 if (weakThis) 267 completionHandler(WebCore::HTMLModelElementCamera { cameraTransform.x, cameraTransform.y, cameraTransform.z }); 268 }); 269 }).get()]; 270 } 271 272 void ModelElementController::setCameraForModelElement(ModelIdentifier modelIdentifier, WebCore::HTMLModelElementCamera camera, CompletionHandler<void(bool)>&& completionHandler) 273 { 274 auto* preview = previewForModelIdentifier(modelIdentifier); 275 if (!preview || !previewHasCameraSupport(preview)) { 276 callOnMainRunLoop([weakThis = WeakPtr { *this }, completionHandler = WTFMove(completionHandler)] () mutable { 277 if (weakThis) 278 completionHandler(false); 279 }); 280 return; 281 } 282 283 [preview setCameraTransform:simd_make_float3(camera.pitch, camera.yaw, camera.scale)]; 284 285 callOnMainRunLoop([weakThis = WeakPtr { *this }, completionHandler = WTFMove(completionHandler)] () mutable { 286 if (weakThis) 287 completionHandler(true); 288 }); 289 } 290 291 #endif 292 293 } 294 295 #endif -
trunk/Source/WebKit/UIProcess/ModelElementController.h
r285986 r286019 28 28 #if ENABLE(ARKIT_INLINE_PREVIEW) 29 29 30 #include "ModelIdentifier.h" 30 31 #include <WebCore/ElementContext.h> 31 32 #include <WebCore/GraphicsLayer.h> … … 34 35 #include <wtf/WeakPtr.h> 35 36 36 #if ENABLE(ARKIT_INLINE_PREVIEW_MAC)37 37 OBJC_CLASS ASVInlinePreview; 38 39 #if ENABLE(ARKIT_INLINE_PREVIEW_IOS) 40 OBJC_CLASS WKModelView; 38 41 #endif 39 42 … … 49 52 WebPageProxy& page() { return m_webPageProxy; } 50 53 54 #if ENABLE(ARKIT_INLINE_PREVIEW) 55 void getCameraForModelElement(ModelIdentifier, CompletionHandler<void(Expected<WebCore::HTMLModelElementCamera, WebCore::ResourceError>)>&&); 56 void setCameraForModelElement(ModelIdentifier, WebCore::HTMLModelElementCamera, CompletionHandler<void(bool)>&&); 57 #endif 51 58 #if ENABLE(ARKIT_INLINE_PREVIEW_IOS) 52 void takeModelElementFullscreen( WebCore::GraphicsLayer::PlatformLayerID contentLayerId);59 void takeModelElementFullscreen(ModelIdentifier); 53 60 #endif 54 61 #if ENABLE(ARKIT_INLINE_PREVIEW_MAC) … … 60 67 61 68 private: 69 #if ENABLE(ARKIT_INLINE_PREVIEW) 70 ASVInlinePreview * previewForModelIdentifier(ModelIdentifier); 71 #endif 72 73 #if ENABLE(ARKIT_INLINE_PREVIEW_IOS) 74 WKModelView * modelViewForModelIdentifier(ModelIdentifier); 75 #endif 76 62 77 WebPageProxy& m_webPageProxy; 63 78 #if ENABLE(ARKIT_INLINE_PREVIEW_MAC) -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r285986 r286019 10833 10833 #endif 10834 10834 10835 #if ENABLE(ARKIT_INLINE_PREVIEW) 10836 void WebPageProxy::modelElementGetCamera(ModelIdentifier modelIdentifier, CompletionHandler<void(Expected<WebCore::HTMLModelElementCamera, WebCore::ResourceError>)>&& completionHandler) 10837 { 10838 modelElementController()->getCameraForModelElement(modelIdentifier, WTFMove(completionHandler)); 10839 } 10840 10841 void WebPageProxy::modelElementSetCamera(ModelIdentifier modelIdentifier, WebCore::HTMLModelElementCamera camera, CompletionHandler<void(bool)>&& completionHandler) 10842 { 10843 modelElementController()->setCameraForModelElement(modelIdentifier, camera, WTFMove(completionHandler)); 10844 } 10845 #endif 10846 10835 10847 #if ENABLE(ARKIT_INLINE_PREVIEW_IOS) 10836 void WebPageProxy::takeModelElementFullscreen( WebCore::GraphicsLayer::PlatformLayerID contentLayerId)10837 { 10838 modelElementController()->takeModelElementFullscreen( contentLayerId);10848 void WebPageProxy::takeModelElementFullscreen(ModelIdentifier modelIdentifier) 10849 { 10850 modelElementController()->takeModelElementFullscreen(modelIdentifier); 10839 10851 } 10840 10852 #endif -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r285986 r286019 197 197 #if ENABLE(ARKIT_INLINE_PREVIEW) 198 198 #include "ModelElementController.h" 199 #include "ModelIdentifier.h" 199 200 #endif 200 201 … … 588 589 #if ENABLE(ARKIT_INLINE_PREVIEW) 589 590 ModelElementController* modelElementController() { return m_modelElementController.get(); } 591 void modelElementGetCamera(ModelIdentifier, CompletionHandler<void(Expected<WebCore::HTMLModelElementCamera, WebCore::ResourceError>)>&&); 592 void modelElementSetCamera(ModelIdentifier, WebCore::HTMLModelElementCamera, CompletionHandler<void(bool)>&&); 590 593 #endif 591 594 #if ENABLE(ARKIT_INLINE_PREVIEW_IOS) 592 void takeModelElementFullscreen( WebCore::GraphicsLayer::PlatformLayerID contentLayerId);595 void takeModelElementFullscreen(ModelIdentifier); 593 596 #endif 594 597 #if ENABLE(ARKIT_INLINE_PREVIEW_MAC) -
trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in
r285986 r286019 587 587 588 588 #if ENABLE(ARKIT_INLINE_PREVIEW_IOS) 589 TakeModelElementFullscreen( uint64_t contentLayerID)589 TakeModelElementFullscreen(struct WebKit::ModelIdentifier modelIdentifier) 590 590 #endif 591 591 #if ENABLE(ARKIT_INLINE_PREVIEW_MAC) … … 595 595 HandleMouseUpForModelElement(String uuid, WebCore::LayoutPoint locationInPageCoordinates, MonotonicTime timestamp) 596 596 #endif 597 #if ENABLE(ARKIT_INLINE_PREVIEW) 598 ModelElementGetCamera(struct WebKit::ModelIdentifier modelIdentifier) -> (Expected<WebCore::HTMLModelElementCamera, WebCore::ResourceError> result) Async 599 ModelElementSetCamera(struct WebKit::ModelIdentifier modelIdentifier, struct WebCore::HTMLModelElementCamera camera) -> (bool success) Async 600 #endif 597 601 598 602 requestPermission(struct WebCore::ClientOrigin origin, struct WebCore::PermissionDescriptor descriptor) -> (enum:uint8_t WebCore::PermissionState state) Async -
trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj
r285981 r286019 4709 4709 71BAA73125FFCCBA00D7CD5D /* WKModelView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKModelView.h; path = ios/WKModelView.h; sourceTree = "<group>"; }; 4710 4710 71BAA73225FFCCBA00D7CD5D /* WKModelView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKModelView.mm; path = ios/WKModelView.mm; sourceTree = "<group>"; }; 4711 71E9650F2745682E00ADCF43 /* ModelIdentifier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ModelIdentifier.h; sourceTree = "<group>"; }; 4711 4712 71FB810A2260627A00323677 /* WebsiteSimulatedMouseEventsDispatchPolicy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebsiteSimulatedMouseEventsDispatchPolicy.h; sourceTree = "<group>"; }; 4712 4713 7203449A26A6C44C000A5F54 /* MonotonicObjectIdentifier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MonotonicObjectIdentifier.h; sourceTree = "<group>"; }; … … 6835 6836 2D10875F1D2C573E00B85F82 /* LoadParameters.h */, 6836 6837 49917DB0252E30750050313F /* MediaPlaybackState.h */, 6838 71E9650F2745682E00ADCF43 /* ModelIdentifier.h */, 6837 6839 7203449A26A6C44C000A5F54 /* MonotonicObjectIdentifier.h */, 6838 6840 2D50366A1BCDE17900E20BB3 /* NativeWebGestureEvent.h */, -
trunk/Source/WebKit/WebProcess/Model/ARKitInlinePreviewModelPlayer.h
r285922 r286019 28 28 #if ENABLE(ARKIT_INLINE_PREVIEW) 29 29 30 #include <WebCore/ModelPlayer.h> 31 #include <WebCore/ModelPlayerClient.h> 32 #include <wtf/Compiler.h> 30 #import "ModelIdentifier.h" 31 #import "WebPage.h" 32 #import "WebPageProxyMessages.h" 33 #import <WebCore/ModelPlayer.h> 34 #import <WebCore/ModelPlayerClient.h> 35 #import <wtf/Compiler.h> 33 36 34 37 namespace WebKit { … … 44 47 WebCore::ModelPlayerClient* client() { return m_client.get(); } 45 48 49 virtual std::optional<ModelIdentifier> modelIdentifier() = 0; 50 46 51 private: 47 52 // WebCore::ModelPlayer overrides. … … 49 54 PlatformLayer* layer() override; 50 55 void enterFullscreen() override; 56 void getCamera(CompletionHandler<void(std::optional<WebCore::HTMLModelElementCamera>&&)>&&) override; 57 void setCamera(WebCore::HTMLModelElementCamera, CompletionHandler<void(bool&&)>&&) override; 51 58 52 59 WeakPtr<WebPage> m_page; -
trunk/Source/WebKit/WebProcess/Model/ARKitInlinePreviewModelPlayer.mm
r285922 r286019 56 56 } 57 57 58 void ARKitInlinePreviewModelPlayer::getCamera(CompletionHandler<void(std::optional<WebCore::HTMLModelElementCamera>&&)>&& completionHandler) 59 { 60 auto modelIdentifier = this->modelIdentifier(); 61 if (!modelIdentifier) { 62 completionHandler(std::nullopt); 63 return; 64 } 65 66 auto* strongPage = m_page.get(); 67 if (!strongPage) { 68 completionHandler(std::nullopt); 69 return; 70 } 71 72 CompletionHandler<void(Expected<WebCore::HTMLModelElementCamera, WebCore::ResourceError>)> remoteCompletionHandler = [completionHandler = WTFMove(completionHandler)] (Expected<WebCore::HTMLModelElementCamera, WebCore::ResourceError> result) mutable { 73 if (!result) { 74 completionHandler(std::nullopt); 75 return; 76 } 77 78 completionHandler(*result); 79 }; 80 81 strongPage->sendWithAsyncReply(Messages::WebPageProxy::ModelElementGetCamera(*modelIdentifier), WTFMove(remoteCompletionHandler)); 82 } 83 84 void ARKitInlinePreviewModelPlayer::setCamera(WebCore::HTMLModelElementCamera camera, CompletionHandler<void(bool&&)>&& completionHandler) 85 { 86 auto modelIdentifier = this->modelIdentifier(); 87 if (!modelIdentifier) { 88 completionHandler(false); 89 return; 90 } 91 92 auto* strongPage = m_page.get(); 93 if (!strongPage) { 94 completionHandler(false); 95 return; 96 } 97 98 CompletionHandler<void(bool)> remoteCompletionHandler = [completionHandler = WTFMove(completionHandler)] (bool success) mutable { 99 completionHandler(WTFMove(success)); 100 }; 101 102 strongPage->sendWithAsyncReply(Messages::WebPageProxy::ModelElementSetCamera(*modelIdentifier, camera), WTFMove(remoteCompletionHandler)); 103 } 104 58 105 } 59 106 -
trunk/Source/WebKit/WebProcess/Model/ios/ARKitInlinePreviewModelPlayerIOS.h
r285986 r286019 42 42 ARKitInlinePreviewModelPlayerIOS(WebPage&, WebCore::ModelPlayerClient&); 43 43 44 std::optional<ModelIdentifier> modelIdentifier() override; 45 44 46 // WebCore::ModelPlayer overrides. 45 47 void enterFullscreen() override; -
trunk/Source/WebKit/WebProcess/Model/ios/ARKitInlinePreviewModelPlayerIOS.mm
r285986 r286019 49 49 } 50 50 51 std::optional<ModelIdentifier> ARKitInlinePreviewModelPlayerIOS::modelIdentifier() 52 { 53 if (!client()) 54 return { }; 55 56 if (auto layerId = client()->platformLayerID()) 57 return { { layerId } }; 58 59 return { }; 60 } 61 51 62 // MARK: - WebCore::ModelPlayer overrides. 52 63 53 64 void ARKitInlinePreviewModelPlayerIOS::enterFullscreen() 54 65 { 55 if (!client() || !page()) 66 auto* strongPage = page(); 67 if (!strongPage) 56 68 return; 57 69 58 if (auto layerId = client()->platformLayerID())59 page()->takeModelElementFullscreen(layerId);70 if (auto modelIdentifier = this->modelIdentifier()) 71 strongPage->send(Messages::WebPageProxy::TakeModelElementFullscreen(*modelIdentifier)); 60 72 } 61 73 -
trunk/Source/WebKit/WebProcess/Model/mac/ARKitInlinePreviewModelPlayerMac.h
r285986 r286019 48 48 ARKitInlinePreviewModelPlayerMac(WebPage&, WebCore::ModelPlayerClient&); 49 49 50 std::optional<ModelIdentifier> modelIdentifier() override; 51 50 52 // WebCore::ModelPlayer overrides. 51 53 void load(WebCore::Model&, WebCore::LayoutSize) override; -
trunk/Source/WebKit/WebProcess/Model/mac/ARKitInlinePreviewModelPlayerMac.mm
r285986 r286019 56 56 } 57 57 58 std::optional<ModelIdentifier> ARKitInlinePreviewModelPlayerMac::modelIdentifier() 59 { 60 if (m_inlinePreview) 61 return { { [m_inlinePreview uuid].UUIDString } }; 62 return { }; 63 } 64 58 65 static String& sharedModelElementCacheDirectory() 59 66 { -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
r285973 r286019 1525 1525 #endif 1526 1526 1527 #if ENABLE(ARKIT_INLINE_PREVIEW_IOS)1528 void WebChromeClient::takeModelElementFullscreen(WebCore::GraphicsLayer::PlatformLayerID contentLayerId) const1529 {1530 m_page.takeModelElementFullscreen(contentLayerId);1531 }1532 #endif1533 1534 1527 #if ENABLE(APPLE_PAY_AMS_UI) 1535 1528 -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h
r285973 r286019 456 456 #endif 457 457 458 #if ENABLE(ARKIT_INLINE_PREVIEW_IOS)459 void takeModelElementFullscreen(WebCore::GraphicsLayer::PlatformLayerID contentLayerId) const final;460 #endif461 462 458 #if ENABLE(APPLE_PAY_AMS_UI) 463 459 void startApplePayAMSUISession(const URL&, const WebCore::ApplePayAMSUIRequest&, CompletionHandler<void(std::optional<bool>&&)>&&) final; -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp
r285973 r286019 7790 7790 #endif 7791 7791 7792 #if ENABLE(ARKIT_INLINE_PREVIEW_IOS)7793 void WebPage::takeModelElementFullscreen(WebCore::GraphicsLayer::PlatformLayerID contentLayerId)7794 {7795 send(Messages::WebPageProxy::TakeModelElementFullscreen(contentLayerId));7796 }7797 #endif7798 7799 7792 void WebPage::scrollToRect(const WebCore::FloatRect& targetRect, const WebCore::FloatPoint& origin) 7800 7793 { -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.h
r285973 r286019 1491 1491 #endif 1492 1492 1493 #if ENABLE(ARKIT_INLINE_PREVIEW_IOS)1494 void takeModelElementFullscreen(WebCore::GraphicsLayer::PlatformLayerID contentLayerId);1495 #endif1496 1497 1493 void prepareToRunModalJavaScriptDialog(); 1498 1494
Note: See TracChangeset
for help on using the changeset viewer.