Title: [275102] trunk
Revision
275102
Author
[email protected]
Date
2021-03-26 09:41:27 -0700 (Fri, 26 Mar 2021)

Log Message

Implement cachedPropertyValue for WebXR [SameObject] attributes
https://bugs.webkit.org/show_bug.cgi?id=223635

Reviewed by Chris Dumez.

LayoutTests/imported/w3c:

Update WebXR [SameObject] related test expectations.

* web-platform-tests/webxr/xrRigidTransform_sameObject.https-expected.txt: Added.
* web-platform-tests/webxr/xrSession_sameObject.https-expected.txt: Added.
* web-platform-tests/webxr/xrView_sameObject.https-expected.txt: Added.
* web-platform-tests/webxr/xrViewerPose_views_sameObject.https-expected.txt: Added.

Source/WebCore:

[SameObject] is not currently implemented in WebKit. We need to implement custom getters.

Tested by WebXR WPT.

* Modules/webxr/WebXRRigidTransform.h:
(WebCore::WebXRRigidTransform::cachedMatrix):
* Modules/webxr/WebXRRigidTransform.idl:
* Modules/webxr/WebXRView.h:
(WebCore::WebXRView::cachedProjectionMatrix):
* Modules/webxr/WebXRView.idl:
* Modules/webxr/WebXRViewerPose.h:
(WebCore::WebXRViewerPose::cachedViews):
* Modules/webxr/WebXRViewerPose.idl:
* Sources.txt:
* bindings/js/JSWebXRRigidTransformCustom.cpp: Added.
(WebCore::JSWebXRRigidTransform::matrix const):
* bindings/js/JSWebXRViewCustom.cpp: Added.
(WebCore::JSWebXRView::projectionMatrix const):
* bindings/js/JSWebXRViewerPoseCustom.cpp: Added.
(WebCore::JSWebXRViewerPose::views const):

LayoutTests:

Update WebXR [SameObject] related test expectations.

* platform/wpe/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (275101 => 275102)


--- trunk/LayoutTests/ChangeLog	2021-03-26 16:28:13 UTC (rev 275101)
+++ trunk/LayoutTests/ChangeLog	2021-03-26 16:41:27 UTC (rev 275102)
@@ -1,3 +1,14 @@
+2021-03-26  Imanol Fernandez  <[email protected]>
+
+        Implement cachedPropertyValue for WebXR [SameObject] attributes
+        https://bugs.webkit.org/show_bug.cgi?id=223635
+
+        Reviewed by Chris Dumez.
+
+        Update WebXR [SameObject] related test expectations.
+
+        * platform/wpe/TestExpectations:
+
 2021-03-26  Xabier Rodriguez Calvar  <[email protected]>
 
         Unreviewed.

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (275101 => 275102)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-03-26 16:28:13 UTC (rev 275101)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-03-26 16:41:27 UTC (rev 275102)
@@ -1,3 +1,17 @@
+2021-03-26  Imanol Fernandez  <[email protected]>
+
+        Implement cachedPropertyValue for WebXR [SameObject] attributes
+        https://bugs.webkit.org/show_bug.cgi?id=223635
+
+        Reviewed by Chris Dumez.
+
+        Update WebXR [SameObject] related test expectations.
+
+        * web-platform-tests/webxr/xrRigidTransform_sameObject.https-expected.txt: Added.
+        * web-platform-tests/webxr/xrSession_sameObject.https-expected.txt: Added.
+        * web-platform-tests/webxr/xrView_sameObject.https-expected.txt: Added.
+        * web-platform-tests/webxr/xrViewerPose_views_sameObject.https-expected.txt: Added.
+
 2021-03-25  Antoine Quint  <[email protected]>
 
         Fix interpolation of the caret-color CSS property

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/webxr/xrRigidTransform_sameObject.https-expected.txt (0 => 275102)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/webxr/xrRigidTransform_sameObject.https-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webxr/xrRigidTransform_sameObject.https-expected.txt	2021-03-26 16:41:27 UTC (rev 275102)
@@ -0,0 +1,3 @@
+
+PASS XRRigidTransform position and orientation meet [SameObject] requirements
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/webxr/xrSession_sameObject.https-expected.txt (0 => 275102)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/webxr/xrSession_sameObject.https-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webxr/xrSession_sameObject.https-expected.txt	2021-03-26 16:41:27 UTC (rev 275102)
@@ -0,0 +1,3 @@
+
+PASS XRSession attributes meet [SameObject] requirement
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/webxr/xrView_sameObject.https-expected.txt (0 => 275102)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/webxr/xrView_sameObject.https-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webxr/xrView_sameObject.https-expected.txt	2021-03-26 16:41:27 UTC (rev 275102)
@@ -0,0 +1,3 @@
+
+PASS XRView attributes meet [SameObject] requirement
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/webxr/xrViewerPose_views_sameObject.https-expected.txt (0 => 275102)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/webxr/xrViewerPose_views_sameObject.https-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webxr/xrViewerPose_views_sameObject.https-expected.txt	2021-03-26 16:41:27 UTC (rev 275102)
@@ -0,0 +1,3 @@
+
+PASS XRViewerPose.views meets [SameObject] requirement
+

Modified: trunk/LayoutTests/platform/wpe/TestExpectations (275101 => 275102)


--- trunk/LayoutTests/platform/wpe/TestExpectations	2021-03-26 16:28:13 UTC (rev 275101)
+++ trunk/LayoutTests/platform/wpe/TestExpectations	2021-03-26 16:41:27 UTC (rev 275102)
@@ -665,6 +665,7 @@
 imported/w3c/web-platform-tests/webxr/xrRigidTransform_constructor.https.html [ Pass ]
 imported/w3c/web-platform-tests/webxr/xrRigidTransform_inverse.https.html [ Pass ]
 imported/w3c/web-platform-tests/webxr/xrRigidTransform_matrix.https.html [ Pass ]
+imported/w3c/web-platform-tests/webxr/xrRigidTransform_sameObject.https.html [ Pass ]
 imported/w3c/web-platform-tests/webxr/xrSession_cancelAnimationFrame.https.html [ Pass ]
 imported/w3c/web-platform-tests/webxr/xrSession_cancelAnimationFrame_invalidhandle.https.html [ Pass ]
 imported/w3c/web-platform-tests/webxr/xrSession_end.https.html [ Pass ]
@@ -676,7 +677,10 @@
 imported/w3c/web-platform-tests/webxr/xrSession_requestAnimationFrame_timestamp.https.html [ Pass ]
 imported/w3c/web-platform-tests/webxr/xrSession_requestReferenceSpace.https.html [ Pass ]
 imported/w3c/web-platform-tests/webxr/xrSession_requestReferenceSpace_features.https.html [ Pass ]
+imported/w3c/web-platform-tests/webxr/xrSession_sameObject.https.html [ Pass ]
 imported/w3c/web-platform-tests/webxr/xrSession_viewer_referenceSpace.https.html [ Pass ]
+imported/w3c/web-platform-tests/webxr/xrView_sameObject.https.html [ Pass ]
+imported/w3c/web-platform-tests/webxr/xrViewerPose_views_sameObject.https.html [ Pass ]
 imported/w3c/web-platform-tests/webxr/xrViewport_valid.https.html [ Pass ]
 imported/w3c/web-platform-tests/webxr/xrWebGLLayer_constructor.https.html [ Pass ]
 imported/w3c/web-platform-tests/webxr/xrWebGLLayer_framebuffer_draw.https.html [ Pass ]

Modified: trunk/Source/WebCore/ChangeLog (275101 => 275102)


--- trunk/Source/WebCore/ChangeLog	2021-03-26 16:28:13 UTC (rev 275101)
+++ trunk/Source/WebCore/ChangeLog	2021-03-26 16:41:27 UTC (rev 275102)
@@ -1,3 +1,31 @@
+2021-03-26  Imanol Fernandez  <[email protected]>
+
+        Implement cachedPropertyValue for WebXR [SameObject] attributes
+        https://bugs.webkit.org/show_bug.cgi?id=223635
+
+        Reviewed by Chris Dumez.
+
+        [SameObject] is not currently implemented in WebKit. We need to implement custom getters.
+
+        Tested by WebXR WPT.
+
+        * Modules/webxr/WebXRRigidTransform.h:
+        (WebCore::WebXRRigidTransform::cachedMatrix):
+        * Modules/webxr/WebXRRigidTransform.idl:
+        * Modules/webxr/WebXRView.h:
+        (WebCore::WebXRView::cachedProjectionMatrix):
+        * Modules/webxr/WebXRView.idl:
+        * Modules/webxr/WebXRViewerPose.h:
+        (WebCore::WebXRViewerPose::cachedViews):
+        * Modules/webxr/WebXRViewerPose.idl:
+        * Sources.txt:
+        * bindings/js/JSWebXRRigidTransformCustom.cpp: Added.
+        (WebCore::JSWebXRRigidTransform::matrix const):
+        * bindings/js/JSWebXRViewCustom.cpp: Added.
+        (WebCore::JSWebXRView::projectionMatrix const):
+        * bindings/js/JSWebXRViewerPoseCustom.cpp: Added.
+        (WebCore::JSWebXRViewerPose::views const):
+
 2021-03-26  Devin Rousso  <[email protected]>
 
         Adopt AVKit SPI for hiding touch bar seeking controls

Modified: trunk/Source/WebCore/Modules/webxr/WebXRRigidTransform.h (275101 => 275102)


--- trunk/Source/WebCore/Modules/webxr/WebXRRigidTransform.h	2021-03-26 16:28:13 UTC (rev 275101)
+++ trunk/Source/WebCore/Modules/webxr/WebXRRigidTransform.h	2021-03-26 16:41:27 UTC (rev 275102)
@@ -28,6 +28,7 @@
 #if ENABLE(WEBXR)
 
 #include "ExceptionOr.h"
+#include "JSValueInWrappedObject.h"
 #include "TransformationMatrix.h"
 #include <_javascript_Core/Float32Array.h>
 #include <wtf/IsoMalloc.h>
@@ -53,6 +54,8 @@
     const WebXRRigidTransform& inverse();
     const TransformationMatrix& rawTransform() const;
 
+    JSValueInWrappedObject& cachedMatrix() { return m_cachedMatrix; }
+
 private:
     WebXRRigidTransform(const DOMPointInit&, const DOMPointInit&);
     WebXRRigidTransform(const TransformationMatrix&);
@@ -63,6 +66,7 @@
     RefPtr<Float32Array> m_matrix;
     RefPtr<WebXRRigidTransform> m_inverse;
     WeakPtr<WebXRRigidTransform> m_parentInverse;
+    JSValueInWrappedObject m_cachedMatrix;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/Modules/webxr/WebXRRigidTransform.idl (275101 => 275102)


--- trunk/Source/WebCore/Modules/webxr/WebXRRigidTransform.idl	2021-03-26 16:28:13 UTC (rev 275101)
+++ trunk/Source/WebCore/Modules/webxr/WebXRRigidTransform.idl	2021-03-26 16:41:27 UTC (rev 275102)
@@ -28,6 +28,7 @@
     Conditional=WEBXR,
     SecureContext,
     Exposed=Window,
+    JSCustomMarkFunction,
     ImplementationLacksVTable,
     InterfaceName=XRRigidTransform
 ] interface WebXRRigidTransform {
@@ -35,6 +36,6 @@
 
     [SameObject] readonly attribute DOMPointReadOnly position;
     [SameObject] readonly attribute DOMPointReadOnly orientation;
-    readonly attribute Float32Array matrix;
+    [CustomGetter] readonly attribute Float32Array matrix;
     [SameObject] readonly attribute WebXRRigidTransform inverse;
 };

Modified: trunk/Source/WebCore/Modules/webxr/WebXRView.h (275101 => 275102)


--- trunk/Source/WebCore/Modules/webxr/WebXRView.h	2021-03-26 16:28:13 UTC (rev 275101)
+++ trunk/Source/WebCore/Modules/webxr/WebXRView.h	2021-03-26 16:41:27 UTC (rev 275102)
@@ -27,6 +27,7 @@
 
 #if ENABLE(WEBXR)
 
+#include "JSValueInWrappedObject.h"
 #include "WebXRRigidTransform.h"
 #include "XREye.h"
 #include <_javascript_Core/Float32Array.h>
@@ -59,6 +60,8 @@
     bool isViewportModifiable() const { return m_viewportModifiable; }
     void setViewportModifiable(bool modifiable) { m_viewportModifiable = modifiable; }
 
+    JSValueInWrappedObject& cachedProjectionMatrix() { return m_cachedProjectionMatrix; }
+
 private:
     WebXRView(Ref<WebXRFrame>&&, XREye, Ref<WebXRRigidTransform>&&, Ref<Float32Array>&&);
 
@@ -68,7 +71,7 @@
     Ref<Float32Array> m_projection;
     bool m_viewportModifiable { false };
     double m_requestedViewportScale { 1.0 };
-
+    JSValueInWrappedObject m_cachedProjectionMatrix;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/Modules/webxr/WebXRView.idl (275101 => 275102)


--- trunk/Source/WebCore/Modules/webxr/WebXRView.idl	2021-03-26 16:28:13 UTC (rev 275101)
+++ trunk/Source/WebCore/Modules/webxr/WebXRView.idl	2021-03-26 16:41:27 UTC (rev 275102)
@@ -28,11 +28,12 @@
     Conditional=WEBXR,
     SecureContext,
     Exposed=Window,
+    JSCustomMarkFunction,
     ImplementationLacksVTable,
     InterfaceName=XRView
 ] interface WebXRView {
     readonly attribute XREye eye;
-    readonly attribute Float32Array projectionMatrix;
+    [CustomGetter] readonly attribute Float32Array projectionMatrix;
     [SameObject] readonly attribute WebXRRigidTransform transform;
     readonly attribute double? recommendedViewportScale;
     undefined requestViewportScale(double? scale);

Modified: trunk/Source/WebCore/Modules/webxr/WebXRViewerPose.h (275101 => 275102)


--- trunk/Source/WebCore/Modules/webxr/WebXRViewerPose.h	2021-03-26 16:28:13 UTC (rev 275101)
+++ trunk/Source/WebCore/Modules/webxr/WebXRViewerPose.h	2021-03-26 16:41:27 UTC (rev 275102)
@@ -45,6 +45,8 @@
     const Vector<Ref<WebXRView>>& views() const;
     void setViews(Vector<Ref<WebXRView>>&&);
 
+    JSValueInWrappedObject& cachedViews() { return m_cachedViews; }
+
 private:
     WebXRViewerPose(Ref<WebXRRigidTransform>&&, bool emulatedPosition);
 
@@ -51,6 +53,7 @@
     bool isViewerPose() const final { return true; }
 
     Vector<Ref<WebXRView>> m_views;
+    JSValueInWrappedObject m_cachedViews;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/Modules/webxr/WebXRViewerPose.idl (275101 => 275102)


--- trunk/Source/WebCore/Modules/webxr/WebXRViewerPose.idl	2021-03-26 16:28:13 UTC (rev 275101)
+++ trunk/Source/WebCore/Modules/webxr/WebXRViewerPose.idl	2021-03-26 16:41:27 UTC (rev 275102)
@@ -32,5 +32,5 @@
     JSGenerateToNativeObject,
     InterfaceName=XRViewerPose
 ] interface WebXRViewerPose : WebXRPose {
-    [SameObject] readonly attribute FrozenArray<WebXRView> views;
+    [CachedAttribute, SameObject] readonly attribute FrozenArray<WebXRView> views;
 };

Modified: trunk/Source/WebCore/Sources.txt (275101 => 275102)


--- trunk/Source/WebCore/Sources.txt	2021-03-26 16:28:13 UTC (rev 275101)
+++ trunk/Source/WebCore/Sources.txt	2021-03-26 16:41:27 UTC (rev 275102)
@@ -624,7 +624,9 @@
 bindings/js/JSWebGL2RenderingContextCustom.cpp
 bindings/js/JSWebGLRenderingContextCustom.cpp
 bindings/js/JSWebXRReferenceSpaceCustom.cpp
+bindings/js/JSWebXRRigidTransformCustom.cpp
 bindings/js/JSWebXRSpaceCustom.cpp
+bindings/js/JSWebXRViewCustom.cpp
 bindings/js/JSWindowProxy.cpp
 bindings/js/JSWorkerGlobalScopeBase.cpp
 bindings/js/JSWorkerGlobalScopeCustom.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (275101 => 275102)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-03-26 16:28:13 UTC (rev 275101)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-03-26 16:41:27 UTC (rev 275102)
@@ -6349,6 +6349,8 @@
 		115CFA96208B952B001E6991 /* LayoutBox.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutBox.cpp; sourceTree = "<group>"; };
 		1163F82124E5D59B000AB960 /* RenderTreeMutationDisallowedScope.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RenderTreeMutationDisallowedScope.h; sourceTree = "<group>"; };
 		1163F82324E5D59B000AB960 /* RenderTreeMutationDisallowedScope.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RenderTreeMutationDisallowedScope.cpp; sourceTree = "<group>"; };
+		11648B41260A3F6C004AF1F2 /* JSWebXRRigidTransformCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebXRRigidTransformCustom.cpp; sourceTree = "<group>"; };
+		11648B43260A3F6C004AF1F2 /* JSWebXRViewCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebXRViewCustom.cpp; sourceTree = "<group>"; };
 		118B068625E41E510070BE4B /* OpenXRExtensions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OpenXRExtensions.cpp; sourceTree = "<group>"; };
 		118B068825E41E520070BE4B /* OpenXRExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpenXRExtensions.h; sourceTree = "<group>"; };
 		118B068925E41E520070BE4B /* OpenXRInstance.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OpenXRInstance.cpp; sourceTree = "<group>"; };
@@ -23065,6 +23067,8 @@
 				A1677E242144532800A08C34 /* JSPaymentMethodChangeEventCustom.cpp */,
 				A10D6E942144C99800FDD14D /* JSPaymentResponseCustom.cpp */,
 				A85F22081430377D007CC884 /* JSPopStateEventCustom.cpp */,
+				11648B41260A3F6C004AF1F2 /* JSWebXRRigidTransformCustom.cpp */,
+				11648B43260A3F6C004AF1F2 /* JSWebXRViewCustom.cpp */,
 				BC348BBD0DB7F531004ABAB9 /* JSXMLHttpRequestCustom.cpp */,
 			);
 			name = "Cached Attributes w/ Invalidation";

Added: trunk/Source/WebCore/bindings/js/JSWebXRRigidTransformCustom.cpp (0 => 275102)


--- trunk/Source/WebCore/bindings/js/JSWebXRRigidTransformCustom.cpp	                        (rev 0)
+++ trunk/Source/WebCore/bindings/js/JSWebXRRigidTransformCustom.cpp	2021-03-26 16:41:27 UTC (rev 275102)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2021 Igalia S.L. 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. ``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
+ * 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.
+ */
+
+#include "config.h"
+
+#if ENABLE(WEBXR)
+#include "JSWebXRRigidTransform.h"
+
+#include "WebXRRigidTransform.h"
+
+namespace WebCore {
+using namespace JSC;
+
+JSC::JSValue JSWebXRRigidTransform::matrix(JSC::JSGlobalObject& lexicalGlobalObject) const
+{
+    auto throwScope = DECLARE_THROW_SCOPE(lexicalGlobalObject.vm());
+    return cachedPropertyValue(lexicalGlobalObject, *this, wrapped().cachedMatrix(), [&] {
+        JSC::JSValue matrix = toJS<IDLFloat32Array>(lexicalGlobalObject, *globalObject(), throwScope, wrapped().matrix());
+        return matrix;
+    });
+}
+
+template<typename Visitor>
+void JSWebXRRigidTransform::visitAdditionalChildren(Visitor& visitor)
+{
+    wrapped().cachedMatrix().visit(visitor);
+}
+
+DEFINE_VISIT_ADDITIONAL_CHILDREN(JSWebXRRigidTransform);
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBXR)

Added: trunk/Source/WebCore/bindings/js/JSWebXRViewCustom.cpp (0 => 275102)


--- trunk/Source/WebCore/bindings/js/JSWebXRViewCustom.cpp	                        (rev 0)
+++ trunk/Source/WebCore/bindings/js/JSWebXRViewCustom.cpp	2021-03-26 16:41:27 UTC (rev 275102)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2021 Igalia S.L. 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. ``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
+ * 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.
+ */
+
+#include "config.h"
+
+#if ENABLE(WEBXR)
+#include "JSWebXRView.h"
+
+#include "WebXRView.h"
+
+namespace WebCore {
+using namespace JSC;
+
+JSC::JSValue JSWebXRView::projectionMatrix(JSC::JSGlobalObject& lexicalGlobalObject) const
+{
+    auto throwScope = DECLARE_THROW_SCOPE(lexicalGlobalObject.vm());
+    return cachedPropertyValue(lexicalGlobalObject, *this, wrapped().cachedProjectionMatrix(), [&] {
+        JSC::JSValue matrix = toJS<IDLFloat32Array>(lexicalGlobalObject, *globalObject(), throwScope, wrapped().projectionMatrix());
+        return matrix;
+    });
+}
+
+template<typename Visitor>
+void JSWebXRView::visitAdditionalChildren(Visitor& visitor)
+{
+    wrapped().cachedProjectionMatrix().visit(visitor);
+}
+
+DEFINE_VISIT_ADDITIONAL_CHILDREN(JSWebXRView);
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBXR)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to