diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2019-01-04 02:54:16 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-04 02:54:16 -0500 |
commit | c4a6dcfe4bd5f5613cee3596e68a1eb7a97bd32e (patch) | |
tree | b111aaba4a6168c35a71132254d94f5e4f1ab68e /components/script/dom/xrreferencespace.rs | |
parent | c6f6fb697d09513a51cdba4077c9ea78dba8afa7 (diff) | |
parent | e544462b6c4732987c5c8154d4a4e33539e83d13 (diff) | |
download | servo-c4a6dcfe4bd5f5613cee3596e68a1eb7a97bd32e.tar.gz servo-c4a6dcfe4bd5f5613cee3596e68a1eb7a97bd32e.zip |
Auto merge of #22528 - Manishearth:webxr, r=jdm,MortimerGoro
Preliminary WebXR support
This implements just enough WebXR to display to 3DOF devices in
immersive mode only.
Couple missing things:
- [ ] Handling reference spaces (even if just supporting eye-level spaces)
- [x] Spec links
- [ ] We enter immersive mode when baseLayer is set, but it seems like
we're supposed to do this when requestSession is called (https://github.com/immersive-web/webxr/issues/453)
- [ ] VR/XR should block less (https://github.com/servo/servo/issues/22505)
- [x] More pref-gating
- [x] `views` is a method instead of an attribute because we don't support FrozenArray
<s>Once I add spec links and pref gating</s> this can be landed as-is for further experimentation.
r? @jdm @MortimerGoro
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22528)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/xrreferencespace.rs')
-rw-r--r-- | components/script/dom/xrreferencespace.rs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/components/script/dom/xrreferencespace.rs b/components/script/dom/xrreferencespace.rs new file mode 100644 index 00000000000..308b710d928 --- /dev/null +++ b/components/script/dom/xrreferencespace.rs @@ -0,0 +1,32 @@ +/* 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/. */ + +use crate::dom::bindings::codegen::Bindings::XRReferenceSpaceBinding; +use crate::dom::bindings::reflector::reflect_dom_object; +use crate::dom::bindings::root::DomRoot; +use crate::dom::globalscope::GlobalScope; +use crate::dom::xrspace::XRSpace; +use dom_struct::dom_struct; + +#[dom_struct] +pub struct XRReferenceSpace { + xrspace: XRSpace, +} + +impl XRReferenceSpace { + pub fn new_inherited() -> XRReferenceSpace { + XRReferenceSpace { + xrspace: XRSpace::new_inherited(), + } + } + + #[allow(unused)] + pub fn new(global: &GlobalScope) -> DomRoot<XRReferenceSpace> { + reflect_dom_object( + Box::new(XRReferenceSpace::new_inherited()), + global, + XRReferenceSpaceBinding::Wrap, + ) + } +} |