diff options
Diffstat (limited to 'components/script/dom/webidls')
-rw-r--r-- | components/script/dom/webidls/VR.webidl | 11 | ||||
-rw-r--r-- | components/script/dom/webidls/XR.webidl | 30 | ||||
-rw-r--r-- | components/script/dom/webidls/XRFrame.webidl | 13 | ||||
-rw-r--r-- | components/script/dom/webidls/XRLayer.webidl | 8 | ||||
-rw-r--r-- | components/script/dom/webidls/XRReferenceSpace.webidl | 21 | ||||
-rw-r--r-- | components/script/dom/webidls/XRRigidTransform.webidl | 13 | ||||
-rw-r--r-- | components/script/dom/webidls/XRSession.webidl | 45 | ||||
-rw-r--r-- | components/script/dom/webidls/XRSpace.webidl | 10 | ||||
-rw-r--r-- | components/script/dom/webidls/XRStationaryReferenceSpace.webidl | 20 | ||||
-rw-r--r-- | components/script/dom/webidls/XRView.webidl | 18 | ||||
-rw-r--r-- | components/script/dom/webidls/XRViewerPose.webidl | 14 | ||||
-rw-r--r-- | components/script/dom/webidls/XRViewport.webidl | 13 | ||||
-rw-r--r-- | components/script/dom/webidls/XRWebGLLayer.webidl | 43 |
13 files changed, 248 insertions, 11 deletions
diff --git a/components/script/dom/webidls/VR.webidl b/components/script/dom/webidls/VR.webidl deleted file mode 100644 index 536bce29338..00000000000 --- a/components/script/dom/webidls/VR.webidl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/webvr/#interface-navigator -[NoInterfaceObject] -interface VR { - [Pref="dom.webvr.enabled"] - Promise<sequence<VRDisplay>> getDisplays(); - //readonly attribute FrozenArray<VRDisplay> activeVRDisplays; -}; diff --git a/components/script/dom/webidls/XR.webidl b/components/script/dom/webidls/XR.webidl new file mode 100644 index 00000000000..4a6bca26a69 --- /dev/null +++ b/components/script/dom/webidls/XR.webidl @@ -0,0 +1,30 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +// https://immersive-web.github.io/webxr/#xr-interface +[SecureContext, Exposed=Window, Pref="dom.webxr.enabled"] +interface XR: EventTarget { + // Methods + Promise<void> supportsSessionMode(XRSessionMode mode); + Promise<XRSession> requestSession(optional XRSessionCreationOptions parameters); + + // Events + // attribute EventHandler ondevicechange; +}; + +[SecureContext] +partial interface Navigator { + [SameObject, Pref="dom.webxr.enabled"] readonly attribute XR xr; +}; + +enum XRSessionMode { + "inline", + "immersive-vr", + "immersive-ar" +}; + +dictionary XRSessionCreationOptions { + XRSessionMode mode = "inline"; + // XRPresentationContext outputContext; +}; diff --git a/components/script/dom/webidls/XRFrame.webidl b/components/script/dom/webidls/XRFrame.webidl new file mode 100644 index 00000000000..6c40306755d --- /dev/null +++ b/components/script/dom/webidls/XRFrame.webidl @@ -0,0 +1,13 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +// https://immersive-web.github.io/webxr/#xrframe-interface + +[SecureContext, Exposed=Window, Pref="dom.webxr.enabled"] +interface XRFrame { + readonly attribute XRSession session; + + XRViewerPose? getViewerPose(optional XRReferenceSpace referenceSpace); + // XRInputPose? getInputPose(XRInputSource inputSource, optional XRReferenceSpace referenceSpace); +}; diff --git a/components/script/dom/webidls/XRLayer.webidl b/components/script/dom/webidls/XRLayer.webidl new file mode 100644 index 00000000000..69c65da6143 --- /dev/null +++ b/components/script/dom/webidls/XRLayer.webidl @@ -0,0 +1,8 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +// https://immersive-web.github.io/webxr/#xrlayer-interface + +[SecureContext, Exposed=Window, Pref="dom.webxr.enabled"] +interface XRLayer {}; diff --git a/components/script/dom/webidls/XRReferenceSpace.webidl b/components/script/dom/webidls/XRReferenceSpace.webidl new file mode 100644 index 00000000000..fdedfe0bb4f --- /dev/null +++ b/components/script/dom/webidls/XRReferenceSpace.webidl @@ -0,0 +1,21 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +// https://immersive-web.github.io/webxr/#xrreferencespace-interface + +enum XRReferenceSpaceType { + "stationary", + "bounded", + "unbounded" +}; + +dictionary XRReferenceSpaceOptions { + required XRReferenceSpaceType type; +}; + +[SecureContext, Exposed=Window, Pref="dom.webxr.enabled"] +interface XRReferenceSpace : XRSpace { + // attribute XRRigidTransform originOffset; + // attribute EventHandler onreset; +}; diff --git a/components/script/dom/webidls/XRRigidTransform.webidl b/components/script/dom/webidls/XRRigidTransform.webidl new file mode 100644 index 00000000000..f7ccd0fb188 --- /dev/null +++ b/components/script/dom/webidls/XRRigidTransform.webidl @@ -0,0 +1,13 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +// https://immersive-web.github.io/webxr/#xrrigidtransform-interface + +[SecureContext, Exposed=Window, Pref="dom.webxr.enabled"] +// [Constructor(optional DOMPointInit position, optional DOMPointInit orientation)] +interface XRRigidTransform { + // readonly attribute DOMPointReadOnly position; + // readonly attribute DOMPointReadOnly orientation; + // readonly attribute Float32Array matrix; +}; diff --git a/components/script/dom/webidls/XRSession.webidl b/components/script/dom/webidls/XRSession.webidl new file mode 100644 index 00000000000..7cf25bf8c36 --- /dev/null +++ b/components/script/dom/webidls/XRSession.webidl @@ -0,0 +1,45 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +// https://immersive-web.github.io/webxr/#xrsession-interface + +enum XREnvironmentBlendMode { + "opaque", + "additive", + "alpha-blend", +}; + +callback XRFrameRequestCallback = void (DOMHighResTimeStamp time, XRFrame frame); + +[SecureContext, Exposed=Window, Pref="dom.webxr.enabled"] +interface XRSession : EventTarget { + // // Attributes + readonly attribute XRSessionMode mode; + // readonly attribute XRPresentationContext outputContext; + // readonly attribute XREnvironmentBlendMode environmentBlendMode; + + attribute double depthNear; + attribute double depthFar; + attribute XRLayer? baseLayer; + + // // Methods + // Promise<XRReferenceSpace> requestReferenceSpace(XRReferenceSpaceType type, + // optional XRReferenceSpaceOptions options); + + // FrozenArray<XRInputSource> getInputSources(); + + long requestAnimationFrame(XRFrameRequestCallback callback); + void cancelAnimationFrame(long handle); + + // Promise<void> end(); + + // // Events + // attribute EventHandler onblur; + // attribute EventHandler onfocus; + // attribute EventHandler onend; + // attribute EventHandler onselect; + // attribute EventHandler oninputsourceschange; + // attribute EventHandler onselectstart; + // attribute EventHandler onselectend; +}; diff --git a/components/script/dom/webidls/XRSpace.webidl b/components/script/dom/webidls/XRSpace.webidl new file mode 100644 index 00000000000..54401b051c8 --- /dev/null +++ b/components/script/dom/webidls/XRSpace.webidl @@ -0,0 +1,10 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +// https://immersive-web.github.io/webxr/#xrspace-interface + +[SecureContext, Exposed=Window, Pref="dom.webxr.enabled"] +interface XRSpace : EventTarget { + // XRRigidTransform? getTransformTo(XRSpace other); +}; diff --git a/components/script/dom/webidls/XRStationaryReferenceSpace.webidl b/components/script/dom/webidls/XRStationaryReferenceSpace.webidl new file mode 100644 index 00000000000..3580ac94602 --- /dev/null +++ b/components/script/dom/webidls/XRStationaryReferenceSpace.webidl @@ -0,0 +1,20 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +// https://immersive-web.github.io/webxr/#xrstationaryreferencespace-interface + +enum XRStationaryReferenceSpaceSubtype { + "eye-level", + "floor-level", + "position-disabled" +}; + +dictionary XRStationaryReferenceSpaceOptions : XRReferenceSpaceOptions { + required XRStationaryReferenceSpaceSubtype subtype; +}; + +[SecureContext, Exposed=Window, Pref="dom.webxr.enabled"] +interface XRStationaryReferenceSpace: XRReferenceSpace { + // readonly attribute XRStationaryReferenceSpaceSubtype subtype; +}; diff --git a/components/script/dom/webidls/XRView.webidl b/components/script/dom/webidls/XRView.webidl new file mode 100644 index 00000000000..ab81136c28d --- /dev/null +++ b/components/script/dom/webidls/XRView.webidl @@ -0,0 +1,18 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +// https://immersive-web.github.io/webxr/#xrview-interface + +enum XREye { + "left", + "right" +}; + +[SecureContext, Exposed=Window, Pref="dom.webxr.enabled"] +interface XRView { + readonly attribute XREye eye; + readonly attribute Float32Array projectionMatrix; + readonly attribute Float32Array viewMatrix; + // readonly attribute XRRigidTransform transform; +}; diff --git a/components/script/dom/webidls/XRViewerPose.webidl b/components/script/dom/webidls/XRViewerPose.webidl new file mode 100644 index 00000000000..8b63fd6cdb5 --- /dev/null +++ b/components/script/dom/webidls/XRViewerPose.webidl @@ -0,0 +1,14 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +// https://immersive-web.github.io/webxr/#xrviewerpose-interface + +[SecureContext, Exposed=Window, Pref="dom.webxr.enabled"] +interface XRViewerPose { + // readonly attribute XRRigidTransform transform; + // readonly attribute FrozenArray<XRView> views; + // workaround until we have FrozenArray + // see https://github.com/servo/servo/issues/10427#issuecomment-449593626 + readonly attribute any views; +}; diff --git a/components/script/dom/webidls/XRViewport.webidl b/components/script/dom/webidls/XRViewport.webidl new file mode 100644 index 00000000000..325b52c9f8f --- /dev/null +++ b/components/script/dom/webidls/XRViewport.webidl @@ -0,0 +1,13 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +// https://immersive-web.github.io/webxr/#xrviewport-interface + +[SecureContext, Exposed=Window, Pref="dom.webxr.enabled"] +interface XRViewport { + readonly attribute long x; + readonly attribute long y; + readonly attribute long width; + readonly attribute long height; +}; diff --git a/components/script/dom/webidls/XRWebGLLayer.webidl b/components/script/dom/webidls/XRWebGLLayer.webidl new file mode 100644 index 00000000000..163bfd24568 --- /dev/null +++ b/components/script/dom/webidls/XRWebGLLayer.webidl @@ -0,0 +1,43 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +// https://immersive-web.github.io/webxr/#xrwebgllayer-interface + +// typedef (WebGLRenderingContext or +// WebGL2RenderingContext) XRWebGLRenderingContext; + +typedef WebGLRenderingContext XRWebGLRenderingContext; + +dictionary XRWebGLLayerInit { + boolean antialias = true; + boolean depth = true; + boolean stencil = false; + boolean alpha = true; + // double framebufferScaleFactor = 1.0; +}; + +[SecureContext, Exposed=Window, Constructor(XRSession session, + XRWebGLRenderingContext context, + optional XRWebGLLayerInit layerInit), + Pref="dom.webxr.enabled"] +interface XRWebGLLayer : XRLayer { + // // Attributes + readonly attribute XRWebGLRenderingContext context; + + readonly attribute boolean antialias; + readonly attribute boolean depth; + readonly attribute boolean stencil; + readonly attribute boolean alpha; + + // readonly attribute WebGLFramebuffer framebuffer; + // readonly attribute unsigned long framebufferWidth; + // readonly attribute unsigned long framebufferHeight; + + // // Methods + XRViewport? getViewport(XRView view); + // void requestViewportScaling(double viewportScaleFactor); + + // // Static Methods + // static double getNativeFramebufferScaleFactor(XRSession session); +}; |