<commit_before>/* 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::codegen::Bindings::XRReferenceSpaceBinding::XRReferenceSpaceMethods;
use crate::dom::bindings::reflector::reflect_dom_object;
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;

#[dom_struct]
pub struct XRReferenceSpace {
    xrspace: XRSpace,
    transform: MutDom<XRRigidTransform>,
}

impl XRReferenceSpace {
    pub fn new_inherited(session: &XRSession, transform: &XRRigidTransform) -> XRReferenceSpace {
        XRReferenceSpace {
            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(session, &transform)),
            global,
            XRReferenceSpaceBinding::Wrap,
        )
    }
}
<commit_msg>Add XRReferenceSpace::identity<commit_after>/* 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::codegen::Bindings::XRReferenceSpaceBinding::XRReferenceSpaceMethods;
use crate::dom::bindings::reflector::reflect_dom_object;
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;

#[dom_struct]
pub struct XRReferenceSpace {
    xrspace: XRSpace,
    transform: MutDom<XRRigidTransform>,
}

impl XRReferenceSpace {
    pub fn new_inherited(session: &XRSession, transform: &XRRigidTransform) -> XRReferenceSpace {
        XRReferenceSpace {
            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::new(global, position, orientation);
        reflect_dom_object(
            Box::new(XRReferenceSpace::new_inherited(session, &transform)),
            global,
            XRReferenceSpaceBinding::Wrap,
        )
    }

    #[allow(unused)]
    pub fn identity(global: &Window, session: &XRSession) -> DomRoot<XRReferenceSpace> {
        let transform = XRRigidTransform::identity(global);
        reflect_dom_object(
            Box::new(XRReferenceSpace::new_inherited(session, &transform)),
            global,
            XRReferenceSpaceBinding::Wrap,
        )
    }
}

{'fraction_non_alphanumeric': 0.12149532710280374, 'fraction_numerical': 0.0022656471254602095, 'mean_word_length': 4.024182076813656, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 13, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '239245', 'n_tokens_mistral': 1058, 'n_tokens_neox': 1062, 'n_words': 217}