mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
refactor: rename XR to XRSystem
chore: fix formatting refactor: change filename and ref to xrsystem refactor: change filename XRSystem.webidl refactor: update crate in navigator refactor: use XRSystem instead of XR in navigator refactor: update Bindings.conf refactor: use XRSystemMethods fix: update assertions for XRSystem fix: update manifest json
This commit is contained in:
parent
ada95b9878
commit
30f474312f
9 changed files with 30 additions and 44 deletions
|
@ -140,7 +140,7 @@ DOMInterfaces = {
|
||||||
'inRealms': ['WatchAdvertisements'],
|
'inRealms': ['WatchAdvertisements'],
|
||||||
},
|
},
|
||||||
|
|
||||||
'XR': {
|
'XRSystem': {
|
||||||
'inRealms': ['SupportsSessionMode', 'RequestSession'],
|
'inRealms': ['SupportsSessionMode', 'RequestSession'],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -573,7 +573,6 @@ pub mod xmlhttprequest;
|
||||||
pub mod xmlhttprequesteventtarget;
|
pub mod xmlhttprequesteventtarget;
|
||||||
pub mod xmlhttprequestupload;
|
pub mod xmlhttprequestupload;
|
||||||
pub mod xmlserializer;
|
pub mod xmlserializer;
|
||||||
pub mod xr;
|
|
||||||
pub mod xrframe;
|
pub mod xrframe;
|
||||||
pub mod xrinputsource;
|
pub mod xrinputsource;
|
||||||
pub mod xrinputsourcearray;
|
pub mod xrinputsourcearray;
|
||||||
|
@ -586,6 +585,7 @@ pub mod xrrigidtransform;
|
||||||
pub mod xrsession;
|
pub mod xrsession;
|
||||||
pub mod xrsessionevent;
|
pub mod xrsessionevent;
|
||||||
pub mod xrspace;
|
pub mod xrspace;
|
||||||
|
pub mod xrsystem;
|
||||||
pub mod xrtest;
|
pub mod xrtest;
|
||||||
pub mod xrview;
|
pub mod xrview;
|
||||||
pub mod xrviewerpose;
|
pub mod xrviewerpose;
|
||||||
|
|
|
@ -20,7 +20,7 @@ use crate::dom::pluginarray::PluginArray;
|
||||||
use crate::dom::promise::Promise;
|
use crate::dom::promise::Promise;
|
||||||
use crate::dom::serviceworkercontainer::ServiceWorkerContainer;
|
use crate::dom::serviceworkercontainer::ServiceWorkerContainer;
|
||||||
use crate::dom::window::Window;
|
use crate::dom::window::Window;
|
||||||
use crate::dom::xr::XR;
|
use crate::dom::xrsystem::XRSystem;
|
||||||
use crate::realms::InRealm;
|
use crate::realms::InRealm;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
@ -32,7 +32,7 @@ pub struct Navigator {
|
||||||
plugins: MutNullableDom<PluginArray>,
|
plugins: MutNullableDom<PluginArray>,
|
||||||
mime_types: MutNullableDom<MimeTypeArray>,
|
mime_types: MutNullableDom<MimeTypeArray>,
|
||||||
service_worker: MutNullableDom<ServiceWorkerContainer>,
|
service_worker: MutNullableDom<ServiceWorkerContainer>,
|
||||||
xr: MutNullableDom<XR>,
|
xr: MutNullableDom<XRSystem>,
|
||||||
mediadevices: MutNullableDom<MediaDevices>,
|
mediadevices: MutNullableDom<MediaDevices>,
|
||||||
gamepads: MutNullableDom<GamepadList>,
|
gamepads: MutNullableDom<GamepadList>,
|
||||||
permissions: MutNullableDom<Permissions>,
|
permissions: MutNullableDom<Permissions>,
|
||||||
|
@ -183,8 +183,8 @@ impl NavigatorMethods for Navigator {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://immersive-web.github.io/webxr/#dom-navigator-xr
|
/// https://immersive-web.github.io/webxr/#dom-navigator-xr
|
||||||
fn Xr(&self) -> DomRoot<XR> {
|
fn Xr(&self) -> DomRoot<XRSystem> {
|
||||||
self.xr.or_init(|| XR::new(&self.global()))
|
self.xr.or_init(|| XRSystem::new(&self.global()))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://w3c.github.io/mediacapture-main/#dom-navigator-mediadevices
|
/// https://w3c.github.io/mediacapture-main/#dom-navigator-mediadevices
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
// https://immersive-web.github.io/webxr/#xr-interface
|
// https://immersive-web.github.io/webxr/#xrsystem-interface
|
||||||
[SecureContext, Exposed=Window, Pref="dom.webxr.enabled"]
|
[SecureContext, Exposed=Window, Pref="dom.webxr.enabled"]
|
||||||
interface XR: EventTarget {
|
interface XRSystem: EventTarget {
|
||||||
// Methods
|
// Methods
|
||||||
Promise<boolean> isSessionSupported(XRSessionMode mode);
|
Promise<boolean> isSessionSupported(XRSessionMode mode);
|
||||||
Promise<XRSession> requestSession(XRSessionMode mode, optional XRSessionInit parameters = {});
|
Promise<XRSession> requestSession(XRSessionMode mode, optional XRSessionInit parameters = {});
|
||||||
|
@ -15,7 +15,7 @@ interface XR: EventTarget {
|
||||||
|
|
||||||
[SecureContext]
|
[SecureContext]
|
||||||
partial interface Navigator {
|
partial interface Navigator {
|
||||||
[SameObject, Pref="dom.webxr.enabled"] readonly attribute XR xr;
|
[SameObject, Pref="dom.webxr.enabled"] readonly attribute XRSystem xr;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum XRSessionMode {
|
enum XRSessionMode {
|
||||||
|
@ -29,7 +29,7 @@ dictionary XRSessionInit {
|
||||||
sequence<any> optionalFeatures;
|
sequence<any> optionalFeatures;
|
||||||
};
|
};
|
||||||
|
|
||||||
partial interface XR {
|
partial interface XRSystem {
|
||||||
// https://github.com/immersive-web/webxr-test-api/
|
// https://github.com/immersive-web/webxr-test-api/
|
||||||
[SameObject, Pref="dom.webxr.test"] readonly attribute XRTest test;
|
[SameObject, Pref="dom.webxr.test"] readonly attribute XRTest test;
|
||||||
};
|
};
|
|
@ -7,7 +7,6 @@ use crate::dom::bindings::cell::DomRefCell;
|
||||||
use crate::dom::bindings::codegen::Bindings::NavigatorBinding::NavigatorBinding::NavigatorMethods;
|
use crate::dom::bindings::codegen::Bindings::NavigatorBinding::NavigatorBinding::NavigatorMethods;
|
||||||
use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextMethods;
|
use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextMethods;
|
||||||
use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods;
|
use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods;
|
||||||
use crate::dom::bindings::codegen::Bindings::XRBinding::XRSessionMode;
|
|
||||||
use crate::dom::bindings::codegen::Bindings::XRReferenceSpaceBinding::XRReferenceSpaceType;
|
use crate::dom::bindings::codegen::Bindings::XRReferenceSpaceBinding::XRReferenceSpaceType;
|
||||||
use crate::dom::bindings::codegen::Bindings::XRRenderStateBinding::XRRenderStateInit;
|
use crate::dom::bindings::codegen::Bindings::XRRenderStateBinding::XRRenderStateInit;
|
||||||
use crate::dom::bindings::codegen::Bindings::XRRenderStateBinding::XRRenderStateMethods;
|
use crate::dom::bindings::codegen::Bindings::XRRenderStateBinding::XRRenderStateMethods;
|
||||||
|
@ -16,6 +15,7 @@ use crate::dom::bindings::codegen::Bindings::XRSessionBinding::XREnvironmentBlen
|
||||||
use crate::dom::bindings::codegen::Bindings::XRSessionBinding::XRFrameRequestCallback;
|
use crate::dom::bindings::codegen::Bindings::XRSessionBinding::XRFrameRequestCallback;
|
||||||
use crate::dom::bindings::codegen::Bindings::XRSessionBinding::XRSessionMethods;
|
use crate::dom::bindings::codegen::Bindings::XRSessionBinding::XRSessionMethods;
|
||||||
use crate::dom::bindings::codegen::Bindings::XRSessionBinding::XRVisibilityState;
|
use crate::dom::bindings::codegen::Bindings::XRSessionBinding::XRVisibilityState;
|
||||||
|
use crate::dom::bindings::codegen::Bindings::XRSystemBinding::XRSessionMode;
|
||||||
use crate::dom::bindings::codegen::Bindings::XRWebGLLayerBinding::XRWebGLLayerMethods;
|
use crate::dom::bindings::codegen::Bindings::XRWebGLLayerBinding::XRWebGLLayerMethods;
|
||||||
use crate::dom::bindings::error::{Error, ErrorResult};
|
use crate::dom::bindings::error::{Error, ErrorResult};
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
|
|
|
@ -4,9 +4,9 @@
|
||||||
|
|
||||||
use crate::dom::bindings::cell::DomRefCell;
|
use crate::dom::bindings::cell::DomRefCell;
|
||||||
use crate::dom::bindings::codegen::Bindings::VRDisplayBinding::VRDisplayMethods;
|
use crate::dom::bindings::codegen::Bindings::VRDisplayBinding::VRDisplayMethods;
|
||||||
use crate::dom::bindings::codegen::Bindings::XRBinding;
|
use crate::dom::bindings::codegen::Bindings::XRSystemBinding;
|
||||||
use crate::dom::bindings::codegen::Bindings::XRBinding::XRSessionInit;
|
use crate::dom::bindings::codegen::Bindings::XRSystemBinding::XRSessionInit;
|
||||||
use crate::dom::bindings::codegen::Bindings::XRBinding::{XRMethods, XRSessionMode};
|
use crate::dom::bindings::codegen::Bindings::XRSystemBinding::{XRSessionMode, XRSystemMethods};
|
||||||
use crate::dom::bindings::conversions::{ConversionResult, FromJSValConvertible};
|
use crate::dom::bindings::conversions::{ConversionResult, FromJSValConvertible};
|
||||||
use crate::dom::bindings::error::Error;
|
use crate::dom::bindings::error::Error;
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
|
@ -38,7 +38,7 @@ use webvr_traits::{WebVRGamepadData, WebVRGamepadEvent, WebVRGamepadState};
|
||||||
use webxr_api::{Error as XRError, Frame, Session, SessionInit, SessionMode};
|
use webxr_api::{Error as XRError, Frame, Session, SessionInit, SessionMode};
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct XR {
|
pub struct XRSystem {
|
||||||
eventtarget: EventTarget,
|
eventtarget: EventTarget,
|
||||||
displays: DomRefCell<Vec<Dom<VRDisplay>>>,
|
displays: DomRefCell<Vec<Dom<VRDisplay>>>,
|
||||||
gamepads: DomRefCell<Vec<Dom<Gamepad>>>,
|
gamepads: DomRefCell<Vec<Dom<Gamepad>>>,
|
||||||
|
@ -48,9 +48,9 @@ pub struct XR {
|
||||||
test: MutNullableDom<XRTest>,
|
test: MutNullableDom<XRTest>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl XR {
|
impl XRSystem {
|
||||||
fn new_inherited() -> XR {
|
fn new_inherited() -> XRSystem {
|
||||||
XR {
|
XRSystem {
|
||||||
eventtarget: EventTarget::new_inherited(),
|
eventtarget: EventTarget::new_inherited(),
|
||||||
displays: DomRefCell::new(Vec::new()),
|
displays: DomRefCell::new(Vec::new()),
|
||||||
gamepads: DomRefCell::new(Vec::new()),
|
gamepads: DomRefCell::new(Vec::new()),
|
||||||
|
@ -61,8 +61,12 @@ impl XR {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(global: &GlobalScope) -> DomRoot<XR> {
|
pub fn new(global: &GlobalScope) -> DomRoot<XRSystem> {
|
||||||
let root = reflect_dom_object(Box::new(XR::new_inherited()), global, XRBinding::Wrap);
|
let root = reflect_dom_object(
|
||||||
|
Box::new(XRSystem::new_inherited()),
|
||||||
|
global,
|
||||||
|
XRSystemBinding::Wrap,
|
||||||
|
);
|
||||||
root.register();
|
root.register();
|
||||||
root
|
root
|
||||||
}
|
}
|
||||||
|
@ -96,7 +100,7 @@ impl XR {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Drop for XR {
|
impl Drop for XRSystem {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
self.unregister();
|
self.unregister();
|
||||||
}
|
}
|
||||||
|
@ -112,7 +116,7 @@ impl Into<SessionMode> for XRSessionMode {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl XRMethods for XR {
|
impl XRSystemMethods for XRSystem {
|
||||||
/// https://immersive-web.github.io/webxr/#dom-xr-issessionsupported
|
/// https://immersive-web.github.io/webxr/#dom-xr-issessionsupported
|
||||||
fn IsSessionSupported(&self, mode: XRSessionMode) -> Rc<Promise> {
|
fn IsSessionSupported(&self, mode: XRSessionMode) -> Rc<Promise> {
|
||||||
// XXXManishearth this should select an XR device first
|
// XXXManishearth this should select an XR device first
|
||||||
|
@ -267,7 +271,7 @@ impl XRMethods for XR {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl XR {
|
impl XRSystem {
|
||||||
fn session_obtained(
|
fn session_obtained(
|
||||||
&self,
|
&self,
|
||||||
response: Result<Session, XRError>,
|
response: Result<Session, XRError>,
|
||||||
|
@ -442,7 +446,7 @@ impl XR {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gamepad
|
// Gamepad
|
||||||
impl XR {
|
impl XRSystem {
|
||||||
fn find_gamepad(&self, gamepad_id: u32) -> Option<DomRoot<Gamepad>> {
|
fn find_gamepad(&self, gamepad_id: u32) -> Option<DomRoot<Gamepad>> {
|
||||||
self.gamepads
|
self.gamepads
|
||||||
.borrow()
|
.borrow()
|
|
@ -131,27 +131,9 @@
|
||||||
[XRSystem interface: operation isSessionSupported(XRSessionMode)]
|
[XRSystem interface: operation isSessionSupported(XRSessionMode)]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[XRSystem interface: existence and properties of interface prototype object]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[XRSystem interface: existence and properties of interface object]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[XRSystem interface object name]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[XRSystem interface: attribute ondevicechange]
|
[XRSystem interface: attribute ondevicechange]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[XRSystem interface: existence and properties of interface prototype object's @@unscopables property]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[XRSystem interface: existence and properties of interface prototype object's "constructor" property]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[XRSystem interface object length]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[XRSystem interface: operation requestSession(XRSessionMode, XRSessionInit)]
|
[XRSystem interface: operation requestSession(XRSessionMode, XRSessionInit)]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
|
@ -13863,7 +13863,7 @@
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
"interfaces.html": [
|
"interfaces.html": [
|
||||||
"bb6adbde0b3452e6ea8f1db44941a08dbe236774",
|
"163ab416b1627e07347b83aa210712364182343a",
|
||||||
[
|
[
|
||||||
null,
|
null,
|
||||||
{}
|
{}
|
||||||
|
|
|
@ -263,7 +263,6 @@ test_interfaces([
|
||||||
"XMLHttpRequestEventTarget",
|
"XMLHttpRequestEventTarget",
|
||||||
"XMLHttpRequestUpload",
|
"XMLHttpRequestUpload",
|
||||||
"XMLSerializer",
|
"XMLSerializer",
|
||||||
"XR",
|
|
||||||
"XRFrame",
|
"XRFrame",
|
||||||
"XRInputSource",
|
"XRInputSource",
|
||||||
"XRInputSourceArray",
|
"XRInputSourceArray",
|
||||||
|
@ -275,6 +274,7 @@ test_interfaces([
|
||||||
"XRSession",
|
"XRSession",
|
||||||
"XRSessionEvent",
|
"XRSessionEvent",
|
||||||
"XRSpace",
|
"XRSpace",
|
||||||
|
"XRSystem",
|
||||||
"XRView",
|
"XRView",
|
||||||
"XRViewerPose",
|
"XRViewerPose",
|
||||||
"XRViewport",
|
"XRViewport",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue