Diff
Modified: trunk/Source/WTF/ChangeLog (286064 => 286065)
--- trunk/Source/WTF/ChangeLog 2021-11-19 17:09:32 UTC (rev 286064)
+++ trunk/Source/WTF/ChangeLog 2021-11-19 17:42:38 UTC (rev 286065)
@@ -1,3 +1,15 @@
+2021-11-19 Antoine Quint <[email protected]>
+
+ [Model] add audio support
+ https://bugs.webkit.org/show_bug.cgi?id=233365
+ <rdar://problem/85428982>
+
+ Reviewed by Wenson Hsieh.
+
+ Add a new compile-time flag for the new autio-related ARQL SPIs we are using.
+
+ * wtf/PlatformEnableCocoa.h:
+
2021-11-19 Alex Christensen <[email protected]>
Remove allocation in JSON::Value::parseJSON
Modified: trunk/Source/WTF/wtf/PlatformEnableCocoa.h (286064 => 286065)
--- trunk/Source/WTF/wtf/PlatformEnableCocoa.h 2021-11-19 17:09:32 UTC (rev 286064)
+++ trunk/Source/WTF/wtf/PlatformEnableCocoa.h 2021-11-19 17:42:38 UTC (rev 286065)
@@ -747,4 +747,5 @@
#if (ENABLE(ARKIT_INLINE_PREVIEW_MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 120400) || (ENABLE(ARKIT_INLINE_PREVIEW_IOS) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 150400)
#define ENABLE_ARKIT_INLINE_PREVIEW_CAMERA_TRANSFORM 1
#define ENABLE_ARKIT_INLINE_PREVIEW_ANIMATIONS_CONTROL 1
+#define ENABLE_ARKIT_INLINE_PREVIEW_AUDIO_CONTROL 1
#endif
Modified: trunk/Source/WebCore/ChangeLog (286064 => 286065)
--- trunk/Source/WebCore/ChangeLog 2021-11-19 17:09:32 UTC (rev 286064)
+++ trunk/Source/WebCore/ChangeLog 2021-11-19 17:42:38 UTC (rev 286065)
@@ -1,3 +1,33 @@
+2021-11-19 Antoine Quint <[email protected]>
+
+ [Model] add audio support
+ https://bugs.webkit.org/show_bug.cgi?id=233365
+ <rdar://problem/85428982>
+
+ Reviewed by Wenson Hsieh.
+
+ We add three new promise-based methods to the HTMLModelElement IDL to control the audio state
+ of the animation built into the USDZ asset: hasAudio(), isMuted() and setIsMuted().
+ All these methods are promise-based.
+
+ * Modules/model-element/HTMLModelElement.cpp:
+ (WebCore::HTMLModelElement::hasAudio):
+ (WebCore::HTMLModelElement::isMuted):
+ (WebCore::HTMLModelElement::setIsMuted):
+ * Modules/model-element/HTMLModelElement.h:
+ * Modules/model-element/HTMLModelElement.idl:
+ * Modules/model-element/ModelPlayer.h:
+ * Modules/model-element/dummy/DummyModelPlayer.cpp:
+ (WebCore::DummyModelPlayer::hasAudio):
+ (WebCore::DummyModelPlayer::isMuted):
+ (WebCore::DummyModelPlayer::setIsMuted):
+ * Modules/model-element/dummy/DummyModelPlayer.h:
+ * Modules/model-element/scenekit/SceneKitModelPlayer.h:
+ * Modules/model-element/scenekit/SceneKitModelPlayer.mm:
+ (WebCore::SceneKitModelPlayer::hasAudio):
+ (WebCore::SceneKitModelPlayer::isMuted):
+ (WebCore::SceneKitModelPlayer::setIsMuted):
+
2021-11-19 Antti Koivisto <[email protected]>
[CSS Cascade Layers] [Debug] ASSERTION FAILED: m_childRules.isEmpty() when using @import with layer name
Modified: trunk/Source/WebCore/Modules/model-element/HTMLModelElement.cpp (286064 => 286065)
--- trunk/Source/WebCore/Modules/model-element/HTMLModelElement.cpp 2021-11-19 17:09:32 UTC (rev 286064)
+++ trunk/Source/WebCore/Modules/model-element/HTMLModelElement.cpp 2021-11-19 17:42:38 UTC (rev 286065)
@@ -437,6 +437,53 @@
setAnimationIsPlaying(false, WTFMove(promise));
}
+// MARK: - Audio support.
+
+void HTMLModelElement::hasAudio(HasAudioPromise&& promise)
+{
+ if (!m_modelPlayer) {
+ promise.reject();
+ return;
+ }
+
+ m_modelPlayer->isPlayingAnimation([promise = WTFMove(promise)] (std::optional<bool> hasAudio) mutable {
+ if (!hasAudio)
+ promise.reject();
+ else
+ promise.resolve(*hasAudio);
+ });
}
+void HTMLModelElement::isMuted(IsMutedPromise&& promise)
+{
+ if (!m_modelPlayer) {
+ promise.reject();
+ return;
+ }
+
+ m_modelPlayer->isPlayingAnimation([promise = WTFMove(promise)] (std::optional<bool> isMuted) mutable {
+ if (!isMuted)
+ promise.reject();
+ else
+ promise.resolve(*isMuted);
+ });
+}
+
+void HTMLModelElement::setIsMuted(bool isMuted, DOMPromiseDeferred<void>&& promise)
+{
+ if (!m_modelPlayer) {
+ promise.reject();
+ return;
+ }
+
+ m_modelPlayer->setIsMuted(isMuted, [promise = WTFMove(promise)] (bool success) mutable {
+ if (success)
+ promise.resolve();
+ else
+ promise.reject();
+ });
+}
+
+}
+
#endif // ENABLE(MODEL_ELEMENT)
Modified: trunk/Source/WebCore/Modules/model-element/HTMLModelElement.h (286064 => 286065)
--- trunk/Source/WebCore/Modules/model-element/HTMLModelElement.h 2021-11-19 17:09:32 UTC (rev 286064)
+++ trunk/Source/WebCore/Modules/model-element/HTMLModelElement.h 2021-11-19 17:42:38 UTC (rev 286065)
@@ -80,6 +80,12 @@
void playAnimation(DOMPromiseDeferred<void>&&);
void pauseAnimation(DOMPromiseDeferred<void>&&);
+ using HasAudioPromise = DOMPromiseDeferred<IDLBoolean>;
+ void hasAudio(HasAudioPromise&&);
+ using IsMutedPromise = DOMPromiseDeferred<IDLBoolean>;
+ void isMuted(IsMutedPromise&&);
+ void setIsMuted(bool, DOMPromiseDeferred<void>&&);
+
bool isDraggableIgnoringAttributes() const final { return true; }
private:
Modified: trunk/Source/WebCore/Modules/model-element/HTMLModelElement.idl (286064 => 286065)
--- trunk/Source/WebCore/Modules/model-element/HTMLModelElement.idl 2021-11-19 17:09:32 UTC (rev 286064)
+++ trunk/Source/WebCore/Modules/model-element/HTMLModelElement.idl 2021-11-19 17:42:38 UTC (rev 286065)
@@ -40,4 +40,8 @@
Promise<boolean> isPlayingAnimation();
Promise<undefined> playAnimation();
Promise<undefined> pauseAnimation();
+
+ Promise<boolean> hasAudio();
+ Promise<boolean> isMuted();
+ Promise<undefined> setIsMuted(boolean isMuted);
};
Modified: trunk/Source/WebCore/Modules/model-element/ModelPlayer.h (286064 => 286065)
--- trunk/Source/WebCore/Modules/model-element/ModelPlayer.h 2021-11-19 17:09:32 UTC (rev 286064)
+++ trunk/Source/WebCore/Modules/model-element/ModelPlayer.h 2021-11-19 17:42:38 UTC (rev 286065)
@@ -53,6 +53,9 @@
virtual void setCamera(HTMLModelElementCamera, CompletionHandler<void(bool success)>&&) = 0;
virtual void isPlayingAnimation(CompletionHandler<void(std::optional<bool>&&)>&&) = 0;
virtual void setAnimationIsPlaying(bool, CompletionHandler<void(bool success)>&&) = 0;
+ virtual void hasAudio(CompletionHandler<void(std::optional<bool>&&)>&&) = 0;
+ virtual void isMuted(CompletionHandler<void(std::optional<bool>&&)>&&) = 0;
+ virtual void setIsMuted(bool, CompletionHandler<void(bool success)>&&) = 0;
};
}
Modified: trunk/Source/WebCore/Modules/model-element/dummy/DummyModelPlayer.cpp (286064 => 286065)
--- trunk/Source/WebCore/Modules/model-element/dummy/DummyModelPlayer.cpp 2021-11-19 17:09:32 UTC (rev 286064)
+++ trunk/Source/WebCore/Modules/model-element/dummy/DummyModelPlayer.cpp 2021-11-19 17:42:38 UTC (rev 286065)
@@ -86,4 +86,16 @@
{
}
+void DummyModelPlayer::hasAudio(CompletionHandler<void(std::optional<bool>&&)>&&)
+{
}
+
+void DummyModelPlayer::isMuted(CompletionHandler<void(std::optional<bool>&&)>&&)
+{
+}
+
+void DummyModelPlayer::setIsMuted(bool, CompletionHandler<void(bool success)>&&)
+{
+}
+
+}
Modified: trunk/Source/WebCore/Modules/model-element/dummy/DummyModelPlayer.h (286064 => 286065)
--- trunk/Source/WebCore/Modules/model-element/dummy/DummyModelPlayer.h 2021-11-19 17:09:32 UTC (rev 286064)
+++ trunk/Source/WebCore/Modules/model-element/dummy/DummyModelPlayer.h 2021-11-19 17:42:38 UTC (rev 286065)
@@ -51,6 +51,9 @@
void setCamera(WebCore::HTMLModelElementCamera, CompletionHandler<void(bool success)>&&) override;
void isPlayingAnimation(CompletionHandler<void(std::optional<bool>&&)>&&) override;
void setAnimationIsPlaying(bool, CompletionHandler<void(bool success)>&&) override;
+ void hasAudio(CompletionHandler<void(std::optional<bool>&&)>&&) override;
+ void isMuted(CompletionHandler<void(std::optional<bool>&&)>&&) override;
+ void setIsMuted(bool, CompletionHandler<void(bool success)>&&) override;
WeakPtr<ModelPlayerClient> m_client;
};
Modified: trunk/Source/WebCore/Modules/model-element/scenekit/SceneKitModelPlayer.h (286064 => 286065)
--- trunk/Source/WebCore/Modules/model-element/scenekit/SceneKitModelPlayer.h 2021-11-19 17:09:32 UTC (rev 286064)
+++ trunk/Source/WebCore/Modules/model-element/scenekit/SceneKitModelPlayer.h 2021-11-19 17:42:38 UTC (rev 286065)
@@ -65,6 +65,9 @@
void setCamera(HTMLModelElementCamera, CompletionHandler<void(bool success)>&&) override;
void isPlayingAnimation(CompletionHandler<void(std::optional<bool>&&)>&&) override;
void setAnimationIsPlaying(bool, CompletionHandler<void(bool success)>&&) override;
+ void hasAudio(CompletionHandler<void(std::optional<bool>&&)>&&) override;
+ void isMuted(CompletionHandler<void(std::optional<bool>&&)>&&) override;
+ void setIsMuted(bool, CompletionHandler<void(bool success)>&&) override;
// SceneKitModelLoaderClient overrides.
virtual void didFinishLoading(SceneKitModelLoader&, Ref<SceneKitModel>) override;
Modified: trunk/Source/WebCore/Modules/model-element/scenekit/SceneKitModelPlayer.mm (286064 => 286065)
--- trunk/Source/WebCore/Modules/model-element/scenekit/SceneKitModelPlayer.mm 2021-11-19 17:09:32 UTC (rev 286064)
+++ trunk/Source/WebCore/Modules/model-element/scenekit/SceneKitModelPlayer.mm 2021-11-19 17:42:38 UTC (rev 286065)
@@ -104,6 +104,18 @@
{
}
+void SceneKitModelPlayer::hasAudio(CompletionHandler<void(std::optional<bool>&&)>&&)
+{
+}
+
+void SceneKitModelPlayer::isMuted(CompletionHandler<void(std::optional<bool>&&)>&&)
+{
+}
+
+void SceneKitModelPlayer::setIsMuted(bool, CompletionHandler<void(bool success)>&&)
+{
+}
+
// MARK: - SceneKitModelLoaderClient overrides.
void SceneKitModelPlayer::didFinishLoading(SceneKitModelLoader& loader, Ref<SceneKitModel> model)
Modified: trunk/Source/WebCore/PAL/ChangeLog (286064 => 286065)
--- trunk/Source/WebCore/PAL/ChangeLog 2021-11-19 17:09:32 UTC (rev 286064)
+++ trunk/Source/WebCore/PAL/ChangeLog 2021-11-19 17:42:38 UTC (rev 286065)
@@ -1,3 +1,16 @@
+2021-11-19 Antoine Quint <[email protected]>
+
+ [Model] add audio support
+ https://bugs.webkit.org/show_bug.cgi?id=233365
+ <rdar://problem/85428982>
+
+ Reviewed by Wenson Hsieh.
+
+ Add the new ARQL SPIs we are using for audio control.
+
+ * pal/spi/ios/SystemPreviewSPI.h:
+ * pal/spi/mac/SystemPreviewSPI.h:
+
2021-11-18 Antoine Quint <[email protected]>
[Model] add support for pausing and resuming animations
Modified: trunk/Source/WebCore/PAL/pal/spi/ios/SystemPreviewSPI.h (286064 => 286065)
--- trunk/Source/WebCore/PAL/pal/spi/ios/SystemPreviewSPI.h 2021-11-19 17:09:32 UTC (rev 286064)
+++ trunk/Source/WebCore/PAL/pal/spi/ios/SystemPreviewSPI.h 2021-11-19 17:42:38 UTC (rev 286065)
@@ -112,6 +112,9 @@
typedef void (^ASVSetIsPlayingReplyBlock) (BOOL isPlaying, NSError * _Nullable error);
- (void)setIsPlaying:(BOOL)isPlaying reply:(ASVSetIsPlayingReplyBlock)reply;
+@property (nonatomic, readonly) BOOL hasAudio;
+@property (nonatomic, readwrite) BOOL isMuted;
+
@end
NS_ASSUME_NONNULL_END
Modified: trunk/Source/WebCore/PAL/pal/spi/mac/SystemPreviewSPI.h (286064 => 286065)
--- trunk/Source/WebCore/PAL/pal/spi/mac/SystemPreviewSPI.h 2021-11-19 17:09:32 UTC (rev 286064)
+++ trunk/Source/WebCore/PAL/pal/spi/mac/SystemPreviewSPI.h 2021-11-19 17:42:38 UTC (rev 286065)
@@ -62,6 +62,9 @@
typedef void (^ASVSetIsPlayingReplyBlock) (BOOL isPlaying, NSError * _Nullable error);
- (void)setIsPlaying:(BOOL)isPlaying reply:(ASVSetIsPlayingReplyBlock)reply;
+@property (nonatomic, readonly) BOOL hasAudio;
+@property (nonatomic, readwrite) BOOL isMuted;
+
@end
NS_ASSUME_NONNULL_END
Modified: trunk/Source/WebKit/ChangeLog (286064 => 286065)
--- trunk/Source/WebKit/ChangeLog 2021-11-19 17:09:32 UTC (rev 286064)
+++ trunk/Source/WebKit/ChangeLog 2021-11-19 17:42:38 UTC (rev 286065)
@@ -1,3 +1,33 @@
+2021-11-19 Antoine Quint <[email protected]>
+
+ [Model] add audio support
+ https://bugs.webkit.org/show_bug.cgi?id=233365
+ <rdar://problem/85428982>
+
+ Reviewed by Wenson Hsieh.
+
+ Expose new WebPageProxy messages to let the WebProcess message the UIProcess
+ to call into ASVInlinePreview methods to get and set the muted state and get
+ whehter the model contains audio.
+
+ * UIProcess/Cocoa/ModelElementControllerCocoa.mm:
+ (WebKit::previewHasAudioSupport):
+ (WebKit::ModelElementController::hasAudioForModelElement):
+ (WebKit::ModelElementController::isMutedForModelElement):
+ (WebKit::ModelElementController::setIsMutedForModelElement):
+ * UIProcess/ModelElementController.h:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::modelElementHasAudio):
+ (WebKit::WebPageProxy::modelElementIsMuted):
+ (WebKit::WebPageProxy::modelElementSetIsMuted):
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebPageProxy.messages.in:
+ * WebProcess/Model/ARKitInlinePreviewModelPlayer.h:
+ * WebProcess/Model/ARKitInlinePreviewModelPlayer.mm:
+ (WebKit::ARKitInlinePreviewModelPlayer::hasAudio):
+ (WebKit::ARKitInlinePreviewModelPlayer::isMuted):
+ (WebKit::ARKitInlinePreviewModelPlayer::setIsMuted):
+
2021-11-18 Antoine Quint <[email protected]>
[Model] add support for pausing and resuming animations
Modified: trunk/Source/WebKit/UIProcess/Cocoa/ModelElementControllerCocoa.mm (286064 => 286065)
--- trunk/Source/WebKit/UIProcess/Cocoa/ModelElementControllerCocoa.mm 2021-11-19 17:09:32 UTC (rev 286064)
+++ trunk/Source/WebKit/UIProcess/Cocoa/ModelElementControllerCocoa.mm 2021-11-19 17:42:38 UTC (rev 286065)
@@ -359,8 +359,63 @@
#endif
}
+static bool previewHasAudioSupport(ASVInlinePreview *preview)
+{
+#if ENABLE(ARKIT_INLINE_PREVIEW_AUDIO_CONTROL)
+ return [preview respondsToSelector:@selector(hasAudio)];
+#else
+ return false;
#endif
+}
+void ModelElementController::hasAudioForModelElement(ModelIdentifier modelIdentifier, CompletionHandler<void(Expected<bool, WebCore::ResourceError>)>&& completionHandler)
+{
+ auto* preview = previewForModelIdentifier(modelIdentifier);
+ if (!previewHasAudioSupport(preview)) {
+ completionHandler(makeUnexpected(WebCore::ResourceError { WebCore::ResourceError::Type::General }));
+ return;
+ }
+
+#if ENABLE(ARKIT_INLINE_PREVIEW_AUDIO_CONTROL)
+ completionHandler([preview hasAudio]);
+#else
+ ASSERT_NOT_REACHED();
+#endif
}
+void ModelElementController::isMutedForModelElement(ModelIdentifier modelIdentifier, CompletionHandler<void(Expected<bool, WebCore::ResourceError>)>&& completionHandler)
+{
+ auto* preview = previewForModelIdentifier(modelIdentifier);
+ if (!previewHasAudioSupport(preview)) {
+ completionHandler(makeUnexpected(WebCore::ResourceError { WebCore::ResourceError::Type::General }));
+ return;
+ }
+
+#if ENABLE(ARKIT_INLINE_PREVIEW_AUDIO_CONTROL)
+ completionHandler([preview isMuted]);
+#else
+ ASSERT_NOT_REACHED();
#endif
+}
+
+void ModelElementController::setIsMutedForModelElement(ModelIdentifier modelIdentifier, bool isMuted, CompletionHandler<void(bool)>&& completionHandler)
+{
+ auto* preview = previewForModelIdentifier(modelIdentifier);
+ if (!previewHasAudioSupport(preview)) {
+ completionHandler(false);
+ return;
+ }
+
+#if ENABLE(ARKIT_INLINE_PREVIEW_AUDIO_CONTROL)
+ preview.isMuted = isMuted;
+ completionHandler(true);
+#else
+ ASSERT_NOT_REACHED();
+#endif
+}
+
+#endif
+
+}
+
+#endif
Modified: trunk/Source/WebKit/UIProcess/ModelElementController.h (286064 => 286065)
--- trunk/Source/WebKit/UIProcess/ModelElementController.h 2021-11-19 17:09:32 UTC (rev 286064)
+++ trunk/Source/WebKit/UIProcess/ModelElementController.h 2021-11-19 17:42:38 UTC (rev 286065)
@@ -56,6 +56,9 @@
void setCameraForModelElement(ModelIdentifier, WebCore::HTMLModelElementCamera, CompletionHandler<void(bool)>&&);
void isPlayingAnimationForModelElement(ModelIdentifier, CompletionHandler<void(Expected<bool, WebCore::ResourceError>)>&&);
void setAnimationIsPlayingForModelElement(ModelIdentifier, bool, CompletionHandler<void(bool)>&&);
+ void hasAudioForModelElement(ModelIdentifier, CompletionHandler<void(Expected<bool, WebCore::ResourceError>)>&&);
+ void isMutedForModelElement(ModelIdentifier, CompletionHandler<void(Expected<bool, WebCore::ResourceError>)>&&);
+ void setIsMutedForModelElement(ModelIdentifier, bool, CompletionHandler<void(bool)>&&);
#endif
#if ENABLE(ARKIT_INLINE_PREVIEW_IOS)
void takeModelElementFullscreen(ModelIdentifier);
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (286064 => 286065)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2021-11-19 17:09:32 UTC (rev 286064)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2021-11-19 17:42:38 UTC (rev 286065)
@@ -10852,6 +10852,21 @@
{
modelElementController()->setAnimationIsPlayingForModelElement(modelIdentifier, isPlaying, WTFMove(completionHandler));
}
+
+void WebPageProxy::modelElementHasAudio(ModelIdentifier modelIdentifier, CompletionHandler<void(Expected<bool, ResourceError>)>&& completionHandler)
+{
+ modelElementController()->hasAudioForModelElement(modelIdentifier, WTFMove(completionHandler));
+}
+
+void WebPageProxy::modelElementIsMuted(ModelIdentifier modelIdentifier, CompletionHandler<void(Expected<bool, ResourceError>)>&& completionHandler)
+{
+ modelElementController()->isMutedForModelElement(modelIdentifier, WTFMove(completionHandler));
+}
+
+void WebPageProxy::modelElementSetIsMuted(ModelIdentifier modelIdentifier, bool isMuted, CompletionHandler<void(bool)>&& completionHandler)
+{
+ modelElementController()->setIsMutedForModelElement(modelIdentifier, isMuted, WTFMove(completionHandler));
+}
#endif
#if ENABLE(ARKIT_INLINE_PREVIEW_IOS)
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (286064 => 286065)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2021-11-19 17:09:32 UTC (rev 286064)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2021-11-19 17:42:38 UTC (rev 286065)
@@ -592,6 +592,9 @@
void modelElementSetCamera(ModelIdentifier, WebCore::HTMLModelElementCamera, CompletionHandler<void(bool)>&&);
void modelElementIsPlayingAnimation(ModelIdentifier, CompletionHandler<void(Expected<bool, WebCore::ResourceError>)>&&);
void modelElementSetAnimationIsPlaying(ModelIdentifier, bool, CompletionHandler<void(bool)>&&);
+ void modelElementHasAudio(ModelIdentifier, CompletionHandler<void(Expected<bool, WebCore::ResourceError>)>&&);
+ void modelElementIsMuted(ModelIdentifier, CompletionHandler<void(Expected<bool, WebCore::ResourceError>)>&&);
+ void modelElementSetIsMuted(ModelIdentifier, bool, CompletionHandler<void(bool)>&&);
#endif
#if ENABLE(ARKIT_INLINE_PREVIEW_IOS)
void takeModelElementFullscreen(ModelIdentifier);
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in (286064 => 286065)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2021-11-19 17:09:32 UTC (rev 286064)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2021-11-19 17:42:38 UTC (rev 286065)
@@ -599,6 +599,9 @@
ModelElementSetCamera(struct WebKit::ModelIdentifier modelIdentifier, struct WebCore::HTMLModelElementCamera camera) -> (bool success) Async
ModelElementIsPlayingAnimation(struct WebKit::ModelIdentifier modelIdentifier) -> (Expected<bool, WebCore::ResourceError> result) Async
ModelElementSetAnimationIsPlaying(struct WebKit::ModelIdentifier modelIdentifier, bool isPlaying) -> (bool success) Async
+ ModelElementHasAudio(struct WebKit::ModelIdentifier modelIdentifier) -> (Expected<bool, WebCore::ResourceError> result) Async
+ ModelElementIsMuted(struct WebKit::ModelIdentifier modelIdentifier) -> (Expected<bool, WebCore::ResourceError> result) Async
+ ModelElementSetIsMuted(struct WebKit::ModelIdentifier modelIdentifier, bool isMuted) -> (bool success) Async
#endif
requestPermission(struct WebCore::ClientOrigin origin, struct WebCore::PermissionDescriptor descriptor) -> (enum:uint8_t WebCore::PermissionState state) Async
Modified: trunk/Source/WebKit/WebProcess/Model/ARKitInlinePreviewModelPlayer.h (286064 => 286065)
--- trunk/Source/WebKit/WebProcess/Model/ARKitInlinePreviewModelPlayer.h 2021-11-19 17:09:32 UTC (rev 286064)
+++ trunk/Source/WebKit/WebProcess/Model/ARKitInlinePreviewModelPlayer.h 2021-11-19 17:42:38 UTC (rev 286065)
@@ -57,6 +57,9 @@
void setCamera(WebCore::HTMLModelElementCamera, CompletionHandler<void(bool success)>&&) override;
void isPlayingAnimation(CompletionHandler<void(std::optional<bool>&&)>&&) override;
void setAnimationIsPlaying(bool, CompletionHandler<void(bool success)>&&) override;
+ void hasAudio(CompletionHandler<void(std::optional<bool>&&)>&&) override;
+ void isMuted(CompletionHandler<void(std::optional<bool>&&)>&&) override;
+ void setIsMuted(bool, CompletionHandler<void(bool success)>&&) override;
WeakPtr<WebPage> m_page;
WeakPtr<WebCore::ModelPlayerClient> m_client;
Modified: trunk/Source/WebKit/WebProcess/Model/ARKitInlinePreviewModelPlayer.mm (286064 => 286065)
--- trunk/Source/WebKit/WebProcess/Model/ARKitInlinePreviewModelPlayer.mm 2021-11-19 17:09:32 UTC (rev 286064)
+++ trunk/Source/WebKit/WebProcess/Model/ARKitInlinePreviewModelPlayer.mm 2021-11-19 17:42:38 UTC (rev 286065)
@@ -149,6 +149,79 @@
strongPage->sendWithAsyncReply(Messages::WebPageProxy::ModelElementSetAnimationIsPlaying(*modelIdentifier, isPlaying), WTFMove(remoteCompletionHandler));
}
+void ARKitInlinePreviewModelPlayer::hasAudio(CompletionHandler<void(std::optional<bool>&&)>&& completionHandler)
+{
+ auto modelIdentifier = this->modelIdentifier();
+ if (!modelIdentifier) {
+ completionHandler(std::nullopt);
+ return;
+ }
+
+ RefPtr strongPage = m_page.get();
+ if (!strongPage) {
+ completionHandler(std::nullopt);
+ return;
+ }
+
+ CompletionHandler<void(Expected<bool, WebCore::ResourceError>)> remoteCompletionHandler = [completionHandler = WTFMove(completionHandler)] (Expected<bool, WebCore::ResourceError> result) mutable {
+ if (!result) {
+ completionHandler(std::nullopt);
+ return;
+ }
+
+ completionHandler(*result);
+ };
+
+ strongPage->sendWithAsyncReply(Messages::WebPageProxy::ModelElementHasAudio(*modelIdentifier), WTFMove(remoteCompletionHandler));
}
+void ARKitInlinePreviewModelPlayer::isMuted(CompletionHandler<void(std::optional<bool>&&)>&& completionHandler)
+{
+ auto modelIdentifier = this->modelIdentifier();
+ if (!modelIdentifier) {
+ completionHandler(std::nullopt);
+ return;
+ }
+
+ RefPtr strongPage = m_page.get();
+ if (!strongPage) {
+ completionHandler(std::nullopt);
+ return;
+ }
+
+ CompletionHandler<void(Expected<bool, WebCore::ResourceError>)> remoteCompletionHandler = [completionHandler = WTFMove(completionHandler)] (Expected<bool, WebCore::ResourceError> result) mutable {
+ if (!result) {
+ completionHandler(std::nullopt);
+ return;
+ }
+
+ completionHandler(*result);
+ };
+
+ strongPage->sendWithAsyncReply(Messages::WebPageProxy::ModelElementIsMuted(*modelIdentifier), WTFMove(remoteCompletionHandler));
+}
+
+void ARKitInlinePreviewModelPlayer::setIsMuted(bool isMuted, CompletionHandler<void(bool success)>&& completionHandler)
+{
+ auto modelIdentifier = this->modelIdentifier();
+ if (!modelIdentifier) {
+ completionHandler(false);
+ return;
+ }
+
+ RefPtr strongPage = m_page.get();
+ if (!strongPage) {
+ completionHandler(false);
+ return;
+ }
+
+ CompletionHandler<void(bool)> remoteCompletionHandler = [completionHandler = WTFMove(completionHandler)] (bool success) mutable {
+ completionHandler(success);
+ };
+
+ strongPage->sendWithAsyncReply(Messages::WebPageProxy::ModelElementSetIsMuted(*modelIdentifier, isMuted), WTFMove(remoteCompletionHandler));
+}
+
+}
+
#endif