WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-208702-20200311120709.patch (text/plain), 260.21 KB, created by
Sergio Villar Senin
on 2020-03-11 04:07:12 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Sergio Villar Senin
Created:
2020-03-11 04:07:12 PDT
Size:
260.21 KB
patch
obsolete
>Subversion Revision: 257837 >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index 69712f60ef233a41479e0cdd5bbfc3892e155982..c52b5305235e62df188c615c246c6b0d0e628828 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,17 @@ >+2020-03-06 Sergio Villar Senin <svillar@igalia.com> >+ >+ [WebXR] IDLs, stubs and build configuration for WPE >+ https://bugs.webkit.org/show_bug.cgi?id=208702 >+ >+ Define USE_OPENXR (disabled) if it was not defined by the build system just in case >+ ENABLE_WEBGL is defined and active. >+ >+ Largely based on previous work by Žan DoberÅ¡ek. >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * wtf/Platform.h: >+ > 2020-03-03 Megan Gardner <megan_gardner@apple.com> > > Build Fix >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 7969d2bbd91fd5f51b96f605f5ccbb97c191d928..18c670ad103b0f8331f778ce817c4d4966e9dfad 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,215 @@ >+2020-03-06 Sergio Villar Senin <svillar@igalia.com> >+ >+ [WebXR] IDLs, stubs and build configuration for WPE >+ https://bugs.webkit.org/show_bug.cgi?id=208702 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Added the IDLs defined by the spec with very basic empty implementations to get them >+ built. Apart from that a very basic implementation of the required platform code using >+ OpenXR API was also added. >+ >+ No new tests as no new functionality was really added (empty implementations). However >+ follow up patches will import the already available WPT tests for WebXR. >+ >+ Largely based on previous work by Žan DoberÅ¡ek. >+ >+ * CMakeLists.txt: >+ * DerivedSources.make: >+ * Modules/webxr/NavigatorWebXR.cpp: Added. >+ (WebCore::NavigatorWebXR::xr): >+ (WebCore::NavigatorWebXR::from): >+ * Modules/webxr/NavigatorWebXR.h: Added. >+ * Modules/webxr/NavigatorWebXR.idl: Added. >+ * Modules/webxr/XRBoundedReferenceSpace.cpp: Added. >+ (WebCore::XRBoundedReferenceSpace::boundsGeometry const): >+ * Modules/webxr/XRBoundedReferenceSpace.h: Added. >+ * Modules/webxr/XRBoundedReferenceSpace.idl: Added. >+ * Modules/webxr/XREnvironmentBlendMode.h: Added. >+ * Modules/webxr/XREnvironmentBlendMode.idl: Added. >+ * Modules/webxr/XREye.h: Added. >+ * Modules/webxr/XREye.idl: Added. >+ * Modules/webxr/XRFrame.cpp: Added. >+ (WebCore::XRFrame::create): >+ (WebCore::XRFrame::XRFrame): >+ (WebCore::XRFrame::session const): >+ (WebCore::XRFrame::getViewerPose): >+ (WebCore::XRFrame::getPose): >+ * Modules/webxr/XRFrame.h: Added. >+ * Modules/webxr/XRFrame.idl: Added. >+ * Modules/webxr/XRFrameRequestCallback.h: Added. >+ * Modules/webxr/XRFrameRequestCallback.idl: Added. >+ * Modules/webxr/XRHandedness.h: Added. >+ * Modules/webxr/XRHandedness.idl: Added. >+ * Modules/webxr/XRInputSource.cpp: Added. >+ (WebCore::XRInputSource::create): >+ (WebCore::XRInputSource::XRInputSource): >+ (WebCore::XRInputSource::handedness const): >+ (WebCore::XRInputSource::targetRayMode const): >+ (WebCore::XRInputSource::targetRaySpace const): >+ (WebCore::XRInputSource::gripSpace const): >+ (WebCore::XRInputSource::profiles const): >+ * Modules/webxr/XRInputSource.h: Added. >+ * Modules/webxr/XRInputSource.idl: Added. >+ * Modules/webxr/XRInputSourceArray.cpp: Added. >+ (WebCore::XRInputSourceArray::length const): >+ (WebCore::XRInputSourceArray::item const): >+ * Modules/webxr/XRInputSourceArray.h: Added. >+ * Modules/webxr/XRInputSourceArray.idl: Added. >+ * Modules/webxr/XRInputSourceEvent.cpp: Added. >+ (WebCore::XRInputSourceEvent::create): >+ (WebCore::XRInputSourceEvent::XRInputSourceEvent): >+ (WebCore::XRInputSourceEvent::frame const): >+ (WebCore::XRInputSourceEvent::inputSource const): >+ (WebCore::XRInputSourceEvent::buttonIndex const): >+ * Modules/webxr/XRInputSourceEvent.h: Added. >+ * Modules/webxr/XRInputSourceEvent.idl: Added. >+ * Modules/webxr/XRInputSourcesChangeEvent.cpp: Added. >+ (WebCore::XRInputSourcesChangeEvent::create): >+ (WebCore::XRInputSourcesChangeEvent::XRInputSourcesChangeEvent): >+ (WebCore::XRInputSourcesChangeEvent::session const): >+ (WebCore::XRInputSourcesChangeEvent::added const): >+ (WebCore::XRInputSourcesChangeEvent::removed const): >+ * Modules/webxr/XRInputSourcesChangeEvent.h: Added. >+ * Modules/webxr/XRInputSourcesChangeEvent.idl: Added. >+ * Modules/webxr/XRPose.cpp: Added. >+ (WebCore::XRPose::create): >+ (WebCore::XRPose::XRPose): >+ (WebCore::XRPose::transform const): >+ (WebCore::XRPose::emulatedPosition const): >+ * Modules/webxr/XRPose.h: Added. >+ * Modules/webxr/XRPose.idl: Added. >+ * Modules/webxr/XRReferenceSpace.cpp: Added. >+ (WebCore::XRReferenceSpace::XRReferenceSpace): >+ (WebCore::XRReferenceSpace::getOffsetReferenceSpace): >+ * Modules/webxr/XRReferenceSpace.h: Added. >+ * Modules/webxr/XRReferenceSpace.idl: Added. >+ * Modules/webxr/XRReferenceSpaceEvent.cpp: Added. >+ (WebCore::XRReferenceSpaceEvent::create): >+ (WebCore::XRReferenceSpaceEvent::XRReferenceSpaceEvent): >+ (WebCore::XRReferenceSpaceEvent::referenceSpace const): >+ (WebCore::XRReferenceSpaceEvent::transform const): >+ * Modules/webxr/XRReferenceSpaceEvent.h: Added. >+ * Modules/webxr/XRReferenceSpaceEvent.idl: Added. >+ * Modules/webxr/XRReferenceSpaceType.h: Added. >+ * Modules/webxr/XRReferenceSpaceType.idl: Added. >+ * Modules/webxr/XRRenderState.cpp: Added. >+ (WebCore::XRRenderState::create): >+ (WebCore::XRRenderState::XRRenderState): >+ (WebCore::XRRenderState::depthNear const): >+ (WebCore::XRRenderState::depthFar const): >+ (WebCore::XRRenderState::inlineVerticalFieldOfView const): >+ (WebCore::XRRenderState::baseLayer const): >+ * Modules/webxr/XRRenderState.h: Added. >+ * Modules/webxr/XRRenderState.idl: Added. >+ * Modules/webxr/XRRenderStateInit.h: Added. >+ * Modules/webxr/XRRenderStateInit.idl: Added. >+ * Modules/webxr/XRRigidTransform.cpp: Added. >+ (WebCore::XRRigidTransform::create): >+ (WebCore::XRRigidTransform::XRRigidTransform): >+ (WebCore::XRRigidTransform::position const): >+ (WebCore::XRRigidTransform::orientation const): >+ (WebCore::XRRigidTransform::matrix const): >+ (WebCore::XRRigidTransform::inverse const): >+ * Modules/webxr/XRRigidTransform.h: Added. >+ * Modules/webxr/XRRigidTransform.idl: Added. >+ * Modules/webxr/XRSession.cpp: Added. >+ (WebCore::XRSession::environmentBlendMode const): >+ (WebCore::XRSession::visibilityState const): >+ (WebCore::XRSession::renderState const): >+ (WebCore::XRSession::inputSources const): >+ (WebCore::XRSession::updateRenderState): >+ (WebCore::XRSession::requestReferenceSpace): >+ (WebCore::XRSession::requestAnimationFrame): >+ (WebCore::XRSession::cancelAnimationFrame): >+ (WebCore::XRSession::end): >+ (WebCore::XRSession::activeDOMObjectName const): >+ (WebCore::XRSession::stop): >+ * Modules/webxr/XRSession.h: Added. >+ * Modules/webxr/XRSession.idl: Added. >+ * Modules/webxr/XRSessionEvent.cpp: Added. >+ (WebCore::XRSessionEvent::create): >+ (WebCore::XRSessionEvent::XRSessionEvent): >+ (WebCore::XRSessionEvent::session const): >+ * Modules/webxr/XRSessionEvent.h: Added. >+ * Modules/webxr/XRSessionEvent.idl: Added. >+ * Modules/webxr/XRSessionInit.h: Added. >+ * Modules/webxr/XRSessionInit.idl: Added. >+ * Modules/webxr/XRSessionMode.h: Added. >+ * Modules/webxr/XRSessionMode.idl: Added. >+ * Modules/webxr/XRSpace.cpp: Added. >+ (WebCore::XRSpace::XRSpace): >+ * Modules/webxr/XRSpace.h: Added. >+ * Modules/webxr/XRSpace.idl: Added. >+ * Modules/webxr/XRSystem.cpp: Added. >+ (WebCore::XRSystem::create): >+ (WebCore::XRSystem::XRSystem): >+ (WebCore::XRSystem::isSessionSupported): >+ (WebCore::XRSystem::requestSession): >+ (WebCore::XRSystem::activeDOMObjectName const): >+ (WebCore::XRSystem::stop): >+ * Modules/webxr/XRSystem.h: Added. >+ * Modules/webxr/XRSystem.idl: Added. >+ * Modules/webxr/XRTargetRayMode.h: Added. >+ * Modules/webxr/XRTargetRayMode.idl: Added. >+ * Modules/webxr/XRView.cpp: Added. >+ (WebCore::XRView::create): >+ (WebCore::XRView::XRView): >+ (WebCore::XRView::eye const): >+ (WebCore::XRView::projectionMatrix const): >+ (WebCore::XRView::transform const): >+ * Modules/webxr/XRView.h: Added. >+ * Modules/webxr/XRView.idl: Added. >+ * Modules/webxr/XRViewerPose.cpp: Added. >+ (WebCore::XRViewerPose::create): >+ (WebCore::XRViewerPose::views const): >+ * Modules/webxr/XRViewerPose.h: Added. >+ * Modules/webxr/XRViewerPose.idl: Added. >+ * Modules/webxr/XRViewport.cpp: Added. >+ (WebCore::XRViewport::create): >+ (WebCore::XRViewport::x const): >+ (WebCore::XRViewport::y const): >+ (WebCore::XRViewport::width const): >+ (WebCore::XRViewport::height const): >+ * Modules/webxr/XRViewport.h: Added. >+ * Modules/webxr/XRViewport.idl: Added. >+ * Modules/webxr/XRVisibilityState.h: Added. >+ * Modules/webxr/XRVisibilityState.idl: Added. >+ * Modules/webxr/XRWebGLLayer.cpp: Added. >+ (WebCore::XRWebGLLayer::create): >+ (WebCore::XRWebGLLayer::XRWebGLLayer): >+ (WebCore::XRWebGLLayer::antialias const): >+ (WebCore::XRWebGLLayer::ignoreDepthValues const): >+ (WebCore::XRWebGLLayer::framebuffer const): >+ (WebCore::XRWebGLLayer::framebufferWidth const): >+ (WebCore::XRWebGLLayer::framebufferHeight const): >+ (WebCore::XRWebGLLayer::getViewport): >+ (WebCore::XRWebGLLayer::getNativeFramebufferScaleFactor): >+ * Modules/webxr/XRWebGLLayer.h: Added. >+ * Modules/webxr/XRWebGLLayer.idl: Added. >+ * Modules/webxr/XRWebGLLayerInit.h: Added. >+ * Modules/webxr/XRWebGLLayerInit.idl: Added. >+ * PlatformWPE.cmake: Add OpenXR includes and libs. >+ * Sources.txt: >+ * WebCore.xcodeproj/project.pbxproj: >+ * bindings/IDLTypes.h: >+ * bindings/js/JSDOMConvertSequences.h: >+ * bindings/js/WebCoreBuiltinNames.h: >+ * dom/EventNames.h: >+ * dom/EventNames.in: >+ * dom/EventTargetFactory.in: >+ * page/RuntimeEnabledFeatures.h: Added WebXR feature. >+ (WebCore::RuntimeEnabledFeatures::setWebXREnabled): >+ (WebCore::RuntimeEnabledFeatures::webXREnabled const): >+ * platform/xr/PlatformXR.cpp: Added. >+ * platform/xr/PlatformXR.h: Added. >+ * platform/xr/openxr/PlatformXR.cpp: Added. >+ (PlatformXR::createStructure): >+ (PlatformXR::resultToString): >+ (PlatformXR::Instance::Impl::Impl): >+ (PlatformXR::Instance::Impl::~Impl): >+ (PlatformXR::Instance::singleton): >+ > 2020-03-04 Carlos Garcia Campos <cgarcia@igalia.com> > > [GTK][WPE] Use restore view icon for exit fullscreen button in media controls >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 7f4977f372706d330aaef1c3933500ac40642925..bce2b84ff9179a19b21bab10208eace0e2c56544 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,14 @@ >+2020-03-06 Sergio Villar Senin <svillar@igalia.com> >+ >+ [WebXR] IDLs, stubs and build configuration for WPE >+ https://bugs.webkit.org/show_bug.cgi?id=208702 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Largely based on previous work by Žan DoberÅ¡ek. >+ >+ * Shared/WebPreferences.yaml: Added info about the WebXR implementation status. >+ > 2020-03-03 Devin Rousso <drousso@apple.com> > > Web Inspector: re-add `InspectorFrontendHost` support for moving the inspected window >diff --git a/Source/WTF/wtf/Platform.h b/Source/WTF/wtf/Platform.h >index dedfa14d5a5ddda84e335bfd485e755097faec57..daa7d363a54e22432db49e781c83113725adc30e 100644 >--- a/Source/WTF/wtf/Platform.h >+++ b/Source/WTF/wtf/Platform.h >@@ -180,6 +180,10 @@ > #if (USE_ANGLE && (USE_OPENGL || USE_OPENGL_ES || (defined(USE_EGL) && USE_EGL))) && !USE(TEXTURE_MAPPER) > #error USE_ANGLE is incompatible with USE_OPENGL, USE_OPENGL_ES and USE_EGL > #endif >+ >+#if !defined(USE_OPENXR) >+#define USE_OPENXR 0 >+#endif > #endif > > #if USE(TEXTURE_MAPPER) && ENABLE(GRAPHICS_CONTEXT_GL) && !defined(USE_TEXTURE_MAPPER_GL) >diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt >index 37cb1bee49c7e955a7124d1e2d6ae9cd155c079b..a926f2b7472d96c125369050987e07e0e2629d71 100644 >--- a/Source/WebCore/CMakeLists.txt >+++ b/Source/WebCore/CMakeLists.txt >@@ -1179,6 +1179,47 @@ if (ENABLE_GAMEPAD) > ) > endif () > >+if (ENABLE_WEBGL) >+ list(APPEND WebCore_PRIVATE_INCLUDE_DIRECTORIES >+ "${WEBCORE_DIR}/Modules/webxr" >+ "${WEBCORE_DIR}/platform/xr" >+ ) >+ >+ list(APPEND WebCore_NON_SVG_IDL_FILES >+ Modules/webxr/NavigatorWebXR.idl >+ Modules/webxr/XRBoundedReferenceSpace.idl >+ Modules/webxr/XREnvironmentBlendMode.idl >+ Modules/webxr/XREye.idl >+ Modules/webxr/XRFrame.idl >+ Modules/webxr/XRFrameRequestCallback.idl >+ Modules/webxr/XRHandedness.idl >+ Modules/webxr/XRInputSource.idl >+ Modules/webxr/XRInputSourceArray.idl >+ Modules/webxr/XRInputSourceEvent.idl >+ Modules/webxr/XRInputSourcesChangeEvent.idl >+ Modules/webxr/XRPose.idl >+ Modules/webxr/XRReferenceSpace.idl >+ Modules/webxr/XRReferenceSpaceEvent.idl >+ Modules/webxr/XRReferenceSpaceType.idl >+ Modules/webxr/XRRenderState.idl >+ Modules/webxr/XRRenderStateInit.idl >+ Modules/webxr/XRRigidTransform.idl >+ Modules/webxr/XRSession.idl >+ Modules/webxr/XRSessionEvent.idl >+ Modules/webxr/XRSessionInit.idl >+ Modules/webxr/XRSessionMode.idl >+ Modules/webxr/XRSpace.idl >+ Modules/webxr/XRSystem.idl >+ Modules/webxr/XRTargetRayMode.idl >+ Modules/webxr/XRView.idl >+ Modules/webxr/XRViewerPose.idl >+ Modules/webxr/XRViewport.idl >+ Modules/webxr/XRVisibilityState.idl >+ Modules/webxr/XRWebGLLayer.idl >+ Modules/webxr/XRWebGLLayerInit.idl >+ ) >+endif () >+ > set(WebCore_IDL_FILES > ${WebCore_NON_SVG_IDL_FILES} > ${WebCore_SVG_IDL_FILES} >diff --git a/Source/WebCore/DerivedSources.make b/Source/WebCore/DerivedSources.make >index 5ba26b8082de68901c2e12662f6474a867072423..f956715c56d2cc7345b81299dea3d2ce51e41a39 100644 >--- a/Source/WebCore/DerivedSources.make >+++ b/Source/WebCore/DerivedSources.make >@@ -64,6 +64,7 @@ VPATH = \ > $(WebCore)/Modules/webdriver \ > $(WebCore)/Modules/webgpu \ > $(WebCore)/Modules/websockets \ >+ $(WebCore)/Modules/webxr \ > $(WebCore)/accessibility \ > $(WebCore)/animation \ > $(WebCore)/bindings/js \ >@@ -460,6 +461,37 @@ JS_BINDING_IDLS = \ > $(WebCore)/Modules/webgpu/WorkerNavigatorGPU.idl \ > $(WebCore)/Modules/websockets/CloseEvent.idl \ > $(WebCore)/Modules/websockets/WebSocket.idl \ >+ $(WebCore)/Modules/webxr/NavigatorWebXR.idl \ >+ $(WebCore)/Modules/webxr/XRBoundedReferenceSpace.idl \ >+ $(WebCore)/Modules/webxr/XREnvironmentBlendMode.idl \ >+ $(WebCore)/Modules/webxr/XREye.idl \ >+ $(WebCore)/Modules/webxr/XRFrame.idl \ >+ $(WebCore)/Modules/webxr/XRFrameRequestCallback.idl \ >+ $(WebCore)/Modules/webxr/XRHandedness.idl \ >+ $(WebCore)/Modules/webxr/XRInputSource.idl \ >+ $(WebCore)/Modules/webxr/XRInputSourceArray.idl \ >+ $(WebCore)/Modules/webxr/XRInputSourceEvent.idl \ >+ $(WebCore)/Modules/webxr/XRInputSourcesChangeEvent.idl \ >+ $(WebCore)/Modules/webxr/XRPose.idl \ >+ $(WebCore)/Modules/webxr/XRReferenceSpace.idl \ >+ $(WebCore)/Modules/webxr/XRReferenceSpaceEvent.idl \ >+ $(WebCore)/Modules/webxr/XRReferenceSpaceType.idl \ >+ $(WebCore)/Modules/webxr/XRRenderState.idl \ >+ $(WebCore)/Modules/webxr/XRRenderStateInit.idl \ >+ $(WebCore)/Modules/webxr/XRRigidTransform.idl \ >+ $(WebCore)/Modules/webxr/XRSession.idl \ >+ $(WebCore)/Modules/webxr/XRSessionEvent.idl \ >+ $(WebCore)/Modules/webxr/XRSessionInit.idl \ >+ $(WebCore)/Modules/webxr/XRSessionMode.idl \ >+ $(WebCore)/Modules/webxr/XRSpace.idl \ >+ $(WebCore)/Modules/webxr/XRSystem.idl \ >+ $(WebCore)/Modules/webxr/XRTargetRayMode.idl \ >+ $(WebCore)/Modules/webxr/XRView.idl \ >+ $(WebCore)/Modules/webxr/XRViewerPose.idl \ >+ $(WebCore)/Modules/webxr/XRViewport.idl \ >+ $(WebCore)/Modules/webxr/XRVisibilityState.idl \ >+ $(WebCore)/Modules/webxr/XRWebGLLayer.idl \ >+ $(WebCore)/Modules/webxr/XRWebGLLayerInit.idl \ > $(WebCore)/accessibility/AccessibilityRole.idl \ > $(WebCore)/accessibility/AriaAttributes.idl \ > $(WebCore)/animation/Animatable.idl \ >diff --git a/Source/WebCore/Modules/webxr/NavigatorWebXR.cpp b/Source/WebCore/Modules/webxr/NavigatorWebXR.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..d3fa2b8269ea4ee5da646b8957f55a1e4fde92e3 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/NavigatorWebXR.cpp >@@ -0,0 +1,53 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "NavigatorWebXR.h" >+ >+#include "Navigator.h" >+#include "XRSystem.h" >+ >+namespace WebCore { >+ >+XRSystem& NavigatorWebXR::xr(ScriptExecutionContext& scriptExecutionContext, Navigator& navigatorObject) >+{ >+ auto& navigator = NavigatorWebXR::from(navigatorObject); >+ if (!navigator.m_xr) >+ navigator.m_xr = XRSystem::create(scriptExecutionContext); >+ return *navigator.m_xr; >+} >+ >+NavigatorWebXR& NavigatorWebXR::from(Navigator& navigator) >+{ >+ auto* supplement = static_cast<NavigatorWebXR*>(Supplement<Navigator>::from(&navigator, "NavigatorWebXR")); >+ if (!supplement) { >+ auto newSupplement = makeUnique<NavigatorWebXR>(); >+ supplement = newSupplement.get(); >+ provideTo(&navigator, "NavigatorWebXR", WTFMove(newSupplement)); >+ } >+ return *supplement; >+} >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/NavigatorWebXR.h b/Source/WebCore/Modules/webxr/NavigatorWebXR.h >new file mode 100644 >index 0000000000000000000000000000000000000000..b6c0f98e4981032eb26da311a1ecc48357f39cf4 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/NavigatorWebXR.h >@@ -0,0 +1,48 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include "Supplementable.h" >+#include <wtf/RefPtr.h> >+ >+namespace WebCore { >+ >+class Navigator; >+class ScriptExecutionContext; >+class XRSystem; >+ >+class NavigatorWebXR final : public Supplement<Navigator> { >+ WTF_MAKE_FAST_ALLOCATED; >+public: >+ static XRSystem& xr(ScriptExecutionContext&, Navigator&); >+ >+private: >+ static NavigatorWebXR& from(Navigator&); >+ >+ RefPtr<XRSystem> m_xr; >+}; >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/NavigatorWebXR.idl b/Source/WebCore/Modules/webxr/NavigatorWebXR.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..853ecf9594d2c4f4069329c93ebf46ba5ffe6ca5 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/NavigatorWebXR.idl >@@ -0,0 +1,31 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+[ >+ EnabledAtRuntime=WebXR, >+ Conditional=WEBGL >+] partial interface Navigator { >+ [SecureContext, SameObject, CallWith=ScriptExecutionContext] readonly attribute XRSystem xr; >+}; >diff --git a/Source/WebCore/Modules/webxr/XRBoundedReferenceSpace.cpp b/Source/WebCore/Modules/webxr/XRBoundedReferenceSpace.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..35307bf7793a1eb2ef4266db2799ad38e4936edb >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRBoundedReferenceSpace.cpp >@@ -0,0 +1,36 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "XRBoundedReferenceSpace.h" >+ >+namespace WebCore { >+ >+const Vector<Ref<DOMPointReadOnly>>& XRBoundedReferenceSpace::boundsGeometry() const >+{ >+ return m_boundsGeometry; >+} >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRBoundedReferenceSpace.h b/Source/WebCore/Modules/webxr/XRBoundedReferenceSpace.h >new file mode 100644 >index 0000000000000000000000000000000000000000..7b5c8e95ddd5c399455265182c00c63c113519db >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRBoundedReferenceSpace.h >@@ -0,0 +1,46 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include "XRReferenceSpace.h" >+#include <wtf/Ref.h> >+#include <wtf/Vector.h> >+ >+namespace WebCore { >+ >+class DOMPointReadOnly; >+ >+class XRBoundedReferenceSpace : public XRReferenceSpace { >+public: >+ virtual ~XRBoundedReferenceSpace(); >+ >+ const Vector<Ref<DOMPointReadOnly>>& boundsGeometry() const; >+ >+private: >+ Vector<Ref<DOMPointReadOnly>> m_boundsGeometry; >+}; >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRBoundedReferenceSpace.idl b/Source/WebCore/Modules/webxr/XRBoundedReferenceSpace.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..6c764c967c421d145dc48e5d3532d0de590663b6 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRBoundedReferenceSpace.idl >@@ -0,0 +1,33 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+[ >+ EnabledAtRuntime=WebXR, >+ Conditional=WEBGL, >+ SecureContext, >+ Exposed=Window >+] interface XRBoundedReferenceSpace : XRReferenceSpace { >+ readonly attribute FrozenArray<DOMPointReadOnly> boundsGeometry; >+}; >diff --git a/Source/WebCore/Modules/webxr/XREnvironmentBlendMode.h b/Source/WebCore/Modules/webxr/XREnvironmentBlendMode.h >new file mode 100644 >index 0000000000000000000000000000000000000000..fefac1ec80b02214f99aa2f2a790b55979cb9ae6 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XREnvironmentBlendMode.h >@@ -0,0 +1,36 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+namespace WebCore { >+ >+enum class XREnvironmentBlendMode { >+ Opaque, >+ Additive, >+ AlphaBlend >+}; >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XREnvironmentBlendMode.idl b/Source/WebCore/Modules/webxr/XREnvironmentBlendMode.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..949513ccc3a5f44c28057157a9aa5498eba041c6 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XREnvironmentBlendMode.idl >@@ -0,0 +1,33 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+[ >+ EnabledAtRuntime=WebXR, >+ Conditional=WEBGL >+] enum XREnvironmentBlendMode { >+ "opaque", >+ "additive", >+ "alpha-blend" >+}; >diff --git a/Source/WebCore/Modules/webxr/XREye.h b/Source/WebCore/Modules/webxr/XREye.h >new file mode 100644 >index 0000000000000000000000000000000000000000..01e70e54443564261d379c930b9d599d9212bf32 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XREye.h >@@ -0,0 +1,36 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+namespace WebCore { >+ >+enum class XREye { >+ None, >+ Left, >+ Right, >+}; >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XREye.idl b/Source/WebCore/Modules/webxr/XREye.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..c269a0f51204d8826b999dda1f021483542bb1fa >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XREye.idl >@@ -0,0 +1,33 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+[ >+ EnabledAtRuntime=WebXR, >+ Conditional=WEBGL >+] enum XREye { >+ "none", >+ "left", >+ "right" >+}; >diff --git a/Source/WebCore/Modules/webxr/XRFrame.cpp b/Source/WebCore/Modules/webxr/XRFrame.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..3c504ad1c9763dabd3e5868d30329848a7d411ac >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRFrame.cpp >@@ -0,0 +1,64 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "XRFrame.h" >+ >+#include "XRSession.h" >+#include "XRViewerPose.h" >+#include <wtf/IsoMallocInlines.h> >+ >+namespace WebCore { >+ >+WTF_MAKE_ISO_ALLOCATED_IMPL(XRFrame); >+ >+Ref<XRFrame> XRFrame::create(Ref<XRSession>&& session) >+{ >+ return adoptRef(*new XRFrame(WTFMove(session))); >+} >+ >+XRFrame::XRFrame(Ref<XRSession>&& session) >+ : m_session(WTFMove(session)) >+{ >+} >+ >+XRFrame::~XRFrame() = default; >+ >+const XRSession& XRFrame::session() const >+{ >+ return m_session; >+} >+ >+RefPtr<XRViewerPose> XRFrame::getViewerPose(const XRReferenceSpace&) >+{ >+ return { }; >+} >+ >+RefPtr<XRPose> XRFrame::getPose(const XRSpace&, const XRSpace&) >+{ >+ return { }; >+} >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRFrame.h b/Source/WebCore/Modules/webxr/XRFrame.h >new file mode 100644 >index 0000000000000000000000000000000000000000..f29ba505263d53e98c50368b445e4fec93753c48 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRFrame.h >@@ -0,0 +1,58 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include <wtf/IsoMalloc.h> >+#include <wtf/Ref.h> >+#include <wtf/RefCounted.h> >+#include <wtf/RefPtr.h> >+ >+namespace WebCore { >+ >+class XRPose; >+class XRReferenceSpace; >+class XRSession; >+class XRSpace; >+class XRViewerPose; >+ >+class XRFrame : public RefCounted<XRFrame> { >+ WTF_MAKE_ISO_ALLOCATED(XRFrame); >+public: >+ static Ref<XRFrame> create(Ref<XRSession>&&); >+ ~XRFrame(); >+ >+ const XRSession& session() const; >+ >+ RefPtr<XRViewerPose> getViewerPose(const XRReferenceSpace&); >+ RefPtr<XRPose> getPose(const XRSpace&, const XRSpace&); >+ >+private: >+ XRFrame(Ref<XRSession>&&); >+ >+ Ref<XRSession> m_session; >+}; >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRFrame.idl b/Source/WebCore/Modules/webxr/XRFrame.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..92610dece888279851e02743c1712293770f3d5e >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRFrame.idl >@@ -0,0 +1,37 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+[ >+ EnabledAtRuntime=WebXR, >+ Conditional=WEBGL, >+ SecureContext, >+ Exposed=Window, >+ ImplementationLacksVTable >+] interface XRFrame { >+ [SameObject] readonly attribute XRSession session; >+ >+ XRViewerPose? getViewerPose(XRReferenceSpace referenceSpace); >+ XRPose? getPose(XRSpace space, XRSpace baseSpace); >+}; >diff --git a/Source/WebCore/Modules/webxr/XRFrameRequestCallback.h b/Source/WebCore/Modules/webxr/XRFrameRequestCallback.h >new file mode 100644 >index 0000000000000000000000000000000000000000..9958fdc2043781fa6f9978bc2bd7dec8420eb47f >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRFrameRequestCallback.h >@@ -0,0 +1,43 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include "ActiveDOMCallback.h" >+#include "CallbackResult.h" >+#include <wtf/RefCounted.h> >+ >+namespace WebCore { >+ >+class XRFrame; >+ >+class XRFrameRequestCallback : public RefCounted<XRFrameRequestCallback>, public ActiveDOMCallback { >+public: >+ using ActiveDOMCallback::ActiveDOMCallback; >+ >+ virtual CallbackResult<void> handleEvent(double highResTimeMs, XRFrame&) = 0; >+}; >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRFrameRequestCallback.idl b/Source/WebCore/Modules/webxr/XRFrameRequestCallback.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..d11d4bd2c586b1056a37d122c64fed19809ae505 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRFrameRequestCallback.idl >@@ -0,0 +1,28 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+typedef double DOMHighResTimeStamp; >+ >+callback XRFrameRequestCallback = void (DOMHighResTimeStamp time, XRFrame frame); >diff --git a/Source/WebCore/Modules/webxr/XRHandedness.h b/Source/WebCore/Modules/webxr/XRHandedness.h >new file mode 100644 >index 0000000000000000000000000000000000000000..e27aa39b3de2f7f86295ae93a81f4731dc9cd74b >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRHandedness.h >@@ -0,0 +1,36 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+namespace WebCore { >+ >+enum class XRHandedness { >+ None, >+ Left, >+ Right, >+}; >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRHandedness.idl b/Source/WebCore/Modules/webxr/XRHandedness.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..94fcb56d0f8728b5614dcc2e0291d270af28f15f >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRHandedness.idl >@@ -0,0 +1,33 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+[ >+ EnabledAtRuntime=WebXR, >+ Conditional=WEBGL >+] enum XRHandedness { >+ "none", >+ "left", >+ "right" >+}; >diff --git a/Source/WebCore/Modules/webxr/XRInputSource.cpp b/Source/WebCore/Modules/webxr/XRInputSource.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..62bb422b785ad32ac41e11c9b87c37d7fae8f9b3 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRInputSource.cpp >@@ -0,0 +1,75 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "XRInputSource.h" >+ >+#include "XRSpace.h" >+#include <wtf/IsoMallocInlines.h> >+ >+namespace WebCore { >+ >+WTF_MAKE_ISO_ALLOCATED_IMPL(XRInputSource); >+ >+Ref<XRInputSource> XRInputSource::create(Ref<XRSpace>&& targetRaySpace) >+{ >+ return adoptRef(*new XRInputSource(WTFMove(targetRaySpace))); >+} >+ >+XRInputSource::XRInputSource(Ref<XRSpace>&& targetRaySpace) >+ : m_handedness(XRHandedness::None) >+ , m_targetRayMode(XRTargetRayMode::Gaze) >+ , m_targetRaySpace(WTFMove(targetRaySpace)) >+{ >+} >+ >+XRInputSource::~XRInputSource() = default; >+ >+XRHandedness XRInputSource::handedness() const >+{ >+ return m_handedness; >+} >+ >+XRTargetRayMode XRInputSource::targetRayMode() const >+{ >+ return m_targetRayMode; >+} >+ >+const XRSpace& XRInputSource::targetRaySpace() const >+{ >+ return m_targetRaySpace; >+} >+ >+RefPtr<XRSpace> XRInputSource::gripSpace() const >+{ >+ return { }; >+} >+ >+const Vector<String>& XRInputSource::profiles() const >+{ >+ return m_profiles; >+} >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRInputSource.h b/Source/WebCore/Modules/webxr/XRInputSource.h >new file mode 100644 >index 0000000000000000000000000000000000000000..1187f7039ae5d33f6b9056d447b7bf596303a6ae >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRInputSource.h >@@ -0,0 +1,62 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include "XRHandedness.h" >+#include "XRTargetRayMode.h" >+#include <wtf/IsoMalloc.h> >+#include <wtf/Ref.h> >+#include <wtf/RefCounted.h> >+#include <wtf/RefPtr.h> >+#include <wtf/Vector.h> >+#include <wtf/text/WTFString.h> >+ >+namespace WebCore { >+ >+class XRSpace; >+ >+class XRInputSource : public RefCounted<XRInputSource> { >+ WTF_MAKE_ISO_ALLOCATED(XRInputSource); >+public: >+ static Ref<XRInputSource> create(Ref<XRSpace>&&); >+ ~XRInputSource(); >+ >+ XRHandedness handedness() const; >+ XRTargetRayMode targetRayMode() const; >+ const XRSpace& targetRaySpace() const; >+ RefPtr<XRSpace> gripSpace() const; >+ const Vector<String>& profiles() const; >+ >+private: >+ XRInputSource(Ref<XRSpace>&&); >+ >+ XRHandedness m_handedness; >+ XRTargetRayMode m_targetRayMode; >+ Ref<XRSpace> m_targetRaySpace; >+ Vector<String> m_profiles; >+}; >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRInputSource.idl b/Source/WebCore/Modules/webxr/XRInputSource.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..e6b4069f0cb4205d5086cb51613a48143496168b >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRInputSource.idl >@@ -0,0 +1,38 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+[ >+ EnabledAtRuntime=WebXR, >+ Conditional=WEBGL, >+ SecureContext, >+ Exposed=Window, >+ ImplementationLacksVTable >+] interface XRInputSource { >+ readonly attribute XRHandedness handedness; >+ readonly attribute XRTargetRayMode targetRayMode ; >+ [SameObject] readonly attribute XRSpace targetRaySpace; >+ [SameObject] readonly attribute XRSpace? gripSpace ; >+ [SameObject] readonly attribute FrozenArray<DOMString> profiles; >+}; >diff --git a/Source/WebCore/Modules/webxr/XRInputSourceArray.cpp b/Source/WebCore/Modules/webxr/XRInputSourceArray.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..7fd4c465daa3f73de64f41abd28a987cd64e0e80 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRInputSourceArray.cpp >@@ -0,0 +1,45 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "XRInputSourceArray.h" >+ >+#include <wtf/IsoMallocInlines.h> >+ >+namespace WebCore { >+ >+WTF_MAKE_ISO_ALLOCATED_IMPL(XRInputSourceArray); >+ >+unsigned XRInputSourceArray::length() const >+{ >+ return 0; >+} >+ >+XRInputSource* XRInputSourceArray::item(unsigned) const >+{ >+ return nullptr; >+} >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRInputSourceArray.h b/Source/WebCore/Modules/webxr/XRInputSourceArray.h >new file mode 100644 >index 0000000000000000000000000000000000000000..95521b55fd159297590b64714e4c1f8c5056d7fc >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRInputSourceArray.h >@@ -0,0 +1,42 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include <wtf/IsoMalloc.h> >+#include <wtf/RefCounted.h> >+ >+namespace WebCore { >+ >+class XRInputSource; >+ >+class XRInputSourceArray : public RefCounted<XRInputSourceArray> { >+ WTF_MAKE_ISO_ALLOCATED(XRInputSourceArray); >+public: >+ unsigned length() const; >+ XRInputSource* item(unsigned) const; >+}; >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRInputSourceArray.idl b/Source/WebCore/Modules/webxr/XRInputSourceArray.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..f078034a6698a44e3f34d7187b7e1ccd1b5b7d83 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRInputSourceArray.idl >@@ -0,0 +1,36 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+[ >+ EnabledAtRuntime=WebXR, >+ Conditional=WEBGL, >+ SecureContext, >+ Exposed=Window, >+ ImplementationLacksVTable >+] interface XRInputSourceArray { >+ iterable<XRInputSource>; >+ readonly attribute unsigned long length; >+ getter XRInputSource(unsigned long index); >+}; >diff --git a/Source/WebCore/Modules/webxr/XRInputSourceEvent.cpp b/Source/WebCore/Modules/webxr/XRInputSourceEvent.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..ea47690bf33dd3122bca4cc8d79610c132c4ed32 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRInputSourceEvent.cpp >@@ -0,0 +1,66 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "XRInputSourceEvent.h" >+ >+#include "XRFrame.h" >+#include "XRInputSource.h" >+ >+namespace WebCore { >+ >+Ref<XRInputSourceEvent> XRInputSourceEvent::create(const AtomString& type, const Init& initializer, IsTrusted isTrusted) >+{ >+ return adoptRef(*new XRInputSourceEvent(type, initializer, isTrusted)); >+} >+ >+XRInputSourceEvent::XRInputSourceEvent(const AtomString& type, const Init& initializer, IsTrusted isTrusted) >+ : Event(type, initializer, isTrusted) >+ , m_frame(initializer.frame) >+ , m_inputSource(initializer.inputSource) >+ , m_buttonIndex(initializer.buttonIndex) >+{ >+ ASSERT(m_frame); >+ ASSERT(m_inputSource); >+} >+ >+XRInputSourceEvent::~XRInputSourceEvent() = default; >+ >+const XRFrame& XRInputSourceEvent::frame() const >+{ >+ return *m_frame; >+} >+ >+const XRInputSource& XRInputSourceEvent::inputSource() const >+{ >+ return *m_inputSource; >+} >+ >+Optional<int> XRInputSourceEvent::buttonIndex() const >+{ >+ return m_buttonIndex; >+} >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRInputSourceEvent.h b/Source/WebCore/Modules/webxr/XRInputSourceEvent.h >new file mode 100644 >index 0000000000000000000000000000000000000000..43dc7c0e3c49105d4bd295a6066e6a735f0b5f15 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRInputSourceEvent.h >@@ -0,0 +1,60 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include "Event.h" >+#include <wtf/Optional.h> >+#include <wtf/RefPtr.h> >+ >+namespace WebCore { >+ >+class XRFrame; >+class XRInputSource; >+ >+class XRInputSourceEvent final : public Event { >+public: >+ struct Init : EventInit { >+ RefPtr<XRFrame> frame; >+ RefPtr<XRInputSource> inputSource; >+ Optional<int> buttonIndex; >+ }; >+ >+ static Ref<XRInputSourceEvent> create(const AtomString&, const Init&, IsTrusted = IsTrusted::No); >+ virtual ~XRInputSourceEvent(); >+ >+ const XRFrame& frame() const; >+ const XRInputSource& inputSource() const; >+ Optional<int> buttonIndex() const; >+ >+private: >+ XRInputSourceEvent(const AtomString&, const Init&, IsTrusted); >+ >+ RefPtr<XRFrame> m_frame; >+ RefPtr<XRInputSource> m_inputSource; >+ Optional<int> m_buttonIndex; >+}; >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRInputSourceEvent.idl b/Source/WebCore/Modules/webxr/XRInputSourceEvent.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..29bac6c8a172fef2b62f91bcab823be8bf96911d >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRInputSourceEvent.idl >@@ -0,0 +1,43 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+[ >+ EnabledAtRuntime=WebXR, >+ Conditional=WEBGL >+] dictionary XRInputSourceEventInit : EventInit { >+ required XRFrame frame; >+ required XRInputSource inputSource; >+}; >+ >+[ >+ EnabledAtRuntime=WebXR, >+ Conditional=WEBGL, >+ SecureContext, >+ Exposed=Window, >+ Constructor(DOMString type, XRInputSourceEventInit eventInitDict) >+] interface XRInputSourceEvent : Event { >+ [SameObject] readonly attribute XRFrame frame; >+ [SameObject] readonly attribute XRInputSource inputSource; >+}; >diff --git a/Source/WebCore/Modules/webxr/XRInputSourcesChangeEvent.cpp b/Source/WebCore/Modules/webxr/XRInputSourcesChangeEvent.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..b9542ce132e56b5e0f44d5a4e2342b7590eee9c5 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRInputSourcesChangeEvent.cpp >@@ -0,0 +1,64 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "XRInputSourcesChangeEvent.h" >+ >+#include "XRInputSource.h" >+#include "XRSession.h" >+ >+namespace WebCore { >+ >+Ref<XRInputSourcesChangeEvent> XRInputSourcesChangeEvent::create(const AtomString& type, const Init& initializer, IsTrusted isTrusted) >+{ >+ return adoptRef(*new XRInputSourcesChangeEvent(type, initializer, isTrusted)); >+} >+ >+XRInputSourcesChangeEvent::XRInputSourcesChangeEvent(const AtomString& type, const Init& initializer, IsTrusted isTrusted) >+ : Event(type, initializer, isTrusted) >+ , m_session(*initializer.session) >+ , m_added(initializer.added) >+ , m_removed(initializer.removed) >+{ >+} >+ >+XRInputSourcesChangeEvent::~XRInputSourcesChangeEvent() = default; >+ >+const XRSession& XRInputSourcesChangeEvent::session() const >+{ >+ return m_session; >+} >+ >+const Vector<RefPtr<XRInputSource>>& XRInputSourcesChangeEvent::added() const >+{ >+ return m_added; >+} >+ >+const Vector<RefPtr<XRInputSource>>& XRInputSourcesChangeEvent::removed() const >+{ >+ return m_removed; >+} >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRInputSourcesChangeEvent.h b/Source/WebCore/Modules/webxr/XRInputSourcesChangeEvent.h >new file mode 100644 >index 0000000000000000000000000000000000000000..b192f2402587c1afa6ac2d71e33d355e7ceb4dd5 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRInputSourcesChangeEvent.h >@@ -0,0 +1,60 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include "Event.h" >+#include <wtf/Ref.h> >+#include <wtf/Vector.h> >+ >+namespace WebCore { >+ >+class XRInputSource; >+class XRSession; >+ >+class XRInputSourcesChangeEvent final : public Event { >+public: >+ struct Init : EventInit { >+ RefPtr<XRSession> session; >+ Vector<RefPtr<XRInputSource>> added; >+ Vector<RefPtr<XRInputSource>> removed; >+ }; >+ >+ static Ref<XRInputSourcesChangeEvent> create(const AtomString&, const Init&, IsTrusted = IsTrusted::No); >+ virtual ~XRInputSourcesChangeEvent(); >+ >+ const XRSession& session() const; >+ const Vector<RefPtr<XRInputSource>>& added() const; >+ const Vector<RefPtr<XRInputSource>>& removed() const; >+ >+private: >+ XRInputSourcesChangeEvent(const AtomString&, const Init&, IsTrusted); >+ >+ Ref<XRSession> m_session; >+ Vector<RefPtr<XRInputSource>> m_added; >+ Vector<RefPtr<XRInputSource>> m_removed; >+}; >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRInputSourcesChangeEvent.idl b/Source/WebCore/Modules/webxr/XRInputSourcesChangeEvent.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..a304f0d23d3134578f6ec68a12a462a0f86f1dbe >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRInputSourcesChangeEvent.idl >@@ -0,0 +1,45 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+[ >+ EnabledAtRuntime=WebXR, >+ Conditional=WEBGL >+] dictionary XRInputSourcesChangeEventInit : EventInit { >+ required XRSession session; >+ required FrozenArray<XRInputSource> added; >+ required FrozenArray<XRInputSource> removed; >+}; >+ >+[ >+ EnabledAtRuntime=WebXR, >+ Conditional=WEBGL, >+ SecureContext, >+ Exposed=Window, >+ Constructor(DOMString type, XRInputSourcesChangeEventInit eventInitDict) >+] interface XRInputSourcesChangeEvent : Event { >+ [SameObject] readonly attribute XRSession session; >+ [SameObject] readonly attribute FrozenArray<XRInputSource> added; >+ [SameObject] readonly attribute FrozenArray<XRInputSource> removed; >+}; >diff --git a/Source/WebCore/Modules/webxr/XRPose.cpp b/Source/WebCore/Modules/webxr/XRPose.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..090354e6dc57f96459407754b90de5e208f8ec02 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRPose.cpp >@@ -0,0 +1,58 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "XRPose.h" >+ >+#include "XRRigidTransform.h" >+#include <wtf/IsoMallocInlines.h> >+ >+namespace WebCore { >+ >+WTF_MAKE_ISO_ALLOCATED_IMPL(XRPose); >+ >+Ref<XRPose> XRPose::create() >+{ >+ return adoptRef(*new XRPose); >+} >+ >+XRPose::XRPose() >+ : m_transform(XRRigidTransform::create()) >+{ >+} >+ >+XRPose::~XRPose() = default; >+ >+const XRRigidTransform& XRPose::transform() const >+{ >+ return m_transform; >+} >+ >+bool XRPose::emulatedPosition() const >+{ >+ return m_emulatedPosition; >+} >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRPose.h b/Source/WebCore/Modules/webxr/XRPose.h >new file mode 100644 >index 0000000000000000000000000000000000000000..b14819ce24da92366a659be24cf4d7a2937927e4 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRPose.h >@@ -0,0 +1,52 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include <wtf/IsoMalloc.h> >+#include <wtf/Ref.h> >+#include <wtf/RefCounted.h> >+ >+namespace WebCore { >+ >+class XRRigidTransform; >+ >+class XRPose : public RefCounted<XRPose> { >+ WTF_MAKE_ISO_ALLOCATED(XRPose); >+public: >+ static Ref<XRPose> create(); >+ ~XRPose(); >+ >+ const XRRigidTransform& transform() const; >+ bool emulatedPosition() const; >+ >+protected: >+ XRPose(); >+ >+ Ref<XRRigidTransform> m_transform; >+ bool m_emulatedPosition { false }; >+}; >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRPose.idl b/Source/WebCore/Modules/webxr/XRPose.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..f392769b6dbabc4a796f0b19535ba933a3ad709e >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRPose.idl >@@ -0,0 +1,35 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+[ >+ EnabledAtRuntime=WebXR, >+ Conditional=WEBGL, >+ SecureContext, >+ Exposed=Window, >+ ImplementationLacksVTable >+] interface XRPose { >+ [SameObject] readonly attribute XRRigidTransform transform; >+ readonly attribute boolean emulatedPosition; >+}; >diff --git a/Source/WebCore/Modules/webxr/XRReferenceSpace.cpp b/Source/WebCore/Modules/webxr/XRReferenceSpace.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..337acbea5e897272e85b86917f2976f7767df88b >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRReferenceSpace.cpp >@@ -0,0 +1,43 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "XRReferenceSpace.h" >+ >+namespace WebCore { >+ >+XRReferenceSpace::XRReferenceSpace(ScriptExecutionContext& context) >+ : XRSpace(context) >+{ >+} >+ >+XRReferenceSpace::~XRReferenceSpace() = default; >+ >+Ref<XRReferenceSpace> XRReferenceSpace::getOffsetReferenceSpace(const XRRigidTransform&) >+{ >+ return adoptRef(*new XRReferenceSpace(*scriptExecutionContext())); >+} >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRReferenceSpace.h b/Source/WebCore/Modules/webxr/XRReferenceSpace.h >new file mode 100644 >index 0000000000000000000000000000000000000000..6fe14d483d4f580784e89b48f702f5a44a61e127 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRReferenceSpace.h >@@ -0,0 +1,46 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include "XRSpace.h" >+ >+#include <wtf/Ref.h> >+ >+namespace WebCore { >+ >+class XRRigidTransform; >+ >+class XRReferenceSpace : public XRSpace { >+public: >+ virtual ~XRReferenceSpace(); >+ >+ Ref<XRReferenceSpace> getOffsetReferenceSpace(const XRRigidTransform&); >+ >+private: >+ XRReferenceSpace(ScriptExecutionContext&); >+}; >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRReferenceSpace.idl b/Source/WebCore/Modules/webxr/XRReferenceSpace.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..2afdaecd5f1ac7517387a5423175242bb1541e21 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRReferenceSpace.idl >@@ -0,0 +1,37 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+[ >+ EnabledAtRuntime=WebXR, >+ Conditional=WEBGL, >+ SecureContext, >+ Exposed=Window, >+ JSGenerateToJSObject, >+ JSGenerateToNativeObject >+] interface XRReferenceSpace : XRSpace { >+ [NewObject] XRReferenceSpace getOffsetReferenceSpace(XRRigidTransform originOffset); >+ >+ attribute EventHandler onreset; >+}; >diff --git a/Source/WebCore/Modules/webxr/XRReferenceSpaceEvent.cpp b/Source/WebCore/Modules/webxr/XRReferenceSpaceEvent.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..8aa04a010d012a3a0bdc8e0e78be4d5bec1d4530 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRReferenceSpaceEvent.cpp >@@ -0,0 +1,60 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "XRReferenceSpaceEvent.h" >+ >+#include "XRReferenceSpace.h" >+#include "XRRigidTransform.h" >+ >+namespace WebCore { >+ >+Ref<XRReferenceSpaceEvent> XRReferenceSpaceEvent::create(const AtomString& type, const Init& initializer, IsTrusted isTrusted) >+{ >+ return adoptRef(*new XRReferenceSpaceEvent(type, initializer, isTrusted)); >+} >+ >+XRReferenceSpaceEvent::XRReferenceSpaceEvent(const AtomString& type, const Init& initializer, IsTrusted isTrusted) >+ : Event(type, initializer, isTrusted) >+ , m_referenceSpace(initializer.referenceSpace) >+ , m_transform(initializer.transform) >+{ >+ ASSERT(m_referenceSpace); >+ ASSERT(m_transform); >+} >+ >+XRReferenceSpaceEvent::~XRReferenceSpaceEvent() = default; >+ >+const XRReferenceSpace& XRReferenceSpaceEvent::referenceSpace() const >+{ >+ return *m_referenceSpace; >+} >+ >+const XRRigidTransform& XRReferenceSpaceEvent::transform() const >+{ >+ return *m_transform; >+} >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRReferenceSpaceEvent.h b/Source/WebCore/Modules/webxr/XRReferenceSpaceEvent.h >new file mode 100644 >index 0000000000000000000000000000000000000000..d98d39fd28f0d902b0865fb8108e33d5d50ccebc >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRReferenceSpaceEvent.h >@@ -0,0 +1,57 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include "Event.h" >+#include <wtf/Ref.h> >+#include <wtf/RefPtr.h> >+ >+namespace WebCore { >+ >+class XRReferenceSpace; >+class XRRigidTransform; >+ >+class XRReferenceSpaceEvent : public Event { >+public: >+ struct Init : EventInit { >+ RefPtr<XRReferenceSpace> referenceSpace; >+ RefPtr<XRRigidTransform> transform; >+ }; >+ >+ static Ref<XRReferenceSpaceEvent> create(const AtomString&, const Init&, IsTrusted = IsTrusted::No); >+ virtual ~XRReferenceSpaceEvent(); >+ >+ const XRReferenceSpace& referenceSpace() const; >+ const XRRigidTransform& transform() const; >+ >+private: >+ XRReferenceSpaceEvent(const AtomString&, const Init&, IsTrusted); >+ >+ RefPtr<XRReferenceSpace> m_referenceSpace; >+ RefPtr<XRRigidTransform> m_transform; >+}; >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRReferenceSpaceEvent.idl b/Source/WebCore/Modules/webxr/XRReferenceSpaceEvent.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..38601c477b0c5d2fe1fd55bdb8e1897f09e40833 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRReferenceSpaceEvent.idl >@@ -0,0 +1,43 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+[ >+ EnabledAtRuntime=WebXR, >+ Conditional=WEBGL >+] dictionary XRReferenceSpaceEventInit : EventInit { >+ required XRReferenceSpace referenceSpace; >+ XRRigidTransform transform; >+}; >+ >+[ >+ EnabledAtRuntime=WebXR, >+ Conditional=WEBGL, >+ SecureContext, >+ Exposed=Window, >+ Constructor(DOMString type, XRReferenceSpaceEventInit eventInitDict) >+] interface XRReferenceSpaceEvent : Event { >+ [SameObject] readonly attribute XRReferenceSpace referenceSpace; >+ [SameObject] readonly attribute XRRigidTransform transform; >+}; >diff --git a/Source/WebCore/Modules/webxr/XRReferenceSpaceType.h b/Source/WebCore/Modules/webxr/XRReferenceSpaceType.h >new file mode 100644 >index 0000000000000000000000000000000000000000..dea4f9d5e61fc374323c3f0316c5495c80d9875d >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRReferenceSpaceType.h >@@ -0,0 +1,38 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+namespace WebCore { >+ >+enum class XRReferenceSpaceType { >+ Viewer, >+ Local, >+ LocalFloor, >+ BoundedFloor, >+ Unbounded >+}; >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRReferenceSpaceType.idl b/Source/WebCore/Modules/webxr/XRReferenceSpaceType.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..85732fb16398e7f962f54c9f7a3b53ffe8d3851b >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRReferenceSpaceType.idl >@@ -0,0 +1,35 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+[ >+ EnabledAtRuntime=WebXR, >+ Conditional=WEBGL >+] enum XRReferenceSpaceType { >+ "viewer", >+ "local", >+ "local-floor", >+ "bounded-floor", >+ "unbounded" >+}; >diff --git a/Source/WebCore/Modules/webxr/XRRenderState.cpp b/Source/WebCore/Modules/webxr/XRRenderState.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..3eabffa2d267ec2b0bacbf0a34f36e0951cfe439 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRRenderState.cpp >@@ -0,0 +1,91 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "XRRenderState.h" >+ >+#include "XRRenderStateInit.h" >+#include "XRWebGLLayer.h" >+#include <wtf/IsoMallocInlines.h> >+#include <wtf/MathExtras.h> >+ >+namespace WebCore { >+ >+WTF_MAKE_ISO_ALLOCATED_IMPL(XRRenderState); >+ >+Ref<XRRenderState> XRRenderState::create(const XRSession& session) >+{ >+ // When an XRRenderState object is created for an XRSession session, the user agent MUST initialize the render state by running the following steps: >+ // 1. Let state be the newly created XRRenderState object. >+ >+ // 2. Initialize stateâs depthNear to 0.1. >+ // 3. Initialize stateâs depthFar to 1000.0. >+ // (Default-initialized in the XRRenderState class definition.) >+ >+ // 4. If session is an immersive session, initialize stateâs inlineVerticalFieldOfView to null. >+ // 5. Else initialize stateâs inlineVerticalFieldOfView to PI * 0.5. >+ // FIXME: "immersive session" support >+ UNUSED_PARAM(session); >+ Optional<double> inlineVerticalFieldOfView { piOverTwoDouble }; >+ >+ // 6. Initialize stateâs baseLayer to null. >+ // 7. Initialize stateâs outputContext to null. >+ // (Initialized to null by default.) >+ >+ return adoptRef(*new XRRenderState(WTFMove(inlineVerticalFieldOfView))); >+} >+ >+XRRenderState::XRRenderState(Optional<double>&& inlineVerticalFieldOfView) >+ : m_inlineVerticalFieldOfView(WTFMove(inlineVerticalFieldOfView)) >+{ >+} >+ >+XRRenderState::XRRenderState(const XRRenderStateInit&) >+{ >+} >+ >+XRRenderState::~XRRenderState() = default; >+ >+double XRRenderState::depthNear() const >+{ >+ return m_depth.near; >+} >+ >+double XRRenderState::depthFar() const >+{ >+ return m_depth.far; >+} >+ >+Optional<double> XRRenderState::inlineVerticalFieldOfView() const >+{ >+ return m_inlineVerticalFieldOfView; >+} >+ >+RefPtr<XRWebGLLayer> XRRenderState::baseLayer() const >+{ >+ return m_baseLayer; >+} >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRRenderState.h b/Source/WebCore/Modules/webxr/XRRenderState.h >new file mode 100644 >index 0000000000000000000000000000000000000000..9d19214f40f7c19ba4b529e3ed0b1e1fe72a7ec0 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRRenderState.h >@@ -0,0 +1,63 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include <wtf/IsoMalloc.h> >+#include <wtf/Optional.h> >+#include <wtf/Ref.h> >+#include <wtf/RefCounted.h> >+#include <wtf/RefPtr.h> >+ >+namespace WebCore { >+ >+class XRWebGLLayer; >+struct XRRenderStateInit; >+class XRSession; >+ >+class XRRenderState : public RefCounted<XRRenderState> { >+ WTF_MAKE_ISO_ALLOCATED(XRRenderState); >+public: >+ static Ref<XRRenderState> create(const XRSession&); >+ ~XRRenderState(); >+ >+ double depthNear() const; >+ double depthFar() const; >+ Optional<double> inlineVerticalFieldOfView() const; >+ RefPtr<XRWebGLLayer> baseLayer() const; >+ >+private: >+ XRRenderState(Optional<double>&&); >+ XRRenderState(const XRRenderStateInit&); >+ >+ struct { >+ double near { 0.1 }; >+ double far { 1000 }; >+ } m_depth; >+ Optional<double> m_inlineVerticalFieldOfView; >+ RefPtr<XRWebGLLayer> m_baseLayer; >+}; >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRRenderState.idl b/Source/WebCore/Modules/webxr/XRRenderState.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..4785d5b5e175ce64bc0c5fc8f991617a9339d733 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRRenderState.idl >@@ -0,0 +1,37 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+[ >+ EnabledAtRuntime=WebXR, >+ Conditional=WEBGL, >+ SecureContext, >+ Exposed=Window, >+ ImplementationLacksVTable >+] interface XRRenderState { >+ readonly attribute double depthNear; >+ readonly attribute double depthFar; >+ readonly attribute double? inlineVerticalFieldOfView; >+ readonly attribute XRWebGLLayer? baseLayer; >+}; >diff --git a/Source/WebCore/Modules/webxr/XRRenderStateInit.h b/Source/WebCore/Modules/webxr/XRRenderStateInit.h >new file mode 100644 >index 0000000000000000000000000000000000000000..8155fd99d5f02bff09e88308e9f4d8dbe96c8bdb >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRRenderStateInit.h >@@ -0,0 +1,40 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include "XRWebGLLayer.h" >+#include <wtf/RefPtr.h> >+ >+namespace WebCore { >+ >+struct XRRenderStateInit { >+ double depthNear; >+ double depthFar; >+ double inlineVerticalFieldOfView; >+ RefPtr<XRWebGLLayer> baseLayer; >+}; >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRRenderStateInit.idl b/Source/WebCore/Modules/webxr/XRRenderStateInit.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..3642eb9886131f471f63c2667a46b0dfa16c0283 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRRenderStateInit.idl >@@ -0,0 +1,34 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+[ >+ EnabledAtRuntime=WebXR, >+ Conditional=WEBGL, >+] dictionary XRRenderStateInit { >+ double depthNear; >+ double depthFar; >+ double inlineVerticalFieldOfView; >+ XRWebGLLayer? baseLayer; >+}; >diff --git a/Source/WebCore/Modules/webxr/XRRigidTransform.cpp b/Source/WebCore/Modules/webxr/XRRigidTransform.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..7cc4b7e68d35240f2081e3172171ab7d920f7344 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRRigidTransform.cpp >@@ -0,0 +1,110 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "XRRigidTransform.h" >+ >+#include "DOMPointReadOnly.h" >+#include "TransformationMatrix.h" >+#include <JavaScriptCore/TypedArrayInlines.h> >+#include <wtf/IsoMallocInlines.h> >+ >+namespace WebCore { >+ >+WTF_MAKE_ISO_ALLOCATED_IMPL(XRRigidTransform); >+ >+Ref<XRRigidTransform> XRRigidTransform::create() >+{ >+ return adoptRef(*new XRRigidTransform({ }, { })); >+} >+ >+ExceptionOr<Ref<XRRigidTransform>> XRRigidTransform::create(const DOMPointInit& position, const DOMPointInit& orientation) >+{ >+ // The XRRigidTransform(position, orientation) constructor MUST perform the following steps when invoked: >+ // 1. Let transform be a new XRRigidTransform. >+ >+ // 2. If position is not a DOMPointInit initialize transformâs position to { x: 0.0, y: 0.0, z: 0.0, w: 1.0 }. >+ // 3. If positionâs w value is not 1.0, throw a TypeError. >+ // 4. Else initialize transformâs positionâs x value to positionâs x dictionary member, y value to positionâs y dictionary member, z value to positionâs z dictionary member and w to 1.0. >+ if (position.w != 1.0) >+ return Exception { TypeError }; >+ DOMPointInit positionInit { position.x, position.y, position.z, 1 }; >+ >+ // 5. If orientation is not a DOMPointInit initialize transformâs orientation to { x: 0.0, y: 0.0, z: 0.0, w: 1.0 }. >+ // 6. Else initialize transformâs orientationâs x value to orientationâs x dictionary member, y value to orientationâs y dictionary member, z value to orientationâs z dictionary member and w value to orientationâs w dictionary member. >+ // 7. Normalize x, y, z, and w components of transformâs orientation. >+ DOMPointInit orientationInit { orientation.x, orientation.y, orientation.z, orientation.w }; >+ { >+ double length = std::sqrt(orientationInit.x * orientationInit.x + orientationInit.y * orientationInit.y >+ + orientationInit.z * orientationInit.z + orientationInit.w * orientationInit.w); >+ if (WTF::areEssentiallyEqual<double>(length, 0)) >+ return Exception { InvalidStateError }; >+ >+ orientationInit= { >+ orientationInit.x / length, orientationInit.y / length, >+ orientationInit.z / length, orientationInit.w / length, >+ }; >+ } >+ >+ // 8. Return transform. >+ return adoptRef(*new XRRigidTransform(positionInit, orientationInit)); >+} >+ >+XRRigidTransform::XRRigidTransform(const DOMPointInit& position, const DOMPointInit& orientation) >+ : m_position(DOMPointReadOnly::create(position)) >+ , m_orientation(DOMPointReadOnly::create(orientation)) >+{ >+ // FIXME: implement properly, per spec. >+ TransformationMatrix matrix; >+ auto matrixData = matrix.toColumnMajorFloatArray(); >+ m_matrix = Float32Array::create(matrixData.data(), matrixData.size()); >+} >+ >+XRRigidTransform::~XRRigidTransform() = default; >+ >+const DOMPointReadOnly& XRRigidTransform::position() const >+{ >+ return m_position; >+} >+ >+const DOMPointReadOnly& XRRigidTransform::orientation() const >+{ >+ return m_orientation; >+} >+ >+Ref<Float32Array> XRRigidTransform::matrix() const >+{ >+ auto matrix = Float32Array::create(16); >+ matrix->zeroFill(); >+ return matrix; >+} >+ >+Ref<XRRigidTransform> XRRigidTransform::inverse() const >+{ >+ // FIXME: implement properly. >+ return XRRigidTransform::create(); >+} >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRRigidTransform.h b/Source/WebCore/Modules/webxr/XRRigidTransform.h >new file mode 100644 >index 0000000000000000000000000000000000000000..29d043e81230f54eb13c978e983770a14a158057 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRRigidTransform.h >@@ -0,0 +1,58 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include "ExceptionOr.h" >+#include <JavaScriptCore/Float32Array.h> >+#include <wtf/IsoMalloc.h> >+#include <wtf/RefCounted.h> >+ >+namespace WebCore { >+ >+struct DOMPointInit; >+class DOMPointReadOnly; >+ >+class XRRigidTransform : public RefCounted<XRRigidTransform> { >+ WTF_MAKE_ISO_ALLOCATED(XRRigidTransform); >+public: >+ static Ref<XRRigidTransform> create(); >+ static ExceptionOr<Ref<XRRigidTransform>> create(const DOMPointInit&, const DOMPointInit&); >+ ~XRRigidTransform(); >+ >+ const DOMPointReadOnly& position() const; >+ const DOMPointReadOnly& orientation() const; >+ Ref<Float32Array> matrix() const; >+ Ref<XRRigidTransform> inverse() const; >+ >+private: >+ XRRigidTransform(const DOMPointInit&, const DOMPointInit&); >+ >+ Ref<DOMPointReadOnly> m_position; >+ Ref<DOMPointReadOnly> m_orientation; >+ RefPtr<Float32Array> m_matrix; >+}; >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRRigidTransform.idl b/Source/WebCore/Modules/webxr/XRRigidTransform.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..7df5c8927a249a005617ccca9771bde043fe83e6 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRRigidTransform.idl >@@ -0,0 +1,39 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+[ >+ EnabledAtRuntime=WebXR, >+ Conditional=WEBGL, >+ SecureContext, >+ Exposed=Window, >+ Constructor(optional DOMPointInit position, optional DOMPointInit orientation), >+ ConstructorMayThrowException, >+ ImplementationLacksVTable >+] interface XRRigidTransform { >+ [SameObject] readonly attribute DOMPointReadOnly position; >+ [SameObject] readonly attribute DOMPointReadOnly orientation; >+ readonly attribute Float32Array matrix; >+ [SameObject] readonly attribute XRRigidTransform inverse; >+}; >diff --git a/Source/WebCore/Modules/webxr/XRSession.cpp b/Source/WebCore/Modules/webxr/XRSession.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..62762532f7170b25ecd606eebdec12a593574573 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRSession.cpp >@@ -0,0 +1,87 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "XRSession.h" >+ >+#include <wtf/IsoMallocInlines.h> >+ >+namespace WebCore { >+ >+WTF_MAKE_ISO_ALLOCATED_IMPL(XRSession); >+ >+XRSession::~XRSession() = default; >+ >+XREnvironmentBlendMode XRSession::environmentBlendMode() const >+{ >+ return m_environmentBlendMode; >+} >+ >+XRVisibilityState XRSession::visibilityState() const >+{ >+ return m_visibilityState; >+} >+ >+const XRRenderState& XRSession::renderState() const >+{ >+ return *m_renderState; >+} >+ >+const XRInputSourceArray& XRSession::inputSources() const >+{ >+ return *m_inputSources; >+} >+ >+void XRSession::updateRenderState(const XRRenderStateInit&) >+{ >+} >+ >+void XRSession::requestReferenceSpace(const XRReferenceSpaceType&, RequestReferenceSpacePromise&&) >+{ >+} >+ >+int XRSession::requestAnimationFrame(Ref<XRFrameRequestCallback>&&) >+{ >+ return 0; >+} >+ >+void XRSession::cancelAnimationFrame(int) >+{ >+} >+ >+void XRSession::end(EndPromise&&) >+{ >+} >+ >+const char* XRSession::activeDOMObjectName() const >+{ >+ return "XRSession"; >+} >+ >+void XRSession::stop() >+{ >+} >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRSession.h b/Source/WebCore/Modules/webxr/XRSession.h >new file mode 100644 >index 0000000000000000000000000000000000000000..fdfc8d4225504ec524e3f8bd00e9be3757fe734e >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRSession.h >@@ -0,0 +1,92 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include "ActiveDOMObject.h" >+#include "EventTarget.h" >+#include "JSDOMPromiseDeferred.h" >+#include "XREnvironmentBlendMode.h" >+#include "XRInputSourceArray.h" >+#include "XRReferenceSpaceType.h" >+#include "XRRenderState.h" >+#include "XRSpace.h" >+#include "XRVisibilityState.h" >+#include <wtf/Ref.h> >+#include <wtf/RefCounted.h> >+#include <wtf/RefPtr.h> >+#include <wtf/Vector.h> >+ >+namespace WebCore { >+ >+class XRFrameRequestCallback; >+class XRReferenceSpace; >+struct XRRenderStateInit; >+ >+class XRSession final : public RefCounted<XRSession>, public EventTargetWithInlineData, public ActiveDOMObject { >+ WTF_MAKE_ISO_ALLOCATED(XRSession); >+public: >+ using RequestReferenceSpacePromise = DOMPromiseDeferred<IDLInterface<XRReferenceSpace>>; >+ using EndPromise = DOMPromiseDeferred<void>; >+ >+ virtual ~XRSession(); >+ >+ using RefCounted<XRSession>::ref; >+ using RefCounted<XRSession>::deref; >+ >+ XREnvironmentBlendMode environmentBlendMode() const; >+ XRVisibilityState visibilityState() const; >+ const XRRenderState& renderState() const; >+ const XRInputSourceArray& inputSources() const; >+ >+ void updateRenderState(const XRRenderStateInit&); >+ void requestReferenceSpace(const XRReferenceSpaceType&, RequestReferenceSpacePromise&&); >+ >+ int requestAnimationFrame(Ref<XRFrameRequestCallback>&&); >+ void cancelAnimationFrame(int handle); >+ >+ void end(EndPromise&&); >+ >+ bool ended() const { return m_ended; } >+ >+protected: >+ // EventTarget >+ EventTargetInterface eventTargetInterface() const override { return XRSessionEventTargetInterfaceType; } >+ ScriptExecutionContext* scriptExecutionContext() const override { return ActiveDOMObject::scriptExecutionContext(); } >+ void refEventTarget() override { ref(); } >+ void derefEventTarget() override { deref(); } >+ >+ // ActiveDOMObject >+ const char* activeDOMObjectName() const override; >+ void stop() override; >+ >+ XREnvironmentBlendMode m_environmentBlendMode; >+ XRVisibilityState m_visibilityState; >+ RefPtr<XRRenderState> m_renderState; >+ RefPtr<XRInputSourceArray> m_inputSources; >+ bool m_ended { false }; >+}; >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRSession.idl b/Source/WebCore/Modules/webxr/XRSession.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..423a52f5923a4fb8b135c598c073c6309159ce97 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRSession.idl >@@ -0,0 +1,55 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+[ >+ EnabledAtRuntime=WebXR, >+ Conditional=WEBGL, >+ ActiveDOMObject, >+ SecureContext, >+ Exposed=Window >+] interface XRSession : EventTarget { >+ // Attributes >+ readonly attribute XREnvironmentBlendMode environmentBlendMode; >+ readonly attribute XRVisibilityState visibilityState; >+ [SameObject] readonly attribute XRRenderState renderState; >+ [SameObject] readonly attribute XRInputSourceArray inputSources; >+ >+ // Methods >+ void updateRenderState(optional XRRenderStateInit stateInit); >+ [NewObject] Promise<XRReferenceSpace> requestReferenceSpace(XRReferenceSpaceType type); >+ >+ long requestAnimationFrame(XRFrameRequestCallback callback); >+ void cancelAnimationFrame(long handle); >+ >+ Promise<void> end(); >+ >+ // Events >+ attribute EventHandler onend; >+ attribute EventHandler onselect; >+ attribute EventHandler oninputsourceschange; >+ attribute EventHandler onselectstart; >+ attribute EventHandler onselectend; >+ attribute EventHandler onvisibilitychange; >+}; >diff --git a/Source/WebCore/Modules/webxr/XRSessionEvent.cpp b/Source/WebCore/Modules/webxr/XRSessionEvent.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..f159dabb6f3ce653fa392cd76170cdb7ea54117e >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRSessionEvent.cpp >@@ -0,0 +1,52 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "XRSessionEvent.h" >+ >+#include "XRSession.h" >+ >+namespace WebCore { >+ >+Ref<XRSessionEvent> XRSessionEvent::create(const AtomString& type, const Init& initializer, IsTrusted isTrusted) >+{ >+ return adoptRef(*new XRSessionEvent(type, initializer, isTrusted)); >+} >+ >+XRSessionEvent::XRSessionEvent(const AtomString& type, const Init& initializer, IsTrusted isTrusted) >+ : Event(type, initializer, isTrusted) >+ , m_session(initializer.session) >+{ >+ ASSERT(m_session); >+} >+ >+XRSessionEvent::~XRSessionEvent() = default; >+ >+const XRSession& XRSessionEvent::session() const >+{ >+ return *m_session; >+} >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRSessionEvent.h b/Source/WebCore/Modules/webxr/XRSessionEvent.h >new file mode 100644 >index 0000000000000000000000000000000000000000..d7e1f9e6a18e390637f4b7062a67eb71bc0e25da >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRSessionEvent.h >@@ -0,0 +1,51 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include "Event.h" >+ >+namespace WebCore { >+ >+class XRSession; >+ >+class XRSessionEvent final : public Event { >+public: >+ struct Init : EventInit { >+ RefPtr<XRSession> session; >+ }; >+ >+ static Ref<XRSessionEvent> create(const AtomString&, const Init&, IsTrusted = IsTrusted::No); >+ virtual ~XRSessionEvent(); >+ >+ const XRSession& session() const; >+ >+private: >+ XRSessionEvent(const AtomString&, const Init&, IsTrusted); >+ >+ RefPtr<XRSession> m_session; >+}; >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRSessionEvent.idl b/Source/WebCore/Modules/webxr/XRSessionEvent.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..f644366df613ef910c8250f1b4a3393286f87aa3 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRSessionEvent.idl >@@ -0,0 +1,41 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+[ >+ EnabledAtRuntime=WebXR, >+ Conditional=WEBGL, >+] dictionary XRSessionEventInit : EventInit { >+ required XRSession session; >+}; >+ >+[ >+ EnabledAtRuntime=WebXR, >+ Conditional=WEBGL, >+ SecureContext, >+ Exposed=Window, >+ Constructor(DOMString type, XRSessionEventInit eventInitDict) >+] interface XRSessionEvent : Event { >+ [SameObject] readonly attribute XRSession session; >+}; >diff --git a/Source/WebCore/Modules/webxr/XRSessionInit.h b/Source/WebCore/Modules/webxr/XRSessionInit.h >new file mode 100644 >index 0000000000000000000000000000000000000000..f2b47cc26a418279c5f9cfe2fb1e61a1590ec2f4 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRSessionInit.h >@@ -0,0 +1,42 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include <JavaScriptCore/Strong.h> >+#include <wtf/Forward.h> >+ >+namespace JSC { >+class JSValue; >+} >+ >+namespace WebCore { >+ >+struct XRSessionInit { >+ Vector<JSC::JSValue> requiredFeatures; >+ Vector<JSC::JSValue> optionalFeatures; >+}; >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRSessionInit.idl b/Source/WebCore/Modules/webxr/XRSessionInit.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..15860a8ba4779d4d4bdb0ceefb0fe4623c1b5ef8 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRSessionInit.idl >@@ -0,0 +1,32 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+[ >+ EnabledAtRuntime=WebXR, >+ Conditional=WEBGL >+] dictionary XRSessionInit { >+ sequence<any> requiredFeatures; >+ sequence<any> optionalFeatures; >+}; >diff --git a/Source/WebCore/Modules/webxr/XRSessionMode.h b/Source/WebCore/Modules/webxr/XRSessionMode.h >new file mode 100644 >index 0000000000000000000000000000000000000000..621ec658ffbbbd74999b4b97eb87a79b99ecbb9d >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRSessionMode.h >@@ -0,0 +1,34 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include "PlatformXR.h" >+ >+namespace WebCore { >+ >+using XRSessionMode = PlatformXR::SessionMode; >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRSessionMode.idl b/Source/WebCore/Modules/webxr/XRSessionMode.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..e19d9b45e91337a29816ed7948c565184c25b9cc >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRSessionMode.idl >@@ -0,0 +1,33 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+[ >+ EnabledAtRuntime=WebXR, >+ Conditional=WEBGL >+] enum XRSessionMode { >+ "inline", >+ "immersive-vr", >+ "immersive-ar" >+}; >diff --git a/Source/WebCore/Modules/webxr/XRSpace.cpp b/Source/WebCore/Modules/webxr/XRSpace.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..74a70089a5382b22ed8ff5352c541d8dcb6ca7cd >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRSpace.cpp >@@ -0,0 +1,42 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "XRSpace.h" >+ >+#include <wtf/IsoMallocInlines.h> >+ >+namespace WebCore { >+ >+WTF_MAKE_ISO_ALLOCATED_IMPL(XRSpace); >+ >+XRSpace::XRSpace(ScriptExecutionContext& context) >+ : ContextDestructionObserver(&context) >+{ >+} >+ >+XRSpace::~XRSpace() = default; >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRSpace.h b/Source/WebCore/Modules/webxr/XRSpace.h >new file mode 100644 >index 0000000000000000000000000000000000000000..415913929663778b0b7a44fcee0d421f1fc4724d >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRSpace.h >@@ -0,0 +1,57 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include "ContextDestructionObserver.h" >+#include "EventTarget.h" >+#include <wtf/RefCounted.h> >+ >+namespace WebCore { >+ >+class ScriptExecutionContext; >+ >+class XRSpace : public RefCounted<XRSpace>, public EventTargetWithInlineData, public ContextDestructionObserver { >+ WTF_MAKE_ISO_ALLOCATED(XRSpace); >+public: >+ virtual ~XRSpace(); >+ >+ using RefCounted<XRSpace>::ref; >+ using RefCounted<XRSpace>::deref; >+ >+protected: >+ XRSpace(ScriptExecutionContext&); >+ >+ // EventTarget >+ ScriptExecutionContext* scriptExecutionContext() const override { return ContextDestructionObserver::scriptExecutionContext(); } >+ >+private: >+ // EventTarget >+ EventTargetInterface eventTargetInterface() const override { return XRSpaceEventTargetInterfaceType; } >+ void refEventTarget() override { ref(); } >+ void derefEventTarget() override { deref(); } >+}; >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRSpace.idl b/Source/WebCore/Modules/webxr/XRSpace.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..249004a98bd834a330595aecca45945fc107c2d0 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRSpace.idl >@@ -0,0 +1,32 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+[ >+ EnabledAtRuntime=WebXR, >+ Conditional=WEBGL, >+ SecureContext, >+ Exposed=Window >+] interface XRSpace : EventTarget { >+}; >diff --git a/Source/WebCore/Modules/webxr/XRSystem.cpp b/Source/WebCore/Modules/webxr/XRSystem.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..097453e36480ee4d4ce2b37acb1f990129775c10 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRSystem.cpp >@@ -0,0 +1,88 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "XRSystem.h" >+ >+#include "PlatformXR.h" >+#include <wtf/IsoMallocInlines.h> >+ >+namespace WebCore { >+ >+WTF_MAKE_ISO_ALLOCATED_IMPL(XRSystem); >+ >+Ref<XRSystem> XRSystem::create(ScriptExecutionContext& scriptExecutionContext) >+{ >+ return adoptRef(*new XRSystem(scriptExecutionContext)); >+} >+ >+XRSystem::XRSystem(ScriptExecutionContext& scriptExecutionContext) >+ : ActiveDOMObject(&scriptExecutionContext) >+{ >+} >+ >+XRSystem::~XRSystem() = default; >+ >+void XRSystem::isSessionSupported(XRSessionMode, IsSessionSupportedPromise&&) >+{ >+ // When the supportsSession(mode) method is invoked, it MUST return a new Promise promise and run the following steps in parallel: >+ // 1. Ensure an XR device is selected. >+ // 2. If the XR device is null, reject promise with a "NotSupportedError" DOMException and abort these steps. >+ // 3. If the XR device's list of supported modes does not contain mode, reject promise with a "NotSupportedError" DOMException and abort these steps. >+ // 4. Else resolve promise. >+} >+ >+void XRSystem::requestSession(XRSessionMode, const XRSessionInit&, RequestSessionPromise&&) >+{ >+ PlatformXR::Instance::singleton(); >+ >+ // When the requestSession(mode) method is invoked, the user agent MUST return a new Promise promise and run the following steps in parallel: >+ // 1. Let immersive be true if mode is "immersive-vr" or "immersive-ar", and false otherwise. >+ // 2. If immersive is true: >+ // 1. If pending immersive session is true or active immersive session is not null, reject promise with an "InvalidStateError" DOMException and abort these steps. >+ // 2. Else set pending immersive session to be true. >+ // 3. Ensure an XR device is selected. >+ // 4. If the XR device is null, reject promise with null. >+ // 5. Else if the XR device's list of supported modes does not contain mode, reject promise with a "NotSupportedError" DOMException. >+ // 6. Else If immersive is true and the algorithm is not triggered by user activation, reject promise with a "SecurityError" DOMException and abort these steps. >+ // 7. If promise was rejected and immersive is true, set pending immersive session to false. >+ // 8. If promise was rejected, abort these steps. >+ // 9. Let session be a new XRSession object. >+ // 10. Initialize the session with session and mode. >+ // 11. If immersive is true, set the active immersive session to session, and set pending immersive session to false. >+ // 12. Else append session to the list of inline sessions. >+ // 13. Resolve promise with session. >+} >+ >+const char* XRSystem::activeDOMObjectName() const >+{ >+ return "XRSystem"; >+} >+ >+void XRSystem::stop() >+{ >+} >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRSystem.h b/Source/WebCore/Modules/webxr/XRSystem.h >new file mode 100644 >index 0000000000000000000000000000000000000000..8cc944ca40799b170fe9272eb233b1c9d12667ad >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRSystem.h >@@ -0,0 +1,70 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include "ActiveDOMObject.h" >+#include "EventTarget.h" >+#include "JSDOMPromiseDeferred.h" >+#include "XRSessionMode.h" >+#include <wtf/IsoMalloc.h> >+#include <wtf/RefCounted.h> >+ >+namespace WebCore { >+ >+class ScriptExecutionContext; >+class XRSession; >+struct XRSessionInit; >+ >+class XRSystem final : public RefCounted<XRSystem>, public EventTargetWithInlineData, public ActiveDOMObject { >+ WTF_MAKE_ISO_ALLOCATED(XRSystem); >+public: >+ using IsSessionSupportedPromise = DOMPromiseDeferred<IDLBoolean>; >+ using RequestSessionPromise = DOMPromiseDeferred<IDLInterface<XRSession>>; >+ >+ static Ref<XRSystem> create(ScriptExecutionContext&); >+ virtual ~XRSystem(); >+ >+ using RefCounted<XRSystem>::ref; >+ using RefCounted<XRSystem>::deref; >+ >+ void isSessionSupported(XRSessionMode, IsSessionSupportedPromise&&); >+ void requestSession(XRSessionMode, const XRSessionInit&, RequestSessionPromise&&); >+ >+protected: >+ XRSystem(ScriptExecutionContext&); >+ >+ // EventTarget >+ EventTargetInterface eventTargetInterface() const override { return XRSystemEventTargetInterfaceType; } >+ ScriptExecutionContext* scriptExecutionContext() const override { return ActiveDOMObject::scriptExecutionContext(); } >+ void refEventTarget() override { ref(); } >+ void derefEventTarget() override { deref(); } >+ >+ // ActiveDOMObject >+ const char* activeDOMObjectName() const override; >+ void stop() override; >+}; >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRSystem.idl b/Source/WebCore/Modules/webxr/XRSystem.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..a75b6da5a620a88517e9dda0f07ec7bfcafd1954 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRSystem.idl >@@ -0,0 +1,39 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+[ >+ EnabledAtRuntime=WebXR, >+ Conditional=WEBGL, >+ ActiveDOMObject, >+ SecureContext, >+ Exposed=Window >+] interface XRSystem : EventTarget { >+ // Methods >+ Promise<void> isSessionSupported(XRSessionMode mode); >+ [NewObject] Promise<XRSession> requestSession(XRSessionMode mode, optional XRSessionInit options); >+ >+ // Events >+ attribute EventHandler ondevicechange; >+}; >diff --git a/Source/WebCore/Modules/webxr/XRTargetRayMode.h b/Source/WebCore/Modules/webxr/XRTargetRayMode.h >new file mode 100644 >index 0000000000000000000000000000000000000000..ff55f15201ca91684dc6b105600bbe206e9f61d5 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRTargetRayMode.h >@@ -0,0 +1,36 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+namespace WebCore { >+ >+enum class XRTargetRayMode { >+ Gaze, >+ TrackedPointer, >+ Screen, >+}; >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRTargetRayMode.idl b/Source/WebCore/Modules/webxr/XRTargetRayMode.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..368218a08c6fa15965b2bf40500fdfe674ba40db >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRTargetRayMode.idl >@@ -0,0 +1,33 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+[ >+ EnabledAtRuntime=WebXR, >+ Conditional=WEBGL >+] enum XRTargetRayMode { >+ "gaze", >+ "tracked-pointer", >+ "screen" >+}; >diff --git a/Source/WebCore/Modules/webxr/XRView.cpp b/Source/WebCore/Modules/webxr/XRView.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..ef22876cae269b6cedc5c437dc5a8376346be650 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRView.cpp >@@ -0,0 +1,66 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "XRView.h" >+ >+#include "XRRigidTransform.h" >+#include <JavaScriptCore/TypedArrayInlines.h> >+#include <wtf/IsoMallocInlines.h> >+ >+namespace WebCore { >+ >+WTF_MAKE_ISO_ALLOCATED_IMPL(XRView); >+ >+Ref<XRView> XRView::create() >+{ >+ return adoptRef(*new XRView); >+} >+ >+XRView::XRView() >+ : m_eye(XREye::Left) >+ , m_projectionMatrix(Float32Array::create(0)) >+ , m_transform(XRRigidTransform::create()) >+{ >+} >+ >+XRView::~XRView() = default; >+ >+XREye XRView::eye() const >+{ >+ return m_eye; >+} >+ >+const Float32Array& XRView::projectionMatrix() const >+{ >+ return m_projectionMatrix; >+} >+ >+const XRRigidTransform& XRView::transform() const >+{ >+ return m_transform; >+} >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRView.h b/Source/WebCore/Modules/webxr/XRView.h >new file mode 100644 >index 0000000000000000000000000000000000000000..60bf3593e1f9e5902eceea382ad08d1e46010c00 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRView.h >@@ -0,0 +1,56 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include "XREye.h" >+#include <JavaScriptCore/Float32Array.h> >+#include <wtf/IsoMalloc.h> >+#include <wtf/Ref.h> >+#include <wtf/RefCounted.h> >+ >+namespace WebCore { >+ >+class XRRigidTransform; >+ >+class XRView : public RefCounted<XRView> { >+ WTF_MAKE_ISO_ALLOCATED(XRView); >+public: >+ static Ref<XRView> create(); >+ ~XRView(); >+ >+ XREye eye() const; >+ const Float32Array& projectionMatrix() const; >+ const XRRigidTransform& transform() const; >+ >+private: >+ XRView(); >+ >+ XREye m_eye; >+ Ref<Float32Array> m_projectionMatrix; >+ Ref<XRRigidTransform> m_transform; >+}; >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRView.idl b/Source/WebCore/Modules/webxr/XRView.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..c359955c2f20b026e07fd1e82e01ca326e43a3bf >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRView.idl >@@ -0,0 +1,36 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+[ >+ EnabledAtRuntime=WebXR, >+ Conditional=WEBGL, >+ SecureContext, >+ Exposed=Window, >+ ImplementationLacksVTable >+] interface XRView { >+ readonly attribute XREye eye; >+ readonly attribute Float32Array projectionMatrix; >+ [SameObject] readonly attribute XRRigidTransform transform; >+}; >diff --git a/Source/WebCore/Modules/webxr/XRViewerPose.cpp b/Source/WebCore/Modules/webxr/XRViewerPose.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..37fbf2a7600bfc70ab62c541f6b308a271d12312 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRViewerPose.cpp >@@ -0,0 +1,44 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "XRViewerPose.h" >+ >+namespace WebCore { >+ >+Ref<XRViewerPose> XRViewerPose::create() >+{ >+ return adoptRef(*new XRViewerPose); >+} >+ >+XRViewerPose::XRViewerPose() = default; >+XRViewerPose::~XRViewerPose() = default; >+ >+const Vector<Ref<XRView>>& XRViewerPose::views() const >+{ >+ return m_views; >+} >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRViewerPose.h b/Source/WebCore/Modules/webxr/XRViewerPose.h >new file mode 100644 >index 0000000000000000000000000000000000000000..ff940c2f1523fdd1517aa597f4d9d64e869f8552 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRViewerPose.h >@@ -0,0 +1,50 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include "XRPose.h" >+#include "XRView.h" >+#include <wtf/IsoMalloc.h> >+#include <wtf/Ref.h> >+#include <wtf/RefCounted.h> >+#include <wtf/Vector.h> >+ >+namespace WebCore { >+ >+class XRViewerPose : public XRPose { >+public: >+ static Ref<XRViewerPose> create(); >+ ~XRViewerPose(); >+ >+ const Vector<Ref<XRView>>& views() const; >+ >+private: >+ XRViewerPose(); >+ >+ Vector<Ref<XRView>> m_views; >+}; >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRViewerPose.idl b/Source/WebCore/Modules/webxr/XRViewerPose.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..e04bc6d01227eb277e7297395e7e0e3b0ecabe2e >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRViewerPose.idl >@@ -0,0 +1,34 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+[ >+ EnabledAtRuntime=WebXR, >+ Conditional=WEBGL, >+ SecureContext, >+ Exposed=Window, >+ ImplementationLacksVTable >+] interface XRViewerPose : XRPose { >+ [SameObject] readonly attribute FrozenArray<XRView> views; >+}; >diff --git a/Source/WebCore/Modules/webxr/XRViewport.cpp b/Source/WebCore/Modules/webxr/XRViewport.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..59f0d89e737465fb5096d738517c7924bd3cdad6 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRViewport.cpp >@@ -0,0 +1,62 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "XRViewport.h" >+ >+#include <wtf/IsoMallocInlines.h> >+ >+namespace WebCore { >+ >+WTF_MAKE_ISO_ALLOCATED_IMPL(XRViewport); >+ >+Ref<XRViewport> XRViewport::create() >+{ >+ return adoptRef(*new XRViewport); >+} >+ >+XRViewport::XRViewport() = default; >+ >+int XRViewport::x() const >+{ >+ return 0; >+} >+ >+int XRViewport::y() const >+{ >+ return 0; >+} >+ >+int XRViewport::width() const >+{ >+ return 0; >+} >+ >+int XRViewport::height() const >+{ >+ return 0; >+} >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRViewport.h b/Source/WebCore/Modules/webxr/XRViewport.h >new file mode 100644 >index 0000000000000000000000000000000000000000..0617bda1282c8bddda428d342286f85007e9c3ed >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRViewport.h >@@ -0,0 +1,48 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include <wtf/IsoMalloc.h> >+#include <wtf/Ref.h> >+#include <wtf/RefCounted.h> >+ >+namespace WebCore { >+ >+class XRViewport : public RefCounted<XRViewport> { >+ WTF_MAKE_ISO_ALLOCATED(XRViewport); >+public: >+ static Ref<XRViewport> create(); >+ >+ int x() const; >+ int y() const; >+ int width() const; >+ int height() const; >+ >+private: >+ XRViewport(); >+}; >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRViewport.idl b/Source/WebCore/Modules/webxr/XRViewport.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..543c26ee5fdf12899146eb616199e270517d97d2 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRViewport.idl >@@ -0,0 +1,37 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+[ >+ EnabledAtRuntime=WebXR, >+ Conditional=WEBGL, >+ SecureContext, >+ Exposed=Window, >+ ImplementationLacksVTable >+] interface XRViewport { >+ readonly attribute long x; >+ readonly attribute long y; >+ readonly attribute long width; >+ readonly attribute long height; >+}; >diff --git a/Source/WebCore/Modules/webxr/XRVisibilityState.h b/Source/WebCore/Modules/webxr/XRVisibilityState.h >new file mode 100644 >index 0000000000000000000000000000000000000000..dc2b60edbc92013c377991ca464387abca70bba1 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRVisibilityState.h >@@ -0,0 +1,36 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+namespace WebCore { >+ >+enum class XRVisibilityState { >+ Visible, >+ VisibleBlurred, >+ Hidden >+}; >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRVisibilityState.idl b/Source/WebCore/Modules/webxr/XRVisibilityState.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..f9177a08de246b875c83226d3ef9b2837c58a9db >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRVisibilityState.idl >@@ -0,0 +1,33 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+[ >+ EnabledAtRuntime=WebXR, >+ Conditional=WEBGL >+] enum XRVisibilityState { >+ "visible", >+ "visible-blurred", >+ "hidden" >+}; >diff --git a/Source/WebCore/Modules/webxr/XRWebGLLayer.cpp b/Source/WebCore/Modules/webxr/XRWebGLLayer.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..9820b6d4fd0eb3aaf4aced66db46ffd321b1de40 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRWebGLLayer.cpp >@@ -0,0 +1,128 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "XRWebGLLayer.h" >+ >+#include "WebGLFramebuffer.h" >+#include "WebGLRenderingContext.h" >+#if ENABLE(WEBGL2) >+#include "WebGL2RenderingContext.h" >+#endif >+#include "XRSession.h" >+#include "XRViewport.h" >+#include "XRWebGLLayerInit.h" >+ >+namespace WebCore { >+ >+ExceptionOr<Ref<XRWebGLLayer>> XRWebGLLayer::create(const XRSession& session, XRRenderingContext&& context, const XRWebGLLayerInit& init) >+{ >+ // The XRWebGLLayer(session, context, layerInit) constructor MUST perform the following steps when invoked: >+ // 1. Let layer be a new XRWebGLLayer >+ >+ // 2. If sessionâs ended value is true, throw an InvalidStateError and abort these steps. >+ if (session.ended()) >+ return Exception { InvalidStateError }; >+ >+ // 3. If context is lost, throw an InvalidStateError and abort these steps. >+ // 4. If contextâs XR compatible boolean is false, throw an InvalidStateError and abort these steps. >+ // FIXME: TODO >+ >+ // 5. Initialize layerâs context to context. >+ // 6. Initialize layerâs antialias to layerInitâs antialias value. >+ // 7. If layerInitâs ignoreDepthValues value is false and the XR Compositor will make use of depth values, Initialize layerâs ignoreDepthValues to false. >+ // 8. Else Initialize layerâs ignoreDepthValues to true >+ // 9. Initialize layerâs framebuffer to a new opaque framebuffer created with context. >+ // 10. Initialize the layerâs swap chain. >+ // 11. If layerâs swap chain was unable to be created for any reason, throw an OperationError and abort these steps. >+ // FIXME: TODO >+ >+ // 12. Return layer. >+ return adoptRef(*new XRWebGLLayer(session, WTFMove(context), init)); >+} >+ >+XRWebGLLayer::XRWebGLLayer(const XRSession&, XRRenderingContext&& context, const XRWebGLLayerInit& init) >+ : m_context(WTFMove(context)) >+ , m_antialias(init.antialias) >+ , m_ignoreDepthValues(init.ignoreDepthValues) >+{ >+ m_framebuffer.object = WTF::switchOn(m_context, >+ [](const RefPtr<WebGLRenderingContext>& context) >+ { >+ RefPtr<WebGLFramebuffer> frameBuffer = WebGLFramebuffer::create(*context); >+ return frameBuffer; >+ }, >+#if ENABLE(WEBGL2) >+ [](const RefPtr<WebGL2RenderingContext>& context) >+ { >+ RefPtr<WebGLFramebuffer> frameBuffer = WebGLFramebuffer::create(*context); >+ return frameBuffer; >+ }, >+#endif >+ [](WTF::Monostate) { >+ ASSERT_NOT_REACHED(); >+ return nullptr; >+ } >+ ); >+} >+ >+XRWebGLLayer::~XRWebGLLayer() = default; >+ >+bool XRWebGLLayer::antialias() const >+{ >+ return m_antialias; >+} >+ >+bool XRWebGLLayer::ignoreDepthValues() const >+{ >+ return m_ignoreDepthValues; >+} >+ >+const WebGLFramebuffer& XRWebGLLayer::framebuffer() const >+{ >+ return *m_framebuffer.object; >+} >+ >+unsigned XRWebGLLayer::framebufferWidth() const >+{ >+ return m_framebuffer.width; >+} >+ >+unsigned XRWebGLLayer::framebufferHeight() const >+{ >+ return m_framebuffer.height; >+} >+ >+RefPtr<XRViewport> XRWebGLLayer::getViewport(const XRView&) >+{ >+ return { }; >+} >+ >+double XRWebGLLayer::getNativeFramebufferScaleFactor(const XRSession&) >+{ >+ return 1.0; >+} >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRWebGLLayer.h b/Source/WebCore/Modules/webxr/XRWebGLLayer.h >new file mode 100644 >index 0000000000000000000000000000000000000000..10f3ca89540085ab7747a0749758f317969a3474 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRWebGLLayer.h >@@ -0,0 +1,86 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include "ExceptionOr.h" >+#include <wtf/IsoMalloc.h> >+#include <wtf/Ref.h> >+#include <wtf/RefCounted.h> >+#include <wtf/RefPtr.h> >+#include <wtf/Variant.h> >+ >+namespace WebCore { >+ >+class WebGLFramebuffer; >+class WebGLRenderingContext; >+#if ENABLE(WEBGL2) >+class WebGL2RenderingContext; >+#endif >+class XRSession; >+class XRView; >+class XRViewport; >+struct XRWebGLLayerInit; >+ >+class XRWebGLLayer : public RefCounted<XRWebGLLayer> { >+public: >+ >+ using XRRenderingContext = WTF::Variant< >+ RefPtr<WebGLRenderingContext>, >+#if ENABLE(WEBGL2) >+ RefPtr<WebGL2RenderingContext>, >+#endif >+ WTF::Monostate >+ >; >+ >+ static ExceptionOr<Ref<XRWebGLLayer>> create(const XRSession&, XRRenderingContext&&, const XRWebGLLayerInit&); >+ ~XRWebGLLayer(); >+ >+ bool antialias() const; >+ bool ignoreDepthValues() const; >+ >+ const WebGLFramebuffer& framebuffer() const; >+ unsigned framebufferWidth() const; >+ unsigned framebufferHeight() const; >+ >+ RefPtr<XRViewport> getViewport(const XRView&); >+ >+ static double getNativeFramebufferScaleFactor(const XRSession&); >+ >+private: >+ XRWebGLLayer(const XRSession&, XRRenderingContext&&, const XRWebGLLayerInit&); >+ >+ XRRenderingContext m_context; >+ bool m_antialias { false }; >+ bool m_ignoreDepthValues { false }; >+ >+ struct { >+ RefPtr<WebGLFramebuffer> object; >+ unsigned width { 0 }; >+ unsigned height { 0 }; >+ } m_framebuffer; >+}; >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRWebGLLayer.idl b/Source/WebCore/Modules/webxr/XRWebGLLayer.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..8b64758bee611326d9e7c077a3c197e1615d03d7 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRWebGLLayer.idl >@@ -0,0 +1,50 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+typedef (WebGLRenderingContext or WebGL2RenderingContext) XRWebGLRenderingContext; >+ >+[ >+ EnabledAtRuntime=WebXR, >+ Conditional=WEBGL, >+ SecureContext, >+ Exposed=Window, >+ //Constructor(XRSession session, XRWebGLRenderingContext context, optional XRWebGLLayerInit layerInit), >+ //ConstructorMayThrowException, >+ ImplementationLacksVTable >+] interface XRWebGLLayer { >+ // Attributes >+ readonly attribute boolean antialias; >+ readonly attribute boolean ignoreDepthValues; >+ >+ [SameObject] readonly attribute WebGLFramebuffer framebuffer; >+ readonly attribute unsigned long framebufferWidth; >+ readonly attribute unsigned long framebufferHeight; >+ >+ // Methods >+ XRViewport? getViewport(XRView view); >+ >+ // Static Methods >+ static double getNativeFramebufferScaleFactor(XRSession session); >+}; >diff --git a/Source/WebCore/Modules/webxr/XRWebGLLayerInit.h b/Source/WebCore/Modules/webxr/XRWebGLLayerInit.h >new file mode 100644 >index 0000000000000000000000000000000000000000..0c718fde245f61237733ff799560ac49835c90f3 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRWebGLLayerInit.h >@@ -0,0 +1,39 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+namespace WebCore { >+ >+struct XRWebGLLayerInit { >+ bool antialias { true }; >+ bool depth { true }; >+ bool stencil { false }; >+ bool alpha { true }; >+ bool ignoreDepthValues { true }; >+ double framebufferScaleFactor { 1.0 }; >+}; >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRWebGLLayerInit.idl b/Source/WebCore/Modules/webxr/XRWebGLLayerInit.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..a245b1e6119d7773cfbd0f0e457b2f4e96c1256b >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/XRWebGLLayerInit.idl >@@ -0,0 +1,36 @@ >+/* >+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+[ >+ EnabledAtRuntime=WebXR, >+ Conditional=WEBGL >+] dictionary XRWebGLLayerInit { >+ boolean antialias = true; >+ boolean depth = true; >+ boolean stencil = false; >+ boolean alpha = true; >+ boolean ignoreDepthValues = false; >+ double framebufferScaleFactor = 1.0; >+}; >diff --git a/Source/WebCore/PlatformWPE.cmake b/Source/WebCore/PlatformWPE.cmake >index 0d5982e1dc69eb680f08debd8e6f26a7247d9da5..e75ecef140ab5ceef1d0d6dbc066e35c92d3f592 100644 >--- a/Source/WebCore/PlatformWPE.cmake >+++ b/Source/WebCore/PlatformWPE.cmake >@@ -70,3 +70,8 @@ list(APPEND WebCore_SYSTEM_INCLUDE_DIRECTORIES > ${UPOWERGLIB_INCLUDE_DIRS} > ${WPEBACKEND_FDO_INCLUDE_DIRS} > ) >+ >+if (USE_OPENXR) >+ list(APPEND WebCore_LIBRARIES ${OPENXR_LIBRARIES}) >+ list(APPEND WebCore_SYSTEM_INCLUDE_DIRECTORIES ${OPENXR_INCLUDE_DIRS}) >+endif () >\ No newline at end of file >diff --git a/Source/WebCore/Sources.txt b/Source/WebCore/Sources.txt >index a721fbb1ad8a5aa6bda09b63b3a2a9d997c9112f..71da8e661aea2965b21158b1feb0274c923486c3 100644 >--- a/Source/WebCore/Sources.txt >+++ b/Source/WebCore/Sources.txt >@@ -411,6 +411,31 @@ Modules/webgpu/WebGPUTexture.cpp > Modules/webgpu/WebGPUTextureView.cpp > Modules/webgpu/WorkerNavigatorGPU.cpp > >+#if ENABLE_WEBGL >+ >+Modules/webxr/NavigatorWebXR.cpp @no-unify >+Modules/webxr/XRBoundedReferenceSpace.cpp @no-unify >+Modules/webxr/XRFrame.cpp @no-unify >+Modules/webxr/XRInputSource.cpp @no-unify >+Modules/webxr/XRInputSourceArray.cpp @no-unify >+Modules/webxr/XRInputSourceEvent.cpp @no-unify >+Modules/webxr/XRInputSourcesChangeEvent.cpp @no-unify >+Modules/webxr/XRPose.cpp @no-unify >+Modules/webxr/XRReferenceSpace.cpp @no-unify >+Modules/webxr/XRReferenceSpaceEvent.cpp @no-unify >+Modules/webxr/XRRenderState.cpp @no-unify >+Modules/webxr/XRRigidTransform.cpp @no-unify >+Modules/webxr/XRSession.cpp @no-unify >+Modules/webxr/XRSessionEvent.cpp @no-unify >+Modules/webxr/XRSpace.cpp @no-unify >+Modules/webxr/XRSystem.cpp @no-unify >+Modules/webxr/XRView.cpp @no-unify >+Modules/webxr/XRViewerPose.cpp @no-unify >+Modules/webxr/XRViewport.cpp @no-unify >+Modules/webxr/XRWebGLLayer.cpp @no-unify >+ >+#endif >+ > accessibility/AXObjectCache.cpp > accessibility/AccessibilityARIAGrid.cpp > accessibility/AccessibilityARIAGridCell.cpp >@@ -2071,6 +2096,9 @@ platform/text/TextEncoding.cpp > platform/text/TextEncodingDetectorICU.cpp > platform/text/TextEncodingRegistry.cpp > >+platform/xr/PlatformXR.cpp @no-unify >+platform/xr/openxr/PlatformXR.cpp @no-unify >+ > plugins/DOMMimeType.cpp > plugins/DOMMimeTypeArray.cpp > plugins/DOMPlugin.cpp >@@ -3518,6 +3546,41 @@ JSXPathNSResolver.cpp > JSXPathResult.cpp > JSXSLTProcessor.cpp > >+#if ENABLE_WEBGL >+ >+JSXRBoundedReferenceSpace.cpp >+JSXREnvironmentBlendMode.cpp >+JSXREye.cpp >+JSXRFrame.cpp >+JSXRFrameRequestCallback.cpp >+JSXRHandedness.cpp >+JSXRInputSource.cpp >+JSXRInputSourceArray.cpp >+JSXRInputSourceEvent.cpp >+JSXRInputSourcesChangeEvent.cpp >+JSXRPose.cpp >+JSXRReferenceSpace.cpp >+JSXRReferenceSpaceEvent.cpp >+JSXRReferenceSpaceType.cpp >+JSXRRenderState.cpp >+JSXRRenderStateInit.cpp >+JSXRRigidTransform.cpp >+JSXRSession.cpp >+JSXRSessionEvent.cpp >+JSXRSessionInit.cpp >+JSXRSessionMode.cpp >+JSXRSpace.cpp >+JSXRSystem.cpp >+JSXRTargetRayMode.cpp >+JSXRView.cpp >+JSXRViewerPose.cpp >+JSXRViewport.cpp >+JSXRVisibilityState.cpp >+JSXRWebGLLayer.cpp >+JSXRWebGLLayerInit.cpp >+ >+#endif >+ > #if ENABLE_GAMEPAD > > JSGamepad.cpp >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index df023ebd4eddbf693405723697ade9bf53968589..33bfe17096cc3e129602001760903d6f42db673a 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -4800,6 +4800,60 @@ > E1E6EEA80B628DB3005F2F70 /* JSHTMLSelectElement.h in Headers */ = {isa = PBXBuildFile; fileRef = E1E6EEA70B628DB3005F2F70 /* JSHTMLSelectElement.h */; }; > E1EC29A00BB04C6B00EA187B /* XPathNodeSet.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EC299E0BB04C6B00EA187B /* XPathNodeSet.h */; settings = {ATTRIBUTES = (Private, ); }; }; > E1ED8AC30CC49BE000BFC557 /* CSSPrimitiveValueMappings.h in Headers */ = {isa = PBXBuildFile; fileRef = E1ED8AC20CC49BE000BFC557 /* CSSPrimitiveValueMappings.h */; settings = {ATTRIBUTES = (Private, ); }; }; >+ E1EE8B702412B2A800E794D6 /* PlatformXR.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1EE8B6C2412B2A700E794D6 /* PlatformXR.cpp */; }; >+ E1EE8B712412B2A800E794D6 /* PlatformXR.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1EE8B6E2412B2A700E794D6 /* PlatformXR.cpp */; }; >+ E1EE8B722412B2A800E794D6 /* PlatformXR.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE8B6F2412B2A700E794D6 /* PlatformXR.h */; }; >+ E1EE8B762413191F00E794D6 /* XRViewerPose.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE8AC72412B16F00E794D6 /* XRViewerPose.h */; }; >+ E1EE8B772413191F00E794D6 /* XRReferenceSpaceType.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE8AC92412B17000E794D6 /* XRReferenceSpaceType.h */; }; >+ E1EE8B782413191F00E794D6 /* NavigatorWebXR.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE8ACA2412B17000E794D6 /* NavigatorWebXR.h */; }; >+ E1EE8B792413191F00E794D6 /* XRRenderStateInit.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE8ACB2412B17000E794D6 /* XRRenderStateInit.h */; }; >+ E1EE8B7A2413191F00E794D6 /* XRInputSourceEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1EE8ACC2412B17000E794D6 /* XRInputSourceEvent.cpp */; }; >+ E1EE8B7B2413191F00E794D6 /* XRRigidTransform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1EE8ACD2412B17000E794D6 /* XRRigidTransform.cpp */; }; >+ E1EE8B7C2413191F00E794D6 /* XRRenderState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1EE8ACE2412B17000E794D6 /* XRRenderState.cpp */; }; >+ E1EE8B7D2413191F00E794D6 /* XRSpace.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE8ACF2412B17000E794D6 /* XRSpace.h */; }; >+ E1EE8B7E2413191F00E794D6 /* XRBoundedReferenceSpace.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE8AD12412B17000E794D6 /* XRBoundedReferenceSpace.h */; }; >+ E1EE8B7F2413191F00E794D6 /* XRReferenceSpace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1EE8AD22412B17000E794D6 /* XRReferenceSpace.cpp */; }; >+ E1EE8B802413191F00E794D6 /* XRBoundedReferenceSpace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1EE8AD32412B17000E794D6 /* XRBoundedReferenceSpace.cpp */; }; >+ E1EE8B812413191F00E794D6 /* XRRenderState.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE8AD52412B17000E794D6 /* XRRenderState.h */; }; >+ E1EE8B822413191F00E794D6 /* XRVisibilityState.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE8AD62412B17000E794D6 /* XRVisibilityState.h */; }; >+ E1EE8B832413191F00E794D6 /* XRWebGLLayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1EE8AD82412B17000E794D6 /* XRWebGLLayer.cpp */; }; >+ E1EE8B842413191F00E794D6 /* XRReferenceSpaceEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE8ADB2412B17000E794D6 /* XRReferenceSpaceEvent.h */; }; >+ E1EE8B852413191F00E794D6 /* XRSessionEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1EE8ADC2412B17000E794D6 /* XRSessionEvent.cpp */; }; >+ E1EE8B862413191F00E794D6 /* XRInputSourceArray.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE8ADD2412B17000E794D6 /* XRInputSourceArray.h */; }; >+ E1EE8B872413191F00E794D6 /* XRView.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE8AE02412B17000E794D6 /* XRView.h */; }; >+ E1EE8B882413191F00E794D6 /* XRPose.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE8AE12412B17000E794D6 /* XRPose.h */; }; >+ E1EE8B892413191F00E794D6 /* XRSystem.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE8AE22412B17000E794D6 /* XRSystem.h */; }; >+ E1EE8B8A2413191F00E794D6 /* XRFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE8AE32412B17000E794D6 /* XRFrame.h */; }; >+ E1EE8B8B2413191F00E794D6 /* XRPose.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1EE8AE52412B17000E794D6 /* XRPose.cpp */; }; >+ E1EE8B8C2413191F00E794D6 /* XRInputSourceArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1EE8AE62412B17000E794D6 /* XRInputSourceArray.cpp */; }; >+ E1EE8B8D2413195000E794D6 /* XRSessionEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE8AE72412B17000E794D6 /* XRSessionEvent.h */; }; >+ E1EE8B8E2413195000E794D6 /* XRSystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1EE8AE82412B17000E794D6 /* XRSystem.cpp */; }; >+ E1EE8B8F2413195000E794D6 /* XRFrameRequestCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE8AE92412B17000E794D6 /* XRFrameRequestCallback.h */; }; >+ E1EE8B902413195000E794D6 /* XRTargetRayMode.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE8AEA2412B17000E794D6 /* XRTargetRayMode.h */; }; >+ E1EE8B912413195000E794D6 /* XRViewport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1EE8AEB2412B17000E794D6 /* XRViewport.cpp */; }; >+ E1EE8B922413195000E794D6 /* XRHandedness.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE8AEE2412B17000E794D6 /* XRHandedness.h */; }; >+ E1EE8B932413195000E794D6 /* XRFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1EE8AF02412B17000E794D6 /* XRFrame.cpp */; }; >+ E1EE8B942413195000E794D6 /* NavigatorWebXR.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1EE8AF12412B17000E794D6 /* NavigatorWebXR.cpp */; }; >+ E1EE8B952413195000E794D6 /* XRReferenceSpaceEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1EE8AF32412B17000E794D6 /* XRReferenceSpaceEvent.cpp */; }; >+ E1EE8B962413195000E794D6 /* XRViewport.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE8AF42412B17000E794D6 /* XRViewport.h */; }; >+ E1EE8B972413195000E794D6 /* XREye.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE8AF52412B17000E794D6 /* XREye.h */; }; >+ E1EE8B982413195000E794D6 /* XRSpace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1EE8AF82412B17000E794D6 /* XRSpace.cpp */; }; >+ E1EE8B992413195000E794D6 /* XRInputSourcesChangeEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE8AF92412B17000E794D6 /* XRInputSourcesChangeEvent.h */; }; >+ E1EE8B9A2413195000E794D6 /* XRSessionMode.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE8AFE2412B17000E794D6 /* XRSessionMode.h */; }; >+ E1EE8B9B2413195000E794D6 /* XRWebGLLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE8B042412B17000E794D6 /* XRWebGLLayer.h */; }; >+ E1EE8B9C2413195000E794D6 /* XREnvironmentBlendMode.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE8B052412B17000E794D6 /* XREnvironmentBlendMode.h */; }; >+ E1EE8B9D2413195000E794D6 /* XRRigidTransform.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE8B062412B17000E794D6 /* XRRigidTransform.h */; }; >+ E1EE8B9E2413195000E794D6 /* XRWebGLLayerInit.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE8B082412B17000E794D6 /* XRWebGLLayerInit.h */; }; >+ E1EE8B9F2413195000E794D6 /* XRInputSourceEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE8B092412B17000E794D6 /* XRInputSourceEvent.h */; }; >+ E1EE8BA02413195000E794D6 /* XRViewerPose.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1EE8B0B2412B17000E794D6 /* XRViewerPose.cpp */; }; >+ E1EE8BA12413196300E794D6 /* XRInputSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1EE8B0D2412B17000E794D6 /* XRInputSource.cpp */; }; >+ E1EE8BA22413196300E794D6 /* XRSession.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1EE8B0F2412B17000E794D6 /* XRSession.cpp */; }; >+ E1EE8BA32413196300E794D6 /* XRSession.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE8B112412B17000E794D6 /* XRSession.h */; }; >+ E1EE8BA42413196300E794D6 /* XRView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1EE8B122412B17000E794D6 /* XRView.cpp */; }; >+ E1EE8BA52413196300E794D6 /* XRSessionInit.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE8B132412B17000E794D6 /* XRSessionInit.h */; }; >+ E1EE8BA62413196300E794D6 /* XRReferenceSpace.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE8B142412B17000E794D6 /* XRReferenceSpace.h */; }; >+ E1EE8BA72413196300E794D6 /* XRInputSourcesChangeEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1EE8B152412B17000E794D6 /* XRInputSourcesChangeEvent.cpp */; }; >+ E1EE8BA82413196300E794D6 /* XRInputSource.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE8B172412B17000E794D6 /* XRInputSource.h */; }; > E1F1E8300C3C2BB9006DB391 /* XSLTExtensions.h in Headers */ = {isa = PBXBuildFile; fileRef = E1F1E82E0C3C2BB9006DB391 /* XSLTExtensions.h */; }; > E1F80B8818317252007885C3 /* CryptoKeyPair.h in Headers */ = {isa = PBXBuildFile; fileRef = E1F80B8618317252007885C3 /* CryptoKeyPair.h */; settings = {ATTRIBUTES = (Private, ); }; }; > E1F80B8E183172B5007885C3 /* JSCryptoKeyPair.h in Headers */ = {isa = PBXBuildFile; fileRef = E1F80B8C183172B5007885C3 /* JSCryptoKeyPair.h */; }; >@@ -15114,6 +15168,91 @@ > E1EC299D0BB04C6B00EA187B /* XPathNodeSet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XPathNodeSet.cpp; sourceTree = "<group>"; }; > E1EC299E0BB04C6B00EA187B /* XPathNodeSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPathNodeSet.h; sourceTree = "<group>"; }; > E1ED8AC20CC49BE000BFC557 /* CSSPrimitiveValueMappings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSPrimitiveValueMappings.h; sourceTree = "<group>"; }; >+ E1EE8AC72412B16F00E794D6 /* XRViewerPose.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XRViewerPose.h; sourceTree = "<group>"; }; >+ E1EE8AC82412B16F00E794D6 /* XRSessionMode.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XRSessionMode.idl; sourceTree = "<group>"; }; >+ E1EE8AC92412B17000E794D6 /* XRReferenceSpaceType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XRReferenceSpaceType.h; sourceTree = "<group>"; }; >+ E1EE8ACA2412B17000E794D6 /* NavigatorWebXR.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NavigatorWebXR.h; sourceTree = "<group>"; }; >+ E1EE8ACB2412B17000E794D6 /* XRRenderStateInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XRRenderStateInit.h; sourceTree = "<group>"; }; >+ E1EE8ACC2412B17000E794D6 /* XRInputSourceEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XRInputSourceEvent.cpp; sourceTree = "<group>"; }; >+ E1EE8ACD2412B17000E794D6 /* XRRigidTransform.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XRRigidTransform.cpp; sourceTree = "<group>"; }; >+ E1EE8ACE2412B17000E794D6 /* XRRenderState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XRRenderState.cpp; sourceTree = "<group>"; }; >+ E1EE8ACF2412B17000E794D6 /* XRSpace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XRSpace.h; sourceTree = "<group>"; }; >+ E1EE8AD02412B17000E794D6 /* XRReferenceSpaceEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XRReferenceSpaceEvent.idl; sourceTree = "<group>"; }; >+ E1EE8AD12412B17000E794D6 /* XRBoundedReferenceSpace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XRBoundedReferenceSpace.h; sourceTree = "<group>"; }; >+ E1EE8AD22412B17000E794D6 /* XRReferenceSpace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XRReferenceSpace.cpp; sourceTree = "<group>"; }; >+ E1EE8AD32412B17000E794D6 /* XRBoundedReferenceSpace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XRBoundedReferenceSpace.cpp; sourceTree = "<group>"; }; >+ E1EE8AD42412B17000E794D6 /* XRSpace.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XRSpace.idl; sourceTree = "<group>"; }; >+ E1EE8AD52412B17000E794D6 /* XRRenderState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XRRenderState.h; sourceTree = "<group>"; }; >+ E1EE8AD62412B17000E794D6 /* XRVisibilityState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XRVisibilityState.h; sourceTree = "<group>"; }; >+ E1EE8AD72412B17000E794D6 /* XRSessionInit.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XRSessionInit.idl; sourceTree = "<group>"; }; >+ E1EE8AD82412B17000E794D6 /* XRWebGLLayer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XRWebGLLayer.cpp; sourceTree = "<group>"; }; >+ E1EE8AD92412B17000E794D6 /* XRVisibilityState.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XRVisibilityState.idl; sourceTree = "<group>"; }; >+ E1EE8ADA2412B17000E794D6 /* XREnvironmentBlendMode.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XREnvironmentBlendMode.idl; sourceTree = "<group>"; }; >+ E1EE8ADB2412B17000E794D6 /* XRReferenceSpaceEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XRReferenceSpaceEvent.h; sourceTree = "<group>"; }; >+ E1EE8ADC2412B17000E794D6 /* XRSessionEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XRSessionEvent.cpp; sourceTree = "<group>"; }; >+ E1EE8ADD2412B17000E794D6 /* XRInputSourceArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XRInputSourceArray.h; sourceTree = "<group>"; }; >+ E1EE8ADE2412B17000E794D6 /* XRSession.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XRSession.idl; sourceTree = "<group>"; }; >+ E1EE8ADF2412B17000E794D6 /* XRView.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XRView.idl; sourceTree = "<group>"; }; >+ E1EE8AE02412B17000E794D6 /* XRView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XRView.h; sourceTree = "<group>"; }; >+ E1EE8AE12412B17000E794D6 /* XRPose.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XRPose.h; sourceTree = "<group>"; }; >+ E1EE8AE22412B17000E794D6 /* XRSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XRSystem.h; sourceTree = "<group>"; }; >+ E1EE8AE32412B17000E794D6 /* XRFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XRFrame.h; sourceTree = "<group>"; }; >+ E1EE8AE42412B17000E794D6 /* XRInputSourcesChangeEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XRInputSourcesChangeEvent.idl; sourceTree = "<group>"; }; >+ E1EE8AE52412B17000E794D6 /* XRPose.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XRPose.cpp; sourceTree = "<group>"; }; >+ E1EE8AE62412B17000E794D6 /* XRInputSourceArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XRInputSourceArray.cpp; sourceTree = "<group>"; }; >+ E1EE8AE72412B17000E794D6 /* XRSessionEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XRSessionEvent.h; sourceTree = "<group>"; }; >+ E1EE8AE82412B17000E794D6 /* XRSystem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XRSystem.cpp; sourceTree = "<group>"; }; >+ E1EE8AE92412B17000E794D6 /* XRFrameRequestCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XRFrameRequestCallback.h; sourceTree = "<group>"; }; >+ E1EE8AEA2412B17000E794D6 /* XRTargetRayMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XRTargetRayMode.h; sourceTree = "<group>"; }; >+ E1EE8AEB2412B17000E794D6 /* XRViewport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XRViewport.cpp; sourceTree = "<group>"; }; >+ E1EE8AEC2412B17000E794D6 /* XRRenderStateInit.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XRRenderStateInit.idl; sourceTree = "<group>"; }; >+ E1EE8AED2412B17000E794D6 /* XRViewerPose.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XRViewerPose.idl; sourceTree = "<group>"; }; >+ E1EE8AEE2412B17000E794D6 /* XRHandedness.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XRHandedness.h; sourceTree = "<group>"; }; >+ E1EE8AEF2412B17000E794D6 /* XRInputSource.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XRInputSource.idl; sourceTree = "<group>"; }; >+ E1EE8AF02412B17000E794D6 /* XRFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XRFrame.cpp; sourceTree = "<group>"; }; >+ E1EE8AF12412B17000E794D6 /* NavigatorWebXR.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NavigatorWebXR.cpp; sourceTree = "<group>"; }; >+ E1EE8AF22412B17000E794D6 /* XRRenderState.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XRRenderState.idl; sourceTree = "<group>"; }; >+ E1EE8AF32412B17000E794D6 /* XRReferenceSpaceEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XRReferenceSpaceEvent.cpp; sourceTree = "<group>"; }; >+ E1EE8AF42412B17000E794D6 /* XRViewport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XRViewport.h; sourceTree = "<group>"; }; >+ E1EE8AF52412B17000E794D6 /* XREye.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XREye.h; sourceTree = "<group>"; }; >+ E1EE8AF62412B17000E794D6 /* XRReferenceSpace.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XRReferenceSpace.idl; sourceTree = "<group>"; }; >+ E1EE8AF72412B17000E794D6 /* XRBoundedReferenceSpace.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XRBoundedReferenceSpace.idl; sourceTree = "<group>"; }; >+ E1EE8AF82412B17000E794D6 /* XRSpace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XRSpace.cpp; sourceTree = "<group>"; }; >+ E1EE8AF92412B17000E794D6 /* XRInputSourcesChangeEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XRInputSourcesChangeEvent.h; sourceTree = "<group>"; }; >+ E1EE8AFA2412B17000E794D6 /* XRReferenceSpaceType.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XRReferenceSpaceType.idl; sourceTree = "<group>"; }; >+ E1EE8AFB2412B17000E794D6 /* XRFrameRequestCallback.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XRFrameRequestCallback.idl; sourceTree = "<group>"; }; >+ E1EE8AFC2412B17000E794D6 /* XRWebGLLayer.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XRWebGLLayer.idl; sourceTree = "<group>"; }; >+ E1EE8AFD2412B17000E794D6 /* XRSessionEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XRSessionEvent.idl; sourceTree = "<group>"; }; >+ E1EE8AFE2412B17000E794D6 /* XRSessionMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XRSessionMode.h; sourceTree = "<group>"; }; >+ E1EE8AFF2412B17000E794D6 /* XRTargetRayMode.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XRTargetRayMode.idl; sourceTree = "<group>"; }; >+ E1EE8B002412B17000E794D6 /* XRInputSourceEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XRInputSourceEvent.idl; sourceTree = "<group>"; }; >+ E1EE8B012412B17000E794D6 /* XRRigidTransform.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XRRigidTransform.idl; sourceTree = "<group>"; }; >+ E1EE8B022412B17000E794D6 /* XRSystem.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XRSystem.idl; sourceTree = "<group>"; }; >+ E1EE8B032412B17000E794D6 /* XREye.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XREye.idl; sourceTree = "<group>"; }; >+ E1EE8B042412B17000E794D6 /* XRWebGLLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XRWebGLLayer.h; sourceTree = "<group>"; }; >+ E1EE8B052412B17000E794D6 /* XREnvironmentBlendMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XREnvironmentBlendMode.h; sourceTree = "<group>"; }; >+ E1EE8B062412B17000E794D6 /* XRRigidTransform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XRRigidTransform.h; sourceTree = "<group>"; }; >+ E1EE8B072412B17000E794D6 /* XRHandedness.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XRHandedness.idl; sourceTree = "<group>"; }; >+ E1EE8B082412B17000E794D6 /* XRWebGLLayerInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XRWebGLLayerInit.h; sourceTree = "<group>"; }; >+ E1EE8B092412B17000E794D6 /* XRInputSourceEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XRInputSourceEvent.h; sourceTree = "<group>"; }; >+ E1EE8B0A2412B17000E794D6 /* XRViewport.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XRViewport.idl; sourceTree = "<group>"; }; >+ E1EE8B0B2412B17000E794D6 /* XRViewerPose.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XRViewerPose.cpp; sourceTree = "<group>"; }; >+ E1EE8B0C2412B17000E794D6 /* XRFrame.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XRFrame.idl; sourceTree = "<group>"; }; >+ E1EE8B0D2412B17000E794D6 /* XRInputSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XRInputSource.cpp; sourceTree = "<group>"; }; >+ E1EE8B0E2412B17000E794D6 /* NavigatorWebXR.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NavigatorWebXR.idl; sourceTree = "<group>"; }; >+ E1EE8B0F2412B17000E794D6 /* XRSession.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XRSession.cpp; sourceTree = "<group>"; }; >+ E1EE8B102412B17000E794D6 /* XRWebGLLayerInit.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XRWebGLLayerInit.idl; sourceTree = "<group>"; }; >+ E1EE8B112412B17000E794D6 /* XRSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XRSession.h; sourceTree = "<group>"; }; >+ E1EE8B122412B17000E794D6 /* XRView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XRView.cpp; sourceTree = "<group>"; }; >+ E1EE8B132412B17000E794D6 /* XRSessionInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XRSessionInit.h; sourceTree = "<group>"; }; >+ E1EE8B142412B17000E794D6 /* XRReferenceSpace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XRReferenceSpace.h; sourceTree = "<group>"; }; >+ E1EE8B152412B17000E794D6 /* XRInputSourcesChangeEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XRInputSourcesChangeEvent.cpp; sourceTree = "<group>"; }; >+ E1EE8B162412B17000E794D6 /* XRPose.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XRPose.idl; sourceTree = "<group>"; }; >+ E1EE8B172412B17000E794D6 /* XRInputSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XRInputSource.h; sourceTree = "<group>"; }; >+ E1EE8B182412B17000E794D6 /* XRInputSourceArray.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XRInputSourceArray.idl; sourceTree = "<group>"; }; >+ E1EE8B6C2412B2A700E794D6 /* PlatformXR.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformXR.cpp; sourceTree = "<group>"; }; >+ E1EE8B6E2412B2A700E794D6 /* PlatformXR.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformXR.cpp; sourceTree = "<group>"; }; >+ E1EE8B6F2412B2A700E794D6 /* PlatformXR.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformXR.h; sourceTree = "<group>"; }; > E1F1E82D0C3C2BB9006DB391 /* XSLTExtensions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XSLTExtensions.cpp; sourceTree = "<group>"; }; > E1F1E82E0C3C2BB9006DB391 /* XSLTExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XSLTExtensions.h; sourceTree = "<group>"; }; > E1F80B8418317247007885C3 /* CryptoKeyPair.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CryptoKeyPair.idl; sourceTree = "<group>"; }; >@@ -22338,6 +22477,7 @@ > 996E59DA1DF00D45006612B9 /* webdriver */, > D00F593E216ECC43000D71DB /* webgpu */, > 97AABCF714FA09B5007457AE /* websockets */, >+ E1EE8AC62412B16F00E794D6 /* webxr */, > ); > path = Modules; > sourceTree = "<group>"; >@@ -25885,6 +26025,7 @@ > 656B84D70AEA1CE900A095B4 /* network */, > 1A2E6E560CC551E0004A2062 /* sql */, > B2C3D9EC0D006C1D00EF6F26 /* text */, >+ E1EE8B6B2412B2A700E794D6 /* xr */, > DFDB912CF8E88A6DA1AD264F /* AbortableTaskQueue.h */, > 49AE2D94134EE5F90072920A /* CalculationValue.cpp */, > 49AE2D95134EE5F90072920A /* CalculationValue.h */, >@@ -26970,6 +27111,113 @@ > name = Threads; > sourceTree = "<group>"; > }; >+ E1EE8AC62412B16F00E794D6 /* webxr */ = { >+ isa = PBXGroup; >+ children = ( >+ E1EE8AF12412B17000E794D6 /* NavigatorWebXR.cpp */, >+ E1EE8ACA2412B17000E794D6 /* NavigatorWebXR.h */, >+ E1EE8B0E2412B17000E794D6 /* NavigatorWebXR.idl */, >+ E1EE8AD32412B17000E794D6 /* XRBoundedReferenceSpace.cpp */, >+ E1EE8AD12412B17000E794D6 /* XRBoundedReferenceSpace.h */, >+ E1EE8AF72412B17000E794D6 /* XRBoundedReferenceSpace.idl */, >+ E1EE8B052412B17000E794D6 /* XREnvironmentBlendMode.h */, >+ E1EE8ADA2412B17000E794D6 /* XREnvironmentBlendMode.idl */, >+ E1EE8AF52412B17000E794D6 /* XREye.h */, >+ E1EE8B032412B17000E794D6 /* XREye.idl */, >+ E1EE8AF02412B17000E794D6 /* XRFrame.cpp */, >+ E1EE8AE32412B17000E794D6 /* XRFrame.h */, >+ E1EE8B0C2412B17000E794D6 /* XRFrame.idl */, >+ E1EE8AE92412B17000E794D6 /* XRFrameRequestCallback.h */, >+ E1EE8AFB2412B17000E794D6 /* XRFrameRequestCallback.idl */, >+ E1EE8AEE2412B17000E794D6 /* XRHandedness.h */, >+ E1EE8B072412B17000E794D6 /* XRHandedness.idl */, >+ E1EE8B0D2412B17000E794D6 /* XRInputSource.cpp */, >+ E1EE8B172412B17000E794D6 /* XRInputSource.h */, >+ E1EE8AEF2412B17000E794D6 /* XRInputSource.idl */, >+ E1EE8AE62412B17000E794D6 /* XRInputSourceArray.cpp */, >+ E1EE8ADD2412B17000E794D6 /* XRInputSourceArray.h */, >+ E1EE8B182412B17000E794D6 /* XRInputSourceArray.idl */, >+ E1EE8ACC2412B17000E794D6 /* XRInputSourceEvent.cpp */, >+ E1EE8B092412B17000E794D6 /* XRInputSourceEvent.h */, >+ E1EE8B002412B17000E794D6 /* XRInputSourceEvent.idl */, >+ E1EE8B152412B17000E794D6 /* XRInputSourcesChangeEvent.cpp */, >+ E1EE8AF92412B17000E794D6 /* XRInputSourcesChangeEvent.h */, >+ E1EE8AE42412B17000E794D6 /* XRInputSourcesChangeEvent.idl */, >+ E1EE8AE52412B17000E794D6 /* XRPose.cpp */, >+ E1EE8AE12412B17000E794D6 /* XRPose.h */, >+ E1EE8B162412B17000E794D6 /* XRPose.idl */, >+ E1EE8AD22412B17000E794D6 /* XRReferenceSpace.cpp */, >+ E1EE8B142412B17000E794D6 /* XRReferenceSpace.h */, >+ E1EE8AF62412B17000E794D6 /* XRReferenceSpace.idl */, >+ E1EE8AF32412B17000E794D6 /* XRReferenceSpaceEvent.cpp */, >+ E1EE8ADB2412B17000E794D6 /* XRReferenceSpaceEvent.h */, >+ E1EE8AD02412B17000E794D6 /* XRReferenceSpaceEvent.idl */, >+ E1EE8AC92412B17000E794D6 /* XRReferenceSpaceType.h */, >+ E1EE8AFA2412B17000E794D6 /* XRReferenceSpaceType.idl */, >+ E1EE8ACE2412B17000E794D6 /* XRRenderState.cpp */, >+ E1EE8AD52412B17000E794D6 /* XRRenderState.h */, >+ E1EE8AF22412B17000E794D6 /* XRRenderState.idl */, >+ E1EE8ACB2412B17000E794D6 /* XRRenderStateInit.h */, >+ E1EE8AEC2412B17000E794D6 /* XRRenderStateInit.idl */, >+ E1EE8ACD2412B17000E794D6 /* XRRigidTransform.cpp */, >+ E1EE8B062412B17000E794D6 /* XRRigidTransform.h */, >+ E1EE8B012412B17000E794D6 /* XRRigidTransform.idl */, >+ E1EE8B0F2412B17000E794D6 /* XRSession.cpp */, >+ E1EE8B112412B17000E794D6 /* XRSession.h */, >+ E1EE8ADE2412B17000E794D6 /* XRSession.idl */, >+ E1EE8ADC2412B17000E794D6 /* XRSessionEvent.cpp */, >+ E1EE8AE72412B17000E794D6 /* XRSessionEvent.h */, >+ E1EE8AFD2412B17000E794D6 /* XRSessionEvent.idl */, >+ E1EE8B132412B17000E794D6 /* XRSessionInit.h */, >+ E1EE8AD72412B17000E794D6 /* XRSessionInit.idl */, >+ E1EE8AFE2412B17000E794D6 /* XRSessionMode.h */, >+ E1EE8AC82412B16F00E794D6 /* XRSessionMode.idl */, >+ E1EE8AF82412B17000E794D6 /* XRSpace.cpp */, >+ E1EE8ACF2412B17000E794D6 /* XRSpace.h */, >+ E1EE8AD42412B17000E794D6 /* XRSpace.idl */, >+ E1EE8AE82412B17000E794D6 /* XRSystem.cpp */, >+ E1EE8AE22412B17000E794D6 /* XRSystem.h */, >+ E1EE8B022412B17000E794D6 /* XRSystem.idl */, >+ E1EE8AEA2412B17000E794D6 /* XRTargetRayMode.h */, >+ E1EE8AFF2412B17000E794D6 /* XRTargetRayMode.idl */, >+ E1EE8B122412B17000E794D6 /* XRView.cpp */, >+ E1EE8AE02412B17000E794D6 /* XRView.h */, >+ E1EE8ADF2412B17000E794D6 /* XRView.idl */, >+ E1EE8B0B2412B17000E794D6 /* XRViewerPose.cpp */, >+ E1EE8AC72412B16F00E794D6 /* XRViewerPose.h */, >+ E1EE8AED2412B17000E794D6 /* XRViewerPose.idl */, >+ E1EE8AEB2412B17000E794D6 /* XRViewport.cpp */, >+ E1EE8AF42412B17000E794D6 /* XRViewport.h */, >+ E1EE8B0A2412B17000E794D6 /* XRViewport.idl */, >+ E1EE8AD62412B17000E794D6 /* XRVisibilityState.h */, >+ E1EE8AD92412B17000E794D6 /* XRVisibilityState.idl */, >+ E1EE8AD82412B17000E794D6 /* XRWebGLLayer.cpp */, >+ E1EE8B042412B17000E794D6 /* XRWebGLLayer.h */, >+ E1EE8AFC2412B17000E794D6 /* XRWebGLLayer.idl */, >+ E1EE8B082412B17000E794D6 /* XRWebGLLayerInit.h */, >+ E1EE8B102412B17000E794D6 /* XRWebGLLayerInit.idl */, >+ ); >+ path = webxr; >+ sourceTree = "<group>"; >+ }; >+ E1EE8B6B2412B2A700E794D6 /* xr */ = { >+ isa = PBXGroup; >+ children = ( >+ E1EE8B6D2412B2A700E794D6 /* openxr */, >+ E1EE8B6C2412B2A700E794D6 /* PlatformXR.cpp */, >+ E1EE8B6F2412B2A700E794D6 /* PlatformXR.h */, >+ ); >+ path = xr; >+ sourceTree = "<group>"; >+ }; >+ E1EE8B6D2412B2A700E794D6 /* openxr */ = { >+ isa = PBXGroup; >+ children = ( >+ E1EE8B6E2412B2A700E794D6 /* PlatformXR.cpp */, >+ ); >+ path = openxr; >+ sourceTree = "<group>"; >+ }; > E1F0424309839389006694EA /* xml */ = { > isa = PBXGroup; > children = ( >@@ -31633,6 +31881,7 @@ > 6B507A24234BF34100BE7C62 /* NavigatorIsLoggedIn.h in Headers */, > 5EA725D61ACABD5700EAD17B /* NavigatorMediaDevices.h in Headers */, > 996E59DF1DF0128D006612B9 /* NavigatorWebDriver.h in Headers */, >+ E1EE8B782413191F00E794D6 /* NavigatorWebXR.h in Headers */, > 8A309C9F123950BE00CB9204 /* NestingLevelIncrementer.h in Headers */, > 656D37430ADBA5DE00A4554D /* NetscapePlugInStreamLoader.h in Headers */, > A19D934B1AA11B1E00B46C24 /* NetworkExtensionContentFilter.h in Headers */, >@@ -31845,6 +32094,7 @@ > 074E82BB18A69F0E007EF54C /* PlatformTimeRanges.h in Headers */, > 52B0D4BE1C57FD1E0077CE53 /* PlatformView.h in Headers */, > 935C476B09AC4D4F00A6AAB4 /* PlatformWheelEvent.h in Headers */, >+ E1EE8B722412B2A800E794D6 /* PlatformXR.h in Headers */, > 712BE4801FE864A7002031CC /* PlaybackDirection.h in Headers */, > CDA29A091CBD99F400901CCF /* PlaybackSessionInterface.h in Headers */, > CDA29A321CC01A9500901CCF /* PlaybackSessionInterfaceAVKit.h in Headers */, >@@ -33181,6 +33431,36 @@ > 1AB7FC840A8B92EC00D9D37B /* XPathUtil.h in Headers */, > 1AB7FC860A8B92EC00D9D37B /* XPathValue.h in Headers */, > 1AB7FC880A8B92EC00D9D37B /* XPathVariableReference.h in Headers */, >+ E1EE8B7E2413191F00E794D6 /* XRBoundedReferenceSpace.h in Headers */, >+ E1EE8B9C2413195000E794D6 /* XREnvironmentBlendMode.h in Headers */, >+ E1EE8B972413195000E794D6 /* XREye.h in Headers */, >+ E1EE8B8A2413191F00E794D6 /* XRFrame.h in Headers */, >+ E1EE8B8F2413195000E794D6 /* XRFrameRequestCallback.h in Headers */, >+ E1EE8B922413195000E794D6 /* XRHandedness.h in Headers */, >+ E1EE8BA82413196300E794D6 /* XRInputSource.h in Headers */, >+ E1EE8B862413191F00E794D6 /* XRInputSourceArray.h in Headers */, >+ E1EE8B9F2413195000E794D6 /* XRInputSourceEvent.h in Headers */, >+ E1EE8B992413195000E794D6 /* XRInputSourcesChangeEvent.h in Headers */, >+ E1EE8B882413191F00E794D6 /* XRPose.h in Headers */, >+ E1EE8BA62413196300E794D6 /* XRReferenceSpace.h in Headers */, >+ E1EE8B842413191F00E794D6 /* XRReferenceSpaceEvent.h in Headers */, >+ E1EE8B772413191F00E794D6 /* XRReferenceSpaceType.h in Headers */, >+ E1EE8B812413191F00E794D6 /* XRRenderState.h in Headers */, >+ E1EE8B792413191F00E794D6 /* XRRenderStateInit.h in Headers */, >+ E1EE8B9D2413195000E794D6 /* XRRigidTransform.h in Headers */, >+ E1EE8BA32413196300E794D6 /* XRSession.h in Headers */, >+ E1EE8B8D2413195000E794D6 /* XRSessionEvent.h in Headers */, >+ E1EE8BA52413196300E794D6 /* XRSessionInit.h in Headers */, >+ E1EE8B9A2413195000E794D6 /* XRSessionMode.h in Headers */, >+ E1EE8B7D2413191F00E794D6 /* XRSpace.h in Headers */, >+ E1EE8B892413191F00E794D6 /* XRSystem.h in Headers */, >+ E1EE8B902413195000E794D6 /* XRTargetRayMode.h in Headers */, >+ E1EE8B872413191F00E794D6 /* XRView.h in Headers */, >+ E1EE8B762413191F00E794D6 /* XRViewerPose.h in Headers */, >+ E1EE8B962413195000E794D6 /* XRViewport.h in Headers */, >+ E1EE8B822413191F00E794D6 /* XRVisibilityState.h in Headers */, >+ E1EE8B9B2413195000E794D6 /* XRWebGLLayer.h in Headers */, >+ E1EE8B9E2413195000E794D6 /* XRWebGLLayerInit.h in Headers */, > 85217E030A5ECD4700DB8D00 /* XSLImportRule.h in Headers */, > 93F199EC08245E59001E9ABC /* XSLStyleSheet.h in Headers */, > E1F1E8300C3C2BB9006DB391 /* XSLTExtensions.h in Headers */, >@@ -33713,6 +33993,7 @@ > CDF2B0161820540700F2B424 /* MockSourceBufferPrivate.cpp in Sources */, > 2D9BF7421DBFDC27007A7D99 /* NavigatorEME.cpp in Sources */, > 51A4BB101954D62700FA5C2E /* NavigatorGamepad.cpp in Sources */, >+ E1EE8B942413195000E794D6 /* NavigatorWebXR.cpp in Sources */, > 1A569D130D7E2B82007C3983 /* objc_class.mm in Sources */, > 1A569D160D7E2B82007C3983 /* objc_instance.mm in Sources */, > 1A569D180D7E2B82007C3983 /* objc_runtime.mm in Sources */, >@@ -33720,6 +34001,7 @@ > E16982601134636A00894115 /* ObjCRuntimeObject.mm in Sources */, > CEA284662141E84900E407E8 /* PlatformEventFactoryIOS.mm in Sources */, > AA12DF491743DF83004DAFDF /* PlatformSpeechSynthesizerIOS.mm in Sources */, >+ E1EE8B712412B2A800E794D6 /* PlatformXR.cpp in Sources */, > CDA29A301CBF74D400901CCF /* PlaybackSessionInterfaceAVKit.mm in Sources */, > CDA29A161CBDA56C00901CCF /* PlaybackSessionInterfaceMac.mm in Sources */, > 419242492127B93E00634FCF /* RealtimeOutgoingVideoSourceCocoa.mm in Sources */, >@@ -34382,6 +34664,25 @@ > A833C7CC0A2CF07400D57664 /* XLinkNames.cpp in Sources */, > A833C80C0A2CF25600D57664 /* XMLNames.cpp in Sources */, > E15A36D91104572700B7B639 /* XMLNSNames.cpp in Sources */, >+ E1EE8B802413191F00E794D6 /* XRBoundedReferenceSpace.cpp in Sources */, >+ E1EE8B932413195000E794D6 /* XRFrame.cpp in Sources */, >+ E1EE8BA12413196300E794D6 /* XRInputSource.cpp in Sources */, >+ E1EE8B8C2413191F00E794D6 /* XRInputSourceArray.cpp in Sources */, >+ E1EE8B7A2413191F00E794D6 /* XRInputSourceEvent.cpp in Sources */, >+ E1EE8BA72413196300E794D6 /* XRInputSourcesChangeEvent.cpp in Sources */, >+ E1EE8B8B2413191F00E794D6 /* XRPose.cpp in Sources */, >+ E1EE8B7F2413191F00E794D6 /* XRReferenceSpace.cpp in Sources */, >+ E1EE8B952413195000E794D6 /* XRReferenceSpaceEvent.cpp in Sources */, >+ E1EE8B7C2413191F00E794D6 /* XRRenderState.cpp in Sources */, >+ E1EE8B7B2413191F00E794D6 /* XRRigidTransform.cpp in Sources */, >+ E1EE8BA22413196300E794D6 /* XRSession.cpp in Sources */, >+ E1EE8B852413191F00E794D6 /* XRSessionEvent.cpp in Sources */, >+ E1EE8B982413195000E794D6 /* XRSpace.cpp in Sources */, >+ E1EE8B8E2413195000E794D6 /* XRSystem.cpp in Sources */, >+ E1EE8BA42413196300E794D6 /* XRView.cpp in Sources */, >+ E1EE8BA02413195000E794D6 /* XRViewerPose.cpp in Sources */, >+ E1EE8B912413195000E794D6 /* XRViewport.cpp in Sources */, >+ E1EE8B832413191F00E794D6 /* XRWebGLLayer.cpp in Sources */, > ); > runOnlyForDeploymentPostprocessing = 0; > }; >diff --git a/Source/WebCore/bindings/IDLTypes.h b/Source/WebCore/bindings/IDLTypes.h >index 305bcf5144e02e361e5d32f0475415e58b865ff3..94f3165e1f27ba02ca9d6b32242cd3134eb132b5 100644 >--- a/Source/WebCore/bindings/IDLTypes.h >+++ b/Source/WebCore/bindings/IDLTypes.h >@@ -62,6 +62,7 @@ template<typename T> > struct IDLType { > using ImplementationType = T; > using StorageType = T; >+ using SequenceStorageType = T; > > using ParameterType = T; > using NullableParameterType = Optional<ImplementationType>; >@@ -82,6 +83,7 @@ struct IDLUnsupportedType : IDLType<void> { }; > struct IDLNull : IDLType<std::nullptr_t> { }; > > struct IDLAny : IDLType<JSC::Strong<JSC::Unknown>> { >+ using SequenceStorageType = JSC::JSValue; > using ParameterType = JSC::JSValue; > using NullableParameterType = JSC::JSValue; > >diff --git a/Source/WebCore/bindings/js/JSDOMConvertSequences.h b/Source/WebCore/bindings/js/JSDOMConvertSequences.h >index c49dd938fce27165f747e58fe08a553dbbfdf5c2..86f7f276fc08ae07c01000222d359f0efeb5aebe 100644 >--- a/Source/WebCore/bindings/js/JSDOMConvertSequences.h >+++ b/Source/WebCore/bindings/js/JSDOMConvertSequences.h >@@ -40,7 +40,7 @@ namespace Detail { > > template<typename IDLType> > struct GenericSequenceConverter { >- using ReturnType = Vector<typename IDLType::ImplementationType>; >+ using ReturnType = Vector<typename IDLType::SequenceStorageType>; > > static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSObject* object) > { >diff --git a/Source/WebCore/bindings/js/WebCoreBuiltinNames.h b/Source/WebCore/bindings/js/WebCoreBuiltinNames.h >index 44d50b207c538a19792b4f3226afe65287787209..1882a9effe240c459bd5d342617a0cd933c2d889 100644 >--- a/Source/WebCore/bindings/js/WebCoreBuiltinNames.h >+++ b/Source/WebCore/bindings/js/WebCoreBuiltinNames.h >@@ -235,6 +235,25 @@ namespace WebCore { > macro(WorkletGlobalScope) \ > macro(WritableStream) \ > macro(XMLHttpRequest) \ >+ macro(XRBoundedReferenceSpace) \ >+ macro(XRFrame) \ >+ macro(XRInputSource) \ >+ macro(XRInputSourceArray) \ >+ macro(XRInputSourceEvent) \ >+ macro(XRInputSourcesChangeEvent) \ >+ macro(XRPose) \ >+ macro(XRReferenceSpace) \ >+ macro(XRReferenceSpaceEvent) \ >+ macro(XRRenderState) \ >+ macro(XRRigidTransform) \ >+ macro(XRSession) \ >+ macro(XRSessionEvent) \ >+ macro(XRSpace) \ >+ macro(XRSystem) \ >+ macro(XRView) \ >+ macro(XRViewerPose) \ >+ macro(XRViewport) \ >+ macro(XRWebGLLayer) \ > macro(appendFromJS) \ > macro(associatedReadableByteStreamController) \ > macro(autoAllocateChunkSize) \ >diff --git a/Source/WebCore/dom/EventNames.h b/Source/WebCore/dom/EventNames.h >index d4960b9cf751f411422b670841a05b8bd2c71c28..f8c1d35afcda39d34a6eea7357cc8c348bcadf89 100644 >--- a/Source/WebCore/dom/EventNames.h >+++ b/Source/WebCore/dom/EventNames.h >@@ -148,6 +148,7 @@ namespace WebCore { > macro(icegatheringstatechange) \ > macro(inactive) \ > macro(input) \ >+ macro(inputsourceschange) \ > macro(install) \ > macro(invalid) \ > macro(keydown) \ >@@ -231,6 +232,7 @@ namespace WebCore { > macro(seeked) \ > macro(seeking) \ > macro(select) \ >+ macro(selectend) \ > macro(selectionchange) \ > macro(selectstart) \ > macro(shippingaddresschange) \ >diff --git a/Source/WebCore/dom/EventNames.in b/Source/WebCore/dom/EventNames.in >index 157f331c1ba73c10d5d33496ad25fe653a7c51a2..c793e3f662c6c3ed8ec552ea383ac96fc9fa0983 100644 >--- a/Source/WebCore/dom/EventNames.in >+++ b/Source/WebCore/dom/EventNames.in >@@ -85,3 +85,7 @@ MediaKeyMessageEvent conditional=ENCRYPTED_MEDIA > PointerEvent conditional=POINTER_EVENTS > GPUUncapturedErrorEvent conditional=WEBGPU > EnterPictureInPictureEvent conditional=PICTURE_IN_PICTURE_API >+XRInputSourceEvent conditional=WEBGL >+XRInputSourcesChangeEvent conditional=WEBGL >+XRReferenceSpaceEvent conditional=WEBGL >+XRSessionEvent conditional=WEBGL >diff --git a/Source/WebCore/dom/EventTargetFactory.in b/Source/WebCore/dom/EventTargetFactory.in >index 81e7cc9f0b7650562aabfefe05a5a3ad1bbbb8ff..eb0ae006683a87db7f3b84c55d140a4797b83b55 100644 >--- a/Source/WebCore/dom/EventTargetFactory.in >+++ b/Source/WebCore/dom/EventTargetFactory.in >@@ -58,4 +58,7 @@ Worker > WorkletGlobalScope conditional=CSS_PAINTING_API > XMLHttpRequest > XMLHttpRequestUpload >+XRSession conditional=WEBGL >+XRSpace conditional=WEBGL >+XRSystem conditional=WEBGL > >diff --git a/Source/WebCore/page/RuntimeEnabledFeatures.h b/Source/WebCore/page/RuntimeEnabledFeatures.h >index aa29b8355fb58e13111404516c406701378a1b20..88b2dcd7a6ab6d6494646f33be71278556077c1f 100644 >--- a/Source/WebCore/page/RuntimeEnabledFeatures.h >+++ b/Source/WebCore/page/RuntimeEnabledFeatures.h >@@ -138,6 +138,9 @@ public: > void setInspectorAdditionsEnabled(bool isEnabled) { m_inspectorAdditionsEnabled = isEnabled; } > bool inspectorAdditionsEnabled() const { return m_inspectorAdditionsEnabled; } > >+ void setWebXREnabled(bool isEnabled) { m_webXREnabled = isEnabled; } >+ bool webXREnabled() const { return m_webXREnabled; } >+ > void setAccessibilityObjectModelEnabled(bool isEnabled) { m_accessibilityObjectModelEnabled = isEnabled; } > bool accessibilityObjectModelEnabled() const { return m_accessibilityObjectModelEnabled; } > >@@ -441,6 +444,7 @@ private: > bool m_isWebSocketEnabled { true }; > bool m_fetchAPIKeepAliveEnabled { false }; > bool m_inspectorAdditionsEnabled { false }; >+ bool m_webXREnabled { false }; > bool m_accessibilityObjectModelEnabled { false }; > bool m_ariaReflectionEnabled { true }; > bool m_itpDebugMode { false }; >diff --git a/Source/WebCore/platform/xr/PlatformXR.cpp b/Source/WebCore/platform/xr/PlatformXR.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..17268ee677a379a6bf55170b9904f33bbe771af8 >--- /dev/null >+++ b/Source/WebCore/platform/xr/PlatformXR.cpp >@@ -0,0 +1,21 @@ >+/* >+ * Copyright (C) 2020 Igalia, S.L. >+ * >+ * This library is free software; you can redistribute it and/or >+ * modify it under the terms of the GNU Library General Public >+ * License as published by the Free Software Foundation; either >+ * version 2 of the License, or (at your option) any later version. >+ * >+ * This library is distributed in the hope that it will be useful, >+ * but WITHOUT ANY WARRANTY; without even the implied warranty of >+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >+ * Library General Public License for more details. >+ * >+ * You should have received a copy of the GNU Library General Public License >+ * aint with this library; see the file COPYING.LIB. If not, write to >+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >+ * Boston, MA 02110-1301, USA. >+ */ >+ >+#include "config.h" >+#include "PlatformXR.h" >diff --git a/Source/WebCore/platform/xr/PlatformXR.h b/Source/WebCore/platform/xr/PlatformXR.h >new file mode 100644 >index 0000000000000000000000000000000000000000..35029302b609092e8d7d63293e20bc11b327bc54 >--- /dev/null >+++ b/Source/WebCore/platform/xr/PlatformXR.h >@@ -0,0 +1,48 @@ >+/* >+ * Copyright (C) 2020 Igalia, S.L. >+ * >+ * This library is free software; you can redistribute it and/or >+ * modify it under the terms of the GNU Library General Public >+ * License as published by the Free Software Foundation; either >+ * version 2 of the License, or (at your option) any later version. >+ * >+ * This library is distributed in the hope that it will be useful, >+ * but WITHOUT ANY WARRANTY; without even the implied warranty of >+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >+ * Library General Public License for more details. >+ * >+ * You should have received a copy of the GNU Library General Public License >+ * aint with this library; see the file COPYING.LIB. If not, write to >+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >+ * Boston, MA 02110-1301, USA. >+ */ >+#pragma once >+ >+#include <memory> >+#include <wtf/WeakPtr.h> >+ >+namespace PlatformXR { >+ >+enum class SessionMode { >+ Inline, >+ ImmersiveVr, >+ ImmersiveAr, >+}; >+ >+class Device : public CanMakeWeakPtr<Device> { >+public: >+}; >+ >+class Instance { >+public: >+ static Instance& singleton(); >+ >+private: >+ Instance(); >+ ~Instance(); >+ >+ struct Impl; >+ std::unique_ptr<Impl> m_impl; >+}; >+ >+} // namespace PlatformXR >diff --git a/Source/WebCore/platform/xr/openxr/PlatformXR.cpp b/Source/WebCore/platform/xr/openxr/PlatformXR.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..de8c22b69fbfa06d952f69351a21d592a1d834fc >--- /dev/null >+++ b/Source/WebCore/platform/xr/openxr/PlatformXR.cpp >@@ -0,0 +1,162 @@ >+/* >+ * Copyright (C) 2020 Igalia, S.L. >+ * >+ * This library is free software; you can redistribute it and/or >+ * modify it under the terms of the GNU Library General Public >+ * License as published by the Free Software Foundation; either >+ * version 2 of the License, or (at your option) any later version. >+ * >+ * This library is distributed in the hope that it will be useful, >+ * but WITHOUT ANY WARRANTY; without even the implied warranty of >+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >+ * Library General Public License for more details. >+ * >+ * You should have received a copy of the GNU Library General Public License >+ * aint with this library; see the file COPYING.LIB. If not, write to >+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >+ * Boston, MA 02110-1301, USA. >+ */ >+ >+#include "config.h" >+#include "PlatformXR.h" >+ >+#if USE_OPENXR >+#include <openxr/openxr.h> >+#include <wtf/text/StringConcatenateNumbers.h> >+#include <wtf/text/WTFString.h> >+#endif // USE_OPENXR >+#include <wtf/NeverDestroyed.h> >+ >+namespace PlatformXR { >+ >+#if USE_OPENXR >+ >+template<typename T, XrStructureType StructureType> >+T createStructure() >+{ >+ T object; >+ std::memset(&object, 0, sizeof(T)); >+ object.type = StructureType; >+ object.next = nullptr; >+ return object; >+} >+ >+String resultToString(XrResult value, XrInstance instance) >+{ >+ char buffer[XR_MAX_RESULT_STRING_SIZE]; >+ XrResult result = xrResultToString(instance, value, buffer); >+ if (result == XR_SUCCESS) >+ return String(buffer); >+ return makeString("<unknown ", int(value), ">"); >+} >+ >+#define RETURN_IF_FAILED(result, call, instance) \ >+ if (XR_FAILED(result)) { \ >+ WTFLogAlways("%s %s: %s\n", __func__, call, resultToString(result, instance).utf8().data()); \ >+ return; \ >+ } \ >+ >+#endif // USE_OPENXR >+ >+struct Instance::Impl { >+ WTF_MAKE_FAST_ALLOCATED; >+public: >+ Impl(); >+ ~Impl(); >+ >+#if USE_OPENXR >+ XrInstance m_instance { XR_NULL_HANDLE }; >+#endif // USE_OPENXR >+}; >+ >+Instance::Impl::Impl() >+{ >+#if USE_OPENXR >+ WTFLogAlways("OpenXR: initializing\n"); >+ >+ [&] { >+ uint32_t propertyCountOutput { 0 }; >+ XrResult result = xrEnumerateApiLayerProperties(0, &propertyCountOutput, nullptr); >+ RETURN_IF_FAILED(result, "xrEnumerateApiLayerProperties()", m_instance); >+ >+ if (!propertyCountOutput) { >+ WTFLogAlways("xrEnumerateApiLayerProperties(): no properties\n"); >+ return; >+ } >+ >+ Vector<XrApiLayerProperties> properties(propertyCountOutput); >+ result = xrEnumerateApiLayerProperties(propertyCountOutput, nullptr, properties.data()); >+ RETURN_IF_FAILED(result, "xrEnumerateApiLayerProperties()", m_instance); >+ >+ WTFLogAlways("xrEnumerateApiLayerProperties(): %zu properties\n", properties.size()); >+ }(); >+ >+ [&] { >+ uint32_t propertyCountOutput { 0 }; >+ XrResult result = xrEnumerateInstanceExtensionProperties(nullptr, 0, &propertyCountOutput, nullptr); >+ RETURN_IF_FAILED(result, "xrEnumerateInstanceExtensionProperties()", m_instance); >+ >+ if (!propertyCountOutput) { >+ WTFLogAlways("xrEnumerateInstanceExtensionProperties(): no properties\n"); >+ return; >+ } >+ >+ Vector<XrExtensionProperties> properties(propertyCountOutput, >+ [] { >+ XrExtensionProperties object; >+ std::memset(&object, 0, sizeof(XrExtensionProperties)); >+ object.type = XR_TYPE_EXTENSION_PROPERTIES; >+ return object; >+ }()); >+ uint32_t propertyCountWritten { 0 }; >+ result = xrEnumerateInstanceExtensionProperties(nullptr, propertyCountOutput, &propertyCountWritten, properties.data()); >+ RETURN_IF_FAILED(result, "xrEnumerateInstanceExtensionProperties()", m_instance); >+ >+ WTFLogAlways("xrEnumerateInstanceExtensionProperties(): %zu extension properties\n", properties.size()); >+ for (auto& property : properties) { >+ WTFLogAlways(" extension '%s', version %u\n", >+ property.extensionName, property.extensionVersion); >+ } >+ }(); >+ >+ static const char* s_applicationName = "WebXR (WebKit)"; >+ static const uint32_t s_applicationVersion = 1; >+ >+ { >+ auto createInfo = createStructure<XrInstanceCreateInfo, XR_TYPE_INSTANCE_CREATE_INFO>(); >+ createInfo.createFlags = 0; >+ std::memcpy(createInfo.applicationInfo.applicationName, s_applicationName, XR_MAX_APPLICATION_NAME_SIZE); >+ createInfo.applicationInfo.apiVersion = XR_CURRENT_API_VERSION; >+ createInfo.applicationInfo.applicationVersion = s_applicationVersion; >+ createInfo.enabledApiLayerCount = 0; >+ createInfo.enabledExtensionCount = 0; >+ >+ XrInstance instance; >+ XrResult result = xrCreateInstance(&createInfo, &instance); >+ RETURN_IF_FAILED(result, "xrCreateInstance()", m_instance); >+ >+ m_instance = instance; >+ WTFLogAlways("xrCreateInstance(): using instance %p\n", m_instance); >+ } >+#endif // USE_OPENXR >+} >+ >+Instance::Impl::~Impl() >+{ >+} >+ >+Instance& Instance::singleton() >+{ >+ static LazyNeverDestroyed<Instance> s_instance; >+ static std::once_flag s_onceFlag; >+ std::call_once(s_onceFlag, >+ [&] { >+ s_instance->m_impl = makeUnique<Impl>(); >+ }); >+ return s_instance.get(); >+} >+ >+Instance::Instance() = default; >+Instance::~Instance() = default; >+ >+} // namespace PlatformXR >diff --git a/Source/WebKit/Shared/WebPreferences.yaml b/Source/WebKit/Shared/WebPreferences.yaml >index 50104a9c9bbcaa982fd2f3d71aa23f5a3f6ee98a..fb494b80dbef1a41667a4e7fe74bbef848cab231 100644 >--- a/Source/WebKit/Shared/WebPreferences.yaml >+++ b/Source/WebKit/Shared/WebPreferences.yaml >@@ -1975,6 +1975,15 @@ WebShareFileAPIEnabled: > webcoreBinding: RuntimeEnabledFeatures > category: experimental > >+WebXREnabled: >+ type: bool >+ defaultValue: false >+ humanReadableName: "WebXR Device API" >+ humanReadableDescription: "Adds support for accessing virtual reality (VR) and augmented reality (AR) devices, including sensors and head-mounted displays, on the Web" >+ category: experimental >+ webcoreBinding: RuntimeEnabledFeatures >+ condition: ENABLE(WEBGL) && PLATFORM(WPE) >+ > # Deprecated > > ICECandidateFilteringEnabled: >diff --git a/Source/cmake/FindOpenXR.cmake b/Source/cmake/FindOpenXR.cmake >new file mode 100644 >index 0000000000000000000000000000000000000000..bbfdf04c11edd03900fc4c142ce76a6614830f6e >--- /dev/null >+++ b/Source/cmake/FindOpenXR.cmake >@@ -0,0 +1,47 @@ >+# - Try to find OpenXR. >+# Once done, this will define >+# >+# OPENXR_FOUND - system has WPE. >+# OPENXR_INCLUDE_DIRS - the WPE include directories >+# OPENXR_LIBRARIES - link these to use WPE. >+# >+# Copyright (C) 2019 Igalia S.L. >+# >+# 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 THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS >+# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS >+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; >+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, >+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR >+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF >+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ >+find_package(PkgConfig) >+pkg_check_modules(PC_OPENXR QUIET openxr) >+ >+find_path(OPENXR_INCLUDE_DIRS >+ NAMES openxr/openxr.h >+ HINTS ${PC_OPENXR_INCLUDEDIR} ${PC_OPENXR_INCLUDE_DIRS} >+) >+ >+find_library(OPENXR_LIBRARIES >+ NAMES openxr_loader >+ HINTS ${PC_OPENXR_LIBDIR} ${PC_OPENXR_LIBRARY_DIRS} >+) >+ >+mark_as_advanced(OPENXR_INCLUDE_DIRS OPENXR_LIBRARIES) >+ >+include(FindPackageHandleStandardArgs) >+find_package_handle_standard_args(OpenXR REQUIRED_VARS OPENXR_INCLUDE_DIRS OPENXR_LIBRARIES) >diff --git a/Source/cmake/OptionsWPE.cmake b/Source/cmake/OptionsWPE.cmake >index 1abe95320d5a6378cf2a7d09aa9ff8d4a7a04c4c..967568bedb9d2f764f747afd3386460dd31e56fa 100644 >--- a/Source/cmake/OptionsWPE.cmake >+++ b/Source/cmake/OptionsWPE.cmake >@@ -172,6 +172,9 @@ if (ENABLE_WPE_QT_API OR USE_WPE_VIDEO_PLANE_DISPLAY_DMABUF) > find_package(WPEBackend-fdo 1.5.0 REQUIRED) > endif () > >+find_package(OpenXR) >+SET_AND_EXPOSE_TO_BUILD(USE_OPENXR ${OPENXR_FOUND}) >+ > add_definitions(-DBUILDING_WPE__=1) > add_definitions(-DGETTEXT_PACKAGE="WPE") > add_definitions(-DJSC_GLIB_API_ENABLED) >diff --git a/ChangeLog b/ChangeLog >index 8f85012360492053fd033adc5dd6d8dd1b17a9dd..0ba2ec41612fd8f6fea575a4e6985053f6cdd44f 100644 >--- a/ChangeLog >+++ b/ChangeLog >@@ -1,3 +1,18 @@ >+2020-03-06 Sergio Villar Senin <svillar@igalia.com> >+ >+ [WebXR] IDLs, stubs and build configuration for WPE >+ https://bugs.webkit.org/show_bug.cgi?id=208702 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Added OpenXR detection and USE_OPENXR define to be used in the sources. >+ It also adds a dependency between USE_OPENXR and ENABLE_WEBGL. >+ >+ Largely based on previous work by Žan DoberÅ¡ek. >+ >+ * Source/cmake/FindOpenXR.cmake: Added. >+ * Source/cmake/OptionsWPE.cmake: >+ > 2020-03-03 Fujii Hironori <fujii.hironori@gmail.com> > > [Curl] Add TLS debugging feature to log encryption keys
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 208702
:
392699
|
392700
|
393019
|
393046
|
393218
|
393250
|
393527
|
393533
|
393612
|
393613
|
393639