Skip to content
Permalink
Browse files

Add session parameter to XRSpace

  • Loading branch information...
Manishearth committed Mar 14, 2019
1 parent ffacb11 commit 8f140079798b3820320599f3d33e1295e3e68564
@@ -9,6 +9,7 @@ use crate::dom::bindings::root::{DomRoot, MutDom};
use crate::dom::dompointreadonly::DOMPointReadOnly;
use crate::dom::window::Window;
use crate::dom::xrrigidtransform::XRRigidTransform;
use crate::dom::xrsession::XRSession;
use crate::dom::xrspace::XRSpace;
use dom_struct::dom_struct;

@@ -19,22 +20,23 @@ pub struct XRReferenceSpace {
}

impl XRReferenceSpace {
pub fn new_inherited(transform: &XRRigidTransform) -> XRReferenceSpace {
pub fn new_inherited(session: &XRSession, transform: &XRRigidTransform) -> XRReferenceSpace {
XRReferenceSpace {
xrspace: XRSpace::new_inherited(),
xrspace: XRSpace::new_inherited(session),
transform: MutDom::new(transform),
}
}

#[allow(unused)]
pub fn new(
global: &Window,
session: &XRSession,
position: &DOMPointReadOnly,
orientation: &DOMPointReadOnly,
) -> DomRoot<XRReferenceSpace> {
let transform = XRRigidTransform::identity(global);
reflect_dom_object(
Box::new(XRReferenceSpace::new_inherited(&transform)),
Box::new(XRReferenceSpace::new_inherited(session, &transform)),
global,
XRReferenceSpaceBinding::Wrap,
)
@@ -4,27 +4,30 @@

use crate::dom::bindings::codegen::Bindings::XRSpaceBinding;
use crate::dom::bindings::reflector::reflect_dom_object;
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::eventtarget::EventTarget;
use crate::dom::globalscope::GlobalScope;
use crate::dom::xrsession::XRSession;
use dom_struct::dom_struct;

#[dom_struct]
pub struct XRSpace {
eventtarget: EventTarget,
session: Dom<XRSession>,
}

impl XRSpace {
pub fn new_inherited() -> XRSpace {
pub fn new_inherited(session: &XRSession) -> XRSpace {
XRSpace {
eventtarget: EventTarget::new_inherited(),
session: Dom::from_ref(session),
}
}

#[allow(unused)]
pub fn new(global: &GlobalScope) -> DomRoot<XRSpace> {
pub fn new(global: &GlobalScope, session: &XRSession) -> DomRoot<XRSpace> {
reflect_dom_object(
Box::new(XRSpace::new_inherited()),
Box::new(XRSpace::new_inherited(session)),
global,
XRSpaceBinding::Wrap,
)
@@ -8,6 +8,7 @@ use crate::dom::bindings::root::DomRoot;
use crate::dom::window::Window;
use crate::dom::xrreferencespace::XRReferenceSpace;
use crate::dom::xrrigidtransform::XRRigidTransform;
use crate::dom::xrsession::XRSession;
use dom_struct::dom_struct;

#[dom_struct]
@@ -17,16 +18,21 @@ pub struct XRStationaryReferenceSpace {

#[allow(unused)]
impl XRStationaryReferenceSpace {
pub fn new_inherited(transform: &XRRigidTransform) -> XRStationaryReferenceSpace {
pub fn new_inherited(
session: &XRSession,
transform: &XRRigidTransform,
) -> XRStationaryReferenceSpace {
XRStationaryReferenceSpace {
xrreferencespace: XRReferenceSpace::new_inherited(transform),
xrreferencespace: XRReferenceSpace::new_inherited(session, transform),
}
}

pub fn new(window: &Window) -> DomRoot<XRStationaryReferenceSpace> {
pub fn new(window: &Window, session: &XRSession) -> DomRoot<XRStationaryReferenceSpace> {
let transform = XRRigidTransform::identity(window);
reflect_dom_object(
Box::new(XRStationaryReferenceSpace::new_inherited(&transform)),
Box::new(XRStationaryReferenceSpace::new_inherited(
session, &transform,
)),
window,
XRStationaryReferenceSpaceBinding::Wrap,
)

0 comments on commit 8f14007

Please sign in to comment.
You can’t perform that action at this time.