mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Add spec links
This commit is contained in:
parent
241d93340b
commit
c6c6b518cb
9 changed files with 28 additions and 2 deletions
|
@ -158,6 +158,7 @@ impl NavigatorMethods for Navigator {
|
|||
promise
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr/#dom-navigator-xr
|
||||
fn Xr(&self) -> DomRoot<XR> {
|
||||
self.xr.or_init(|| XR::new(&self.global()))
|
||||
}
|
||||
|
|
|
@ -12,7 +12,8 @@ enum XREnvironmentBlendMode {
|
|||
|
||||
callback XRFrameRequestCallback = void (DOMHighResTimeStamp time, XRFrame frame);
|
||||
|
||||
[SecureContext, Exposed=Window, Pref="dom.webxr.enabled"] interface XRSession : EventTarget {
|
||||
[SecureContext, Exposed=Window, Pref="dom.webxr.enabled"]
|
||||
interface XRSession : EventTarget {
|
||||
// // Attributes
|
||||
readonly attribute XRSessionMode mode;
|
||||
// readonly attribute XRPresentationContext outputContext;
|
||||
|
@ -23,7 +24,8 @@ callback XRFrameRequestCallback = void (DOMHighResTimeStamp time, XRFrame frame)
|
|||
attribute XRLayer? baseLayer;
|
||||
|
||||
// // Methods
|
||||
// Promise<XRReferenceSpace> requestReferenceSpace(XRReferenceSpaceType type, optional XRReferenceSpaceOptions options);
|
||||
// Promise<XRReferenceSpace> requestReferenceSpace(XRReferenceSpaceType type,
|
||||
// optional XRReferenceSpaceOptions options);
|
||||
|
||||
// FrozenArray<XRInputSource> getInputSources();
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
* 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);
|
||||
|
|
|
@ -58,6 +58,7 @@ impl Drop for XR {
|
|||
|
||||
impl XRMethods for XR {
|
||||
#[allow(unrooted_must_root)]
|
||||
/// https://immersive-web.github.io/webxr/#dom-xr-supportssessionmode
|
||||
fn SupportsSessionMode(&self, mode: XRSessionMode) -> Rc<Promise> {
|
||||
// XXXManishearth this should select an XR device first
|
||||
let promise = Promise::new(&self.global());
|
||||
|
@ -72,6 +73,7 @@ impl XRMethods for XR {
|
|||
}
|
||||
|
||||
#[allow(unrooted_must_root)]
|
||||
/// https://immersive-web.github.io/webxr/#dom-xr-requestsession
|
||||
fn RequestSession(&self, options: &XRSessionCreationOptions) -> Rc<Promise> {
|
||||
let promise = Promise::new(&self.global());
|
||||
if options.mode != XRSessionMode::Immersive_vr {
|
||||
|
|
|
@ -46,10 +46,12 @@ impl XRFrame {
|
|||
}
|
||||
|
||||
impl XRFrameMethods for XRFrame {
|
||||
/// https://immersive-web.github.io/webxr/#dom-xrframe-session
|
||||
fn Session(&self) -> DomRoot<XRSession> {
|
||||
DomRoot::from_ref(&self.session)
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr/#dom-xrframe-getviewerpose
|
||||
fn GetViewerPose(&self, reference: Option<&XRReferenceSpace>) -> Option<DomRoot<XRViewerPose>> {
|
||||
// We assume the reference space is eye level for now
|
||||
// since it's the only one 3DOF devices support
|
||||
|
|
|
@ -50,26 +50,32 @@ impl XRSession {
|
|||
}
|
||||
|
||||
impl XRSessionMethods for XRSession {
|
||||
/// https://immersive-web.github.io/webxr/#dom-xrsession-depthnear
|
||||
fn DepthNear(&self) -> Finite<f64> {
|
||||
Finite::wrap(self.depth_near.get())
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr/#dom-xrsession-depthfar
|
||||
fn DepthFar(&self) -> Finite<f64> {
|
||||
Finite::wrap(self.depth_far.get())
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr/#dom-xrsession-depthnear
|
||||
fn SetDepthNear(&self, d: Finite<f64>) {
|
||||
self.depth_near.set(*d)
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr/#dom-xrsession-depthfar
|
||||
fn SetDepthFar(&self, d: Finite<f64>) {
|
||||
self.depth_far.set(*d)
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr/#dom-xrsession-mode
|
||||
fn Mode(&self) -> XRSessionMode {
|
||||
XRSessionMode::Immersive_vr
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr/#dom-xrsession-baselayer
|
||||
fn SetBaseLayer(&self, layer: Option<&XRLayer>) {
|
||||
self.base_layer.set(layer);
|
||||
if let Some(layer) = layer {
|
||||
|
@ -81,14 +87,17 @@ impl XRSessionMethods for XRSession {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr/#dom-xrsession-baselayer
|
||||
fn GetBaseLayer(&self) -> Option<DomRoot<XRLayer>> {
|
||||
self.base_layer.get()
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr/#dom-xrsession-requestanimationframe
|
||||
fn RequestAnimationFrame(&self, callback: Rc<XRFrameRequestCallback>) -> i32 {
|
||||
self.display.xr_raf(callback) as i32
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr/#dom-xrsession-cancelanimationframe
|
||||
fn CancelAnimationFrame(&self, frame: i32) {
|
||||
self.display.xr_cancel_raf(frame)
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ impl XRViewerPose {
|
|||
}
|
||||
|
||||
impl XRViewerPoseMethods for XRViewerPose {
|
||||
/// https://immersive-web.github.io/webxr/#dom-xrviewerpose-views
|
||||
fn Views(&self) -> Vec<DomRoot<XRView>> {
|
||||
vec![
|
||||
DomRoot::from_ref(&self.left),
|
||||
|
|
|
@ -72,26 +72,32 @@ impl XRWebGLLayer {
|
|||
}
|
||||
|
||||
impl XRWebGLLayerMethods for XRWebGLLayer {
|
||||
/// https://immersive-web.github.io/webxr/#dom-xrwebgllayer-depth
|
||||
fn Depth(&self) -> bool {
|
||||
self.depth.get()
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr/#dom-xrwebgllayer-stencil
|
||||
fn Stencil(&self) -> bool {
|
||||
self.stencil.get()
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr/#dom-xrwebgllayer-antialias
|
||||
fn Antialias(&self) -> bool {
|
||||
self.antialias.get()
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr/#dom-xrwebgllayer-alpha
|
||||
fn Alpha(&self) -> bool {
|
||||
self.alpha.get()
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr/#dom-xrwebgllayer-context
|
||||
fn Context(&self) -> DomRoot<WebGLRenderingContext> {
|
||||
DomRoot::from_ref(&self.context)
|
||||
}
|
||||
|
||||
/// https://immersive-web.github.io/webxr/#dom-xrwebgllayer-getviewport
|
||||
fn GetViewport(&self, view: &XRView) -> Option<DomRoot<XRViewport>> {
|
||||
if self.session != view.session() {
|
||||
return None;
|
||||
|
|
|
@ -95,6 +95,7 @@ WEBIDL_STANDARDS = [
|
|||
"//svgwg.org/svg2-draft",
|
||||
"//wicg.github.io",
|
||||
"//webaudio.github.io",
|
||||
"//immersive-web.github.io/",
|
||||
# Not a URL
|
||||
"// This interface is entirely internal to Servo, and should not be" +
|
||||
" accessible to\n// web pages."
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue