aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/webxr
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/webxr')
-rw-r--r--components/script/dom/webxr/fakexrdevice.rs21
-rw-r--r--components/script/dom/webxr/fakexrinputcontroller.rs11
-rw-r--r--components/script/dom/webxr/mod.rs81
-rw-r--r--components/script/dom/webxr/xrboundedreferencespace.rs10
-rw-r--r--components/script/dom/webxr/xrcompositionlayer.rs2
-rw-r--r--components/script/dom/webxr/xrcubelayer.rs2
-rw-r--r--components/script/dom/webxr/xrcylinderlayer.rs2
-rw-r--r--components/script/dom/webxr/xrequirectlayer.rs2
-rw-r--r--components/script/dom/webxr/xrframe.rs12
-rw-r--r--components/script/dom/webxr/xrhand.rs8
-rw-r--r--components/script/dom/webxr/xrhittestresult.rs4
-rw-r--r--components/script/dom/webxr/xrhittestsource.rs6
-rw-r--r--components/script/dom/webxr/xrinputsource.rs14
-rw-r--r--components/script/dom/webxr/xrinputsourcearray.rs17
-rw-r--r--components/script/dom/webxr/xrinputsourceevent.rs4
-rw-r--r--components/script/dom/webxr/xrinputsourceschangeevent.rs4
-rw-r--r--components/script/dom/webxr/xrjointpose.rs4
-rw-r--r--components/script/dom/webxr/xrjointspace.rs12
-rw-r--r--components/script/dom/webxr/xrlayer.rs8
-rw-r--r--components/script/dom/webxr/xrlayerevent.rs4
-rw-r--r--components/script/dom/webxr/xrmediabinding.rs4
-rw-r--r--components/script/dom/webxr/xrpose.rs6
-rw-r--r--components/script/dom/webxr/xrprojectionlayer.rs2
-rw-r--r--components/script/dom/webxr/xrquadlayer.rs2
-rw-r--r--components/script/dom/webxr/xrray.rs4
-rw-r--r--components/script/dom/webxr/xrreferencespace.rs20
-rw-r--r--components/script/dom/webxr/xrreferencespaceevent.rs4
-rw-r--r--components/script/dom/webxr/xrrenderstate.rs22
-rw-r--r--components/script/dom/webxr/xrrigidtransform.rs8
-rw-r--r--components/script/dom/webxr/xrsession.rs32
-rw-r--r--components/script/dom/webxr/xrsessionevent.rs4
-rw-r--r--components/script/dom/webxr/xrspace.rs12
-rw-r--r--components/script/dom/webxr/xrsubimage.rs2
-rw-r--r--components/script/dom/webxr/xrsystem.rs14
-rw-r--r--components/script/dom/webxr/xrtest.rs6
-rw-r--r--components/script/dom/webxr/xrview.rs8
-rw-r--r--components/script/dom/webxr/xrviewerpose.rs4
-rw-r--r--components/script/dom/webxr/xrviewport.rs4
-rw-r--r--components/script/dom/webxr/xrwebglbinding.rs7
-rw-r--r--components/script/dom/webxr/xrwebgllayer.rs16
-rw-r--r--components/script/dom/webxr/xrwebglsubimage.rs2
41 files changed, 215 insertions, 196 deletions
diff --git a/components/script/dom/webxr/fakexrdevice.rs b/components/script/dom/webxr/fakexrdevice.rs
index 2910ed13490..a954e5ec0f4 100644
--- a/components/script/dom/webxr/fakexrdevice.rs
+++ b/components/script/dom/webxr/fakexrdevice.rs
@@ -37,7 +37,7 @@ use crate::dom::promise::Promise;
use crate::script_runtime::CanGc;
#[dom_struct]
-pub struct FakeXRDevice {
+pub(crate) struct FakeXRDevice {
reflector: Reflector,
#[ignore_malloc_size_of = "defined in ipc-channel"]
#[no_trace]
@@ -48,7 +48,7 @@ pub struct FakeXRDevice {
}
impl FakeXRDevice {
- pub fn new_inherited(sender: IpcSender<MockDeviceMsg>) -> FakeXRDevice {
+ pub(crate) fn new_inherited(sender: IpcSender<MockDeviceMsg>) -> FakeXRDevice {
FakeXRDevice {
reflector: Reflector::new(),
sender,
@@ -56,7 +56,10 @@ impl FakeXRDevice {
}
}
- pub fn new(global: &GlobalScope, sender: IpcSender<MockDeviceMsg>) -> DomRoot<FakeXRDevice> {
+ pub(crate) fn new(
+ global: &GlobalScope,
+ sender: IpcSender<MockDeviceMsg>,
+ ) -> DomRoot<FakeXRDevice> {
reflect_dom_object(
Box::new(FakeXRDevice::new_inherited(sender)),
global,
@@ -64,12 +67,12 @@ impl FakeXRDevice {
)
}
- pub fn disconnect(&self, sender: IpcSender<()>) {
+ pub(crate) fn disconnect(&self, sender: IpcSender<()>) {
let _ = self.sender.send(MockDeviceMsg::Disconnect(sender));
}
}
-pub fn view<Eye>(view: &FakeXRViewInit) -> Fallible<MockViewInit<Eye>> {
+pub(crate) fn view<Eye>(view: &FakeXRViewInit) -> Fallible<MockViewInit<Eye>> {
if view.projectionMatrix.len() != 16 || view.viewOffset.position.len() != 3 {
return Err(Error::Type("Incorrectly sized array".into()));
}
@@ -106,7 +109,7 @@ pub fn view<Eye>(view: &FakeXRViewInit) -> Fallible<MockViewInit<Eye>> {
})
}
-pub fn get_views(views: &[FakeXRViewInit]) -> Fallible<MockViewsInit> {
+pub(crate) fn get_views(views: &[FakeXRViewInit]) -> Fallible<MockViewsInit> {
match views.len() {
1 => Ok(MockViewsInit::Mono(view(&views[0])?)),
2 => {
@@ -121,7 +124,7 @@ pub fn get_views(views: &[FakeXRViewInit]) -> Fallible<MockViewsInit> {
}
}
-pub fn get_origin<T, U>(
+pub(crate) fn get_origin<T, U>(
origin: &FakeXRRigidTransformInit,
) -> Fallible<RigidTransform3D<f32, T, U>> {
if origin.position.len() != 3 || origin.orientation.len() != 4 {
@@ -142,11 +145,11 @@ pub fn get_origin<T, U>(
Ok(RigidTransform3D::new(o, p))
}
-pub fn get_point<T>(pt: &DOMPointInit) -> Point3D<f32, T> {
+pub(crate) fn get_point<T>(pt: &DOMPointInit) -> Point3D<f32, T> {
Point3D::new(pt.x / pt.w, pt.y / pt.w, pt.z / pt.w).cast()
}
-pub fn get_world(world: &FakeXRWorldInit) -> Fallible<MockWorld> {
+pub(crate) fn get_world(world: &FakeXRWorldInit) -> Fallible<MockWorld> {
let regions = world
.hitTestRegions
.iter()
diff --git a/components/script/dom/webxr/fakexrinputcontroller.rs b/components/script/dom/webxr/fakexrinputcontroller.rs
index e52dc0a21fd..07257311da6 100644
--- a/components/script/dom/webxr/fakexrinputcontroller.rs
+++ b/components/script/dom/webxr/fakexrinputcontroller.rs
@@ -26,7 +26,7 @@ use crate::dom::globalscope::GlobalScope;
use crate::script_runtime::CanGc;
#[dom_struct]
-pub struct FakeXRInputController {
+pub(crate) struct FakeXRInputController {
reflector: Reflector,
#[ignore_malloc_size_of = "defined in ipc-channel"]
#[no_trace]
@@ -37,7 +37,10 @@ pub struct FakeXRInputController {
}
impl FakeXRInputController {
- pub fn new_inherited(sender: IpcSender<MockDeviceMsg>, id: InputId) -> FakeXRInputController {
+ pub(crate) fn new_inherited(
+ sender: IpcSender<MockDeviceMsg>,
+ id: InputId,
+ ) -> FakeXRInputController {
FakeXRInputController {
reflector: Reflector::new(),
sender,
@@ -45,7 +48,7 @@ impl FakeXRInputController {
}
}
- pub fn new(
+ pub(crate) fn new(
global: &GlobalScope,
sender: IpcSender<MockDeviceMsg>,
id: InputId,
@@ -181,7 +184,7 @@ impl Convert<MockButtonType> for FakeXRButtonType {
}
/// <https://immersive-web.github.io/webxr-test-api/#parse-supported-buttons>
-pub fn init_to_mock_buttons(buttons: &[FakeXRButtonStateInit]) -> Vec<MockButton> {
+pub(crate) fn init_to_mock_buttons(buttons: &[FakeXRButtonStateInit]) -> Vec<MockButton> {
let supported: Vec<MockButton> = buttons
.iter()
.map(|b| MockButton {
diff --git a/components/script/dom/webxr/mod.rs b/components/script/dom/webxr/mod.rs
index 6faee016890..d8c52d83315 100644
--- a/components/script/dom/webxr/mod.rs
+++ b/components/script/dom/webxr/mod.rs
@@ -2,43 +2,44 @@
* 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/. */
-pub mod fakexrdevice;
-pub mod fakexrinputcontroller;
-pub mod xrboundedreferencespace;
-pub mod xrcompositionlayer;
-pub mod xrcubelayer;
-pub mod xrcylinderlayer;
-pub mod xrequirectlayer;
-pub mod xrframe;
-pub mod xrhand;
-pub mod xrhittestresult;
-pub mod xrhittestsource;
-pub mod xrinputsource;
-pub mod xrinputsourcearray;
-pub mod xrinputsourceevent;
-pub mod xrinputsourceschangeevent;
-pub mod xrjointpose;
-pub mod xrjointspace;
-pub mod xrlayer;
-pub mod xrlayerevent;
-pub mod xrmediabinding;
-pub mod xrpose;
-pub mod xrprojectionlayer;
-pub mod xrquadlayer;
-pub mod xrray;
-pub mod xrreferencespace;
-pub mod xrreferencespaceevent;
-pub mod xrrenderstate;
-pub mod xrrigidtransform;
-pub mod xrsession;
-pub mod xrsessionevent;
-pub mod xrspace;
-pub mod xrsubimage;
-pub mod xrsystem;
-pub mod xrtest;
-pub mod xrview;
-pub mod xrviewerpose;
-pub mod xrviewport;
-pub mod xrwebglbinding;
-pub mod xrwebgllayer;
-pub mod xrwebglsubimage;
+pub(crate) mod fakexrdevice;
+pub(crate) mod fakexrinputcontroller;
+pub(crate) mod xrboundedreferencespace;
+pub(crate) mod xrcompositionlayer;
+pub(crate) mod xrcubelayer;
+pub(crate) mod xrcylinderlayer;
+pub(crate) mod xrequirectlayer;
+pub(crate) mod xrframe;
+pub(crate) mod xrhand;
+pub(crate) mod xrhittestresult;
+pub(crate) mod xrhittestsource;
+pub(crate) mod xrinputsource;
+pub(crate) mod xrinputsourcearray;
+pub(crate) mod xrinputsourceevent;
+pub(crate) mod xrinputsourceschangeevent;
+pub(crate) mod xrjointpose;
+pub(crate) mod xrjointspace;
+pub(crate) mod xrlayer;
+pub(crate) mod xrlayerevent;
+pub(crate) mod xrmediabinding;
+pub(crate) mod xrpose;
+pub(crate) mod xrprojectionlayer;
+pub(crate) mod xrquadlayer;
+pub(crate) mod xrray;
+pub(crate) mod xrreferencespace;
+pub(crate) mod xrreferencespaceevent;
+pub(crate) mod xrrenderstate;
+pub(crate) mod xrrigidtransform;
+#[allow(dead_code)]
+pub(crate) mod xrsession;
+pub(crate) mod xrsessionevent;
+pub(crate) mod xrspace;
+pub(crate) mod xrsubimage;
+pub(crate) mod xrsystem;
+pub(crate) mod xrtest;
+pub(crate) mod xrview;
+pub(crate) mod xrviewerpose;
+pub(crate) mod xrviewport;
+pub(crate) mod xrwebglbinding;
+pub(crate) mod xrwebgllayer;
+pub(crate) mod xrwebglsubimage;
diff --git a/components/script/dom/webxr/xrboundedreferencespace.rs b/components/script/dom/webxr/xrboundedreferencespace.rs
index ef5480bd72b..91d98467e92 100644
--- a/components/script/dom/webxr/xrboundedreferencespace.rs
+++ b/components/script/dom/webxr/xrboundedreferencespace.rs
@@ -18,13 +18,13 @@ use crate::dom::xrsession::XRSession;
use crate::script_runtime::{CanGc, JSContext};
#[dom_struct]
-pub struct XRBoundedReferenceSpace {
+pub(crate) struct XRBoundedReferenceSpace {
reference_space: XRReferenceSpace,
offset: Dom<XRRigidTransform>,
}
impl XRBoundedReferenceSpace {
- pub fn new_inherited(
+ pub(crate) fn new_inherited(
session: &XRSession,
offset: &XRRigidTransform,
) -> XRBoundedReferenceSpace {
@@ -39,7 +39,7 @@ impl XRBoundedReferenceSpace {
}
#[allow(unused)]
- pub fn new(
+ pub(crate) fn new(
global: &GlobalScope,
session: &XRSession,
can_gc: CanGc,
@@ -49,7 +49,7 @@ impl XRBoundedReferenceSpace {
}
#[allow(unused)]
- pub fn new_offset(
+ pub(crate) fn new_offset(
global: &GlobalScope,
session: &XRSession,
offset: &XRRigidTransform,
@@ -61,7 +61,7 @@ impl XRBoundedReferenceSpace {
)
}
- pub fn reference_space(&self) -> &XRReferenceSpace {
+ pub(crate) fn reference_space(&self) -> &XRReferenceSpace {
&self.reference_space
}
}
diff --git a/components/script/dom/webxr/xrcompositionlayer.rs b/components/script/dom/webxr/xrcompositionlayer.rs
index fbb71149716..5e563dba60b 100644
--- a/components/script/dom/webxr/xrcompositionlayer.rs
+++ b/components/script/dom/webxr/xrcompositionlayer.rs
@@ -7,6 +7,6 @@ use dom_struct::dom_struct;
use crate::dom::xrlayer::XRLayer;
#[dom_struct]
-pub struct XRCompositionLayer {
+pub(crate) struct XRCompositionLayer {
xr_layer: XRLayer,
}
diff --git a/components/script/dom/webxr/xrcubelayer.rs b/components/script/dom/webxr/xrcubelayer.rs
index 587d088e88b..ad269dbd94a 100644
--- a/components/script/dom/webxr/xrcubelayer.rs
+++ b/components/script/dom/webxr/xrcubelayer.rs
@@ -7,6 +7,6 @@ use dom_struct::dom_struct;
use crate::dom::xrcompositionlayer::XRCompositionLayer;
#[dom_struct]
-pub struct XRCubeLayer {
+pub(crate) struct XRCubeLayer {
composition_layer: XRCompositionLayer,
}
diff --git a/components/script/dom/webxr/xrcylinderlayer.rs b/components/script/dom/webxr/xrcylinderlayer.rs
index f468380bb36..be48d982ee5 100644
--- a/components/script/dom/webxr/xrcylinderlayer.rs
+++ b/components/script/dom/webxr/xrcylinderlayer.rs
@@ -7,6 +7,6 @@ use dom_struct::dom_struct;
use crate::dom::xrcompositionlayer::XRCompositionLayer;
#[dom_struct]
-pub struct XRCylinderLayer {
+pub(crate) struct XRCylinderLayer {
composition_layer: XRCompositionLayer,
}
diff --git a/components/script/dom/webxr/xrequirectlayer.rs b/components/script/dom/webxr/xrequirectlayer.rs
index 25cc04595ef..dc086c37e66 100644
--- a/components/script/dom/webxr/xrequirectlayer.rs
+++ b/components/script/dom/webxr/xrequirectlayer.rs
@@ -7,6 +7,6 @@ use dom_struct::dom_struct;
use crate::dom::xrcompositionlayer::XRCompositionLayer;
#[dom_struct]
-pub struct XREquirectLayer {
+pub(crate) struct XREquirectLayer {
composition_layer: XRCompositionLayer,
}
diff --git a/components/script/dom/webxr/xrframe.rs b/components/script/dom/webxr/xrframe.rs
index 432e35857af..729aa4cc957 100644
--- a/components/script/dom/webxr/xrframe.rs
+++ b/components/script/dom/webxr/xrframe.rs
@@ -28,7 +28,7 @@ use crate::dom::xrviewerpose::XRViewerPose;
use crate::script_runtime::CanGc;
#[dom_struct]
-pub struct XRFrame {
+pub(crate) struct XRFrame {
reflector_: Reflector,
session: Dom<XRSession>,
#[ignore_malloc_size_of = "defined in webxr_api"]
@@ -49,7 +49,7 @@ impl XRFrame {
}
}
- pub fn new(global: &GlobalScope, session: &XRSession, data: Frame) -> DomRoot<XRFrame> {
+ pub(crate) fn new(global: &GlobalScope, session: &XRSession, data: Frame) -> DomRoot<XRFrame> {
reflect_dom_object(
Box::new(XRFrame::new_inherited(session, data)),
global,
@@ -58,20 +58,20 @@ impl XRFrame {
}
/// <https://immersive-web.github.io/webxr/#xrframe-active>
- pub fn set_active(&self, active: bool) {
+ pub(crate) fn set_active(&self, active: bool) {
self.active.set(active);
}
/// <https://immersive-web.github.io/webxr/#xrframe-animationframe>
- pub fn set_animation_frame(&self, animation_frame: bool) {
+ pub(crate) fn set_animation_frame(&self, animation_frame: bool) {
self.animation_frame.set(animation_frame);
}
- pub fn get_pose(&self, space: &XRSpace) -> Option<ApiPose> {
+ pub(crate) fn get_pose(&self, space: &XRSpace) -> Option<ApiPose> {
space.get_pose(&self.data)
}
- pub fn get_sub_images(&self, layer_id: LayerId) -> Option<&SubImages> {
+ pub(crate) fn get_sub_images(&self, layer_id: LayerId) -> Option<&SubImages> {
self.data
.sub_images
.iter()
diff --git a/components/script/dom/webxr/xrhand.rs b/components/script/dom/webxr/xrhand.rs
index e3ed4268a1f..a9253ccb72b 100644
--- a/components/script/dom/webxr/xrhand.rs
+++ b/components/script/dom/webxr/xrhand.rs
@@ -102,7 +102,7 @@ const JOINT_SPACE_MAP: [(XRHandJoint, Joint); 25] = [
];
#[dom_struct]
-pub struct XRHand {
+pub(crate) struct XRHand {
reflector_: Reflector,
#[ignore_malloc_size_of = "defined in webxr"]
source: Dom<XRInputSource>,
@@ -120,7 +120,11 @@ impl XRHand {
}
}
- pub fn new(global: &GlobalScope, source: &XRInputSource, support: Hand<()>) -> DomRoot<XRHand> {
+ pub(crate) fn new(
+ global: &GlobalScope,
+ source: &XRInputSource,
+ support: Hand<()>,
+ ) -> DomRoot<XRHand> {
let id = source.id();
let session = source.session();
let spaces = support.map(|field, joint| {
diff --git a/components/script/dom/webxr/xrhittestresult.rs b/components/script/dom/webxr/xrhittestresult.rs
index 4b4db410812..de9693136c7 100644
--- a/components/script/dom/webxr/xrhittestresult.rs
+++ b/components/script/dom/webxr/xrhittestresult.rs
@@ -15,7 +15,7 @@ use crate::dom::xrspace::XRSpace;
use crate::script_runtime::CanGc;
#[dom_struct]
-pub struct XRHitTestResult {
+pub(crate) struct XRHitTestResult {
reflector_: Reflector,
#[ignore_malloc_size_of = "defined in webxr"]
#[no_trace]
@@ -32,7 +32,7 @@ impl XRHitTestResult {
}
}
- pub fn new(
+ pub(crate) fn new(
global: &GlobalScope,
result: HitTestResult,
frame: &XRFrame,
diff --git a/components/script/dom/webxr/xrhittestsource.rs b/components/script/dom/webxr/xrhittestsource.rs
index ba829f44aba..fad7e492249 100644
--- a/components/script/dom/webxr/xrhittestsource.rs
+++ b/components/script/dom/webxr/xrhittestsource.rs
@@ -13,7 +13,7 @@ use crate::dom::xrsession::XRSession;
use crate::script_runtime::CanGc;
#[dom_struct]
-pub struct XRHitTestSource {
+pub(crate) struct XRHitTestSource {
reflector_: Reflector,
#[ignore_malloc_size_of = "defined in webxr"]
#[no_trace]
@@ -30,7 +30,7 @@ impl XRHitTestSource {
}
}
- pub fn new(
+ pub(crate) fn new(
global: &GlobalScope,
id: HitTestId,
session: &XRSession,
@@ -42,7 +42,7 @@ impl XRHitTestSource {
)
}
- pub fn id(&self) -> HitTestId {
+ pub(crate) fn id(&self) -> HitTestId {
self.id
}
}
diff --git a/components/script/dom/webxr/xrinputsource.rs b/components/script/dom/webxr/xrinputsource.rs
index cc240919324..f3486a83758 100644
--- a/components/script/dom/webxr/xrinputsource.rs
+++ b/components/script/dom/webxr/xrinputsource.rs
@@ -24,7 +24,7 @@ use crate::realms::enter_realm;
use crate::script_runtime::{CanGc, JSContext};
#[dom_struct]
-pub struct XRInputSource {
+pub(crate) struct XRInputSource {
reflector: Reflector,
session: Dom<XRSession>,
#[ignore_malloc_size_of = "Defined in rust-webxr"]
@@ -39,7 +39,7 @@ pub struct XRInputSource {
}
impl XRInputSource {
- pub fn new_inherited(
+ pub(crate) fn new_inherited(
global: &GlobalScope,
session: &XRSession,
info: InputSource,
@@ -73,7 +73,7 @@ impl XRInputSource {
}
#[allow(unsafe_code)]
- pub fn new(
+ pub(crate) fn new(
global: &GlobalScope,
session: &XRSession,
info: InputSource,
@@ -95,15 +95,15 @@ impl XRInputSource {
source
}
- pub fn id(&self) -> InputId {
+ pub(crate) fn id(&self) -> InputId {
self.info.id
}
- pub fn session(&self) -> &XRSession {
+ pub(crate) fn session(&self) -> &XRSession {
&self.session
}
- pub fn update_gamepad_state(&self, frame: InputFrame) {
+ pub(crate) fn update_gamepad_state(&self, frame: InputFrame) {
frame
.button_values
.iter()
@@ -116,7 +116,7 @@ impl XRInputSource {
});
}
- pub fn gamepad(&self) -> &DomRoot<Gamepad> {
+ pub(crate) fn gamepad(&self) -> &DomRoot<Gamepad> {
&self.gamepad
}
}
diff --git a/components/script/dom/webxr/xrinputsourcearray.rs b/components/script/dom/webxr/xrinputsourcearray.rs
index 5c26f2b5824..98e9ac2c85b 100644
--- a/components/script/dom/webxr/xrinputsourcearray.rs
+++ b/components/script/dom/webxr/xrinputsourcearray.rs
@@ -18,7 +18,7 @@ use crate::dom::xrsession::XRSession;
use crate::script_runtime::CanGc;
#[dom_struct]
-pub struct XRInputSourceArray {
+pub(crate) struct XRInputSourceArray {
reflector_: Reflector,
input_sources: DomRefCell<Vec<Dom<XRInputSource>>>,
}
@@ -31,7 +31,7 @@ impl XRInputSourceArray {
}
}
- pub fn new(global: &GlobalScope) -> DomRoot<XRInputSourceArray> {
+ pub(crate) fn new(global: &GlobalScope) -> DomRoot<XRInputSourceArray> {
reflect_dom_object(
Box::new(XRInputSourceArray::new_inherited()),
global,
@@ -39,7 +39,12 @@ impl XRInputSourceArray {
)
}
- pub fn add_input_sources(&self, session: &XRSession, inputs: &[InputSource], can_gc: CanGc) {
+ pub(crate) fn add_input_sources(
+ &self,
+ session: &XRSession,
+ inputs: &[InputSource],
+ can_gc: CanGc,
+ ) {
let global = self.global();
let mut added = vec![];
@@ -72,7 +77,7 @@ impl XRInputSourceArray {
event.upcast::<Event>().fire(session.upcast(), can_gc);
}
- pub fn remove_input_source(&self, session: &XRSession, id: InputId, can_gc: CanGc) {
+ pub(crate) fn remove_input_source(&self, session: &XRSession, id: InputId, can_gc: CanGc) {
let global = self.global();
let removed = if let Some(i) = self.input_sources.borrow().iter().find(|i| i.id() == id) {
i.gamepad().update_connected(false, false, can_gc);
@@ -95,7 +100,7 @@ impl XRInputSourceArray {
event.upcast::<Event>().fire(session.upcast(), can_gc);
}
- pub fn add_remove_input_source(
+ pub(crate) fn add_remove_input_source(
&self,
session: &XRSession,
id: InputId,
@@ -131,7 +136,7 @@ impl XRInputSourceArray {
event.upcast::<Event>().fire(session.upcast(), can_gc);
}
- pub fn find(&self, id: InputId) -> Option<DomRoot<XRInputSource>> {
+ pub(crate) fn find(&self, id: InputId) -> Option<DomRoot<XRInputSource>> {
self.input_sources
.borrow()
.iter()
diff --git a/components/script/dom/webxr/xrinputsourceevent.rs b/components/script/dom/webxr/xrinputsourceevent.rs
index cc694f8f99c..1e381b13a54 100644
--- a/components/script/dom/webxr/xrinputsourceevent.rs
+++ b/components/script/dom/webxr/xrinputsourceevent.rs
@@ -23,7 +23,7 @@ use crate::dom::xrinputsource::XRInputSource;
use crate::script_runtime::CanGc;
#[dom_struct]
-pub struct XRInputSourceEvent {
+pub(crate) struct XRInputSourceEvent {
event: Event,
frame: Dom<XRFrame>,
source: Dom<XRInputSource>,
@@ -39,7 +39,7 @@ impl XRInputSourceEvent {
}
}
- pub fn new(
+ pub(crate) fn new(
global: &GlobalScope,
type_: Atom,
bubbles: bool,
diff --git a/components/script/dom/webxr/xrinputsourceschangeevent.rs b/components/script/dom/webxr/xrinputsourceschangeevent.rs
index 4429f7d545e..1e2057b0c72 100644
--- a/components/script/dom/webxr/xrinputsourceschangeevent.rs
+++ b/components/script/dom/webxr/xrinputsourceschangeevent.rs
@@ -26,7 +26,7 @@ use crate::realms::enter_realm;
use crate::script_runtime::{CanGc, JSContext};
#[dom_struct]
-pub struct XRInputSourcesChangeEvent {
+pub(crate) struct XRInputSourcesChangeEvent {
event: Event,
session: Dom<XRSession>,
#[ignore_malloc_size_of = "mozjs"]
@@ -47,7 +47,7 @@ impl XRInputSourcesChangeEvent {
}
#[allow(clippy::too_many_arguments)]
- pub fn new(
+ pub(crate) fn new(
global: &GlobalScope,
type_: Atom,
bubbles: bool,
diff --git a/components/script/dom/webxr/xrjointpose.rs b/components/script/dom/webxr/xrjointpose.rs
index 315dfc9cfe9..df80b9a88d8 100644
--- a/components/script/dom/webxr/xrjointpose.rs
+++ b/components/script/dom/webxr/xrjointpose.rs
@@ -15,7 +15,7 @@ use crate::dom::xrsession::ApiRigidTransform;
use crate::script_runtime::CanGc;
#[dom_struct]
-pub struct XRJointPose {
+pub(crate) struct XRJointPose {
pose: XRPose,
radius: Option<f32>,
}
@@ -29,7 +29,7 @@ impl XRJointPose {
}
#[allow(unsafe_code)]
- pub fn new(
+ pub(crate) fn new(
global: &GlobalScope,
pose: ApiRigidTransform,
radius: Option<f32>,
diff --git a/components/script/dom/webxr/xrjointspace.rs b/components/script/dom/webxr/xrjointspace.rs
index 933f57339c5..7a125d54861 100644
--- a/components/script/dom/webxr/xrjointspace.rs
+++ b/components/script/dom/webxr/xrjointspace.rs
@@ -16,7 +16,7 @@ use crate::dom::xrspace::XRSpace;
use crate::script_runtime::CanGc;
#[dom_struct]
-pub struct XRJointSpace {
+pub(crate) struct XRJointSpace {
xrspace: XRSpace,
#[ignore_malloc_size_of = "defined in rust-webxr"]
#[no_trace]
@@ -28,7 +28,7 @@ pub struct XRJointSpace {
}
impl XRJointSpace {
- pub fn new_inherited(
+ pub(crate) fn new_inherited(
session: &XRSession,
input: InputId,
joint: Joint,
@@ -43,7 +43,7 @@ impl XRJointSpace {
}
#[allow(unused)]
- pub fn new(
+ pub(crate) fn new(
global: &GlobalScope,
session: &XRSession,
input: InputId,
@@ -57,13 +57,13 @@ impl XRJointSpace {
)
}
- pub fn space(&self) -> Space {
+ pub(crate) fn space(&self) -> Space {
let base = BaseSpace::Joint(self.input, self.joint);
let offset = RigidTransform3D::identity();
Space { base, offset }
}
- pub fn frame<'a>(&self, frame: &'a Frame) -> Option<&'a JointFrame> {
+ pub(crate) fn frame<'a>(&self, frame: &'a Frame) -> Option<&'a JointFrame> {
frame
.inputs
.iter()
@@ -72,7 +72,7 @@ impl XRJointSpace {
.and_then(|h| h.get(self.joint))
}
- pub fn get_pose(&self, frame: &Frame) -> Option<ApiPose> {
+ pub(crate) fn get_pose(&self, frame: &Frame) -> Option<ApiPose> {
self.frame(frame).map(|f| f.pose).map(|t| t.cast_unit())
}
}
diff --git a/components/script/dom/webxr/xrlayer.rs b/components/script/dom/webxr/xrlayer.rs
index 3dc3b4dfeea..4db2cfe3ac2 100644
--- a/components/script/dom/webxr/xrlayer.rs
+++ b/components/script/dom/webxr/xrlayer.rs
@@ -15,7 +15,7 @@ use crate::dom::xrsession::XRSession;
use crate::dom::xrwebgllayer::XRWebGLLayer;
#[dom_struct]
-pub struct XRLayer {
+pub(crate) struct XRLayer {
event_target: EventTarget,
session: Dom<XRSession>,
context: Dom<WebGLRenderingContext>,
@@ -28,7 +28,7 @@ pub struct XRLayer {
impl XRLayer {
#[allow(dead_code)]
- pub fn new_inherited(
+ pub(crate) fn new_inherited(
session: &XRSession,
context: &WebGLRenderingContext,
layer_id: Option<LayerId>,
@@ -57,7 +57,7 @@ impl XRLayer {
&self.session
}
- pub fn begin_frame(&self, frame: &XRFrame) -> Option<()> {
+ pub(crate) fn begin_frame(&self, frame: &XRFrame) -> Option<()> {
// TODO: Implement this for other layer types
if let Some(this) = self.downcast::<XRWebGLLayer>() {
this.begin_frame(frame)
@@ -66,7 +66,7 @@ impl XRLayer {
}
}
- pub fn end_frame(&self, frame: &XRFrame) -> Option<()> {
+ pub(crate) fn end_frame(&self, frame: &XRFrame) -> Option<()> {
// TODO: Implement this for other layer types
if let Some(this) = self.downcast::<XRWebGLLayer>() {
this.end_frame(frame)
diff --git a/components/script/dom/webxr/xrlayerevent.rs b/components/script/dom/webxr/xrlayerevent.rs
index 136aac87450..67d91539aa1 100644
--- a/components/script/dom/webxr/xrlayerevent.rs
+++ b/components/script/dom/webxr/xrlayerevent.rs
@@ -20,13 +20,13 @@ use crate::script_runtime::CanGc;
// https://w3c.github.io/uievents/#interface-uievent
#[dom_struct]
-pub struct XRLayerEvent {
+pub(crate) struct XRLayerEvent {
event: Event,
layer: Dom<XRLayer>,
}
impl XRLayerEvent {
- pub fn new_inherited(layer: &XRLayer) -> XRLayerEvent {
+ pub(crate) fn new_inherited(layer: &XRLayer) -> XRLayerEvent {
XRLayerEvent {
event: Event::new_inherited(),
layer: Dom::from_ref(layer),
diff --git a/components/script/dom/webxr/xrmediabinding.rs b/components/script/dom/webxr/xrmediabinding.rs
index 14eec1fb354..db535542f88 100644
--- a/components/script/dom/webxr/xrmediabinding.rs
+++ b/components/script/dom/webxr/xrmediabinding.rs
@@ -19,13 +19,13 @@ use crate::dom::xrsession::XRSession;
use crate::script_runtime::CanGc;
#[dom_struct]
-pub struct XRMediaBinding {
+pub(crate) struct XRMediaBinding {
reflector: Reflector,
session: Dom<XRSession>,
}
impl XRMediaBinding {
- pub fn new_inherited(session: &XRSession) -> XRMediaBinding {
+ pub(crate) fn new_inherited(session: &XRSession) -> XRMediaBinding {
XRMediaBinding {
reflector: Reflector::new(),
session: Dom::from_ref(session),
diff --git a/components/script/dom/webxr/xrpose.rs b/components/script/dom/webxr/xrpose.rs
index 08442f54806..71d67eb48e1 100644
--- a/components/script/dom/webxr/xrpose.rs
+++ b/components/script/dom/webxr/xrpose.rs
@@ -14,13 +14,13 @@ use crate::dom::xrsession::ApiRigidTransform;
use crate::script_runtime::CanGc;
#[dom_struct]
-pub struct XRPose {
+pub(crate) struct XRPose {
reflector_: Reflector,
transform: Dom<XRRigidTransform>,
}
impl XRPose {
- pub fn new_inherited(transform: &XRRigidTransform) -> XRPose {
+ pub(crate) fn new_inherited(transform: &XRRigidTransform) -> XRPose {
XRPose {
reflector_: Reflector::new(),
transform: Dom::from_ref(transform),
@@ -28,7 +28,7 @@ impl XRPose {
}
#[allow(unused)]
- pub fn new(
+ pub(crate) fn new(
global: &GlobalScope,
transform: ApiRigidTransform,
can_gc: CanGc,
diff --git a/components/script/dom/webxr/xrprojectionlayer.rs b/components/script/dom/webxr/xrprojectionlayer.rs
index 489c3a9e706..6b9b4964cc2 100644
--- a/components/script/dom/webxr/xrprojectionlayer.rs
+++ b/components/script/dom/webxr/xrprojectionlayer.rs
@@ -7,6 +7,6 @@ use dom_struct::dom_struct;
use crate::dom::xrcompositionlayer::XRCompositionLayer;
#[dom_struct]
-pub struct XRProjectionLayer {
+pub(crate) struct XRProjectionLayer {
composition_layer: XRCompositionLayer,
}
diff --git a/components/script/dom/webxr/xrquadlayer.rs b/components/script/dom/webxr/xrquadlayer.rs
index dd93aea9c0a..73f7b32cc83 100644
--- a/components/script/dom/webxr/xrquadlayer.rs
+++ b/components/script/dom/webxr/xrquadlayer.rs
@@ -7,6 +7,6 @@ use dom_struct::dom_struct;
use crate::dom::xrcompositionlayer::XRCompositionLayer;
#[dom_struct]
-pub struct XRQuadLayer {
+pub(crate) struct XRQuadLayer {
composition_layer: XRCompositionLayer,
}
diff --git a/components/script/dom/webxr/xrray.rs b/components/script/dom/webxr/xrray.rs
index 4936edd0acb..548f30ea111 100644
--- a/components/script/dom/webxr/xrray.rs
+++ b/components/script/dom/webxr/xrray.rs
@@ -21,7 +21,7 @@ use crate::dom::xrrigidtransform::XRRigidTransform;
use crate::script_runtime::{CanGc, JSContext};
#[dom_struct]
-pub struct XRRay {
+pub(crate) struct XRRay {
reflector_: Reflector,
#[ignore_malloc_size_of = "defined in webxr"]
#[no_trace]
@@ -48,7 +48,7 @@ impl XRRay {
reflect_dom_object_with_proto(Box::new(XRRay::new_inherited(ray)), global, proto, can_gc)
}
- pub fn ray(&self) -> Ray<ApiSpace> {
+ pub(crate) fn ray(&self) -> Ray<ApiSpace> {
self.ray
}
}
diff --git a/components/script/dom/webxr/xrreferencespace.rs b/components/script/dom/webxr/xrreferencespace.rs
index 04d81070095..abd9f47c69f 100644
--- a/components/script/dom/webxr/xrreferencespace.rs
+++ b/components/script/dom/webxr/xrreferencespace.rs
@@ -19,14 +19,14 @@ use crate::dom::xrspace::XRSpace;
use crate::script_runtime::CanGc;
#[dom_struct]
-pub struct XRReferenceSpace {
+pub(crate) struct XRReferenceSpace {
xrspace: XRSpace,
offset: Dom<XRRigidTransform>,
ty: XRReferenceSpaceType,
}
impl XRReferenceSpace {
- pub fn new_inherited(
+ pub(crate) fn new_inherited(
session: &XRSession,
offset: &XRRigidTransform,
ty: XRReferenceSpaceType,
@@ -39,7 +39,7 @@ impl XRReferenceSpace {
}
#[allow(unused)]
- pub fn new(
+ pub(crate) fn new(
global: &GlobalScope,
session: &XRSession,
ty: XRReferenceSpaceType,
@@ -50,7 +50,7 @@ impl XRReferenceSpace {
}
#[allow(unused)]
- pub fn new_offset(
+ pub(crate) fn new_offset(
global: &GlobalScope,
session: &XRSession,
ty: XRReferenceSpaceType,
@@ -63,7 +63,7 @@ impl XRReferenceSpace {
)
}
- pub fn space(&self) -> Space {
+ pub(crate) fn space(&self) -> Space {
let base = match self.ty {
XRReferenceSpaceType::Local => webxr_api::BaseSpace::Local,
XRReferenceSpaceType::Viewer => webxr_api::BaseSpace::Viewer,
@@ -75,7 +75,7 @@ impl XRReferenceSpace {
Space { base, offset }
}
- pub fn ty(&self) -> XRReferenceSpaceType {
+ pub(crate) fn ty(&self) -> XRReferenceSpaceType {
self.ty
}
}
@@ -102,7 +102,7 @@ impl XRReferenceSpace {
///
/// This is equivalent to `get_pose(self).inverse()` (in column vector notation),
/// but with better types
- pub fn get_base_transform(&self, base_pose: &Frame) -> Option<BaseTransform> {
+ pub(crate) fn get_base_transform(&self, base_pose: &Frame) -> Option<BaseTransform> {
let pose = self.get_pose(base_pose)?;
Some(pose.inverse().cast_unit())
}
@@ -112,7 +112,7 @@ impl XRReferenceSpace {
/// The reference origin used is common between all
/// get_pose calls for spaces from the same device, so this can be used to compare
/// with other spaces
- pub fn get_pose(&self, base_pose: &Frame) -> Option<ApiPose> {
+ pub(crate) fn get_pose(&self, base_pose: &Frame) -> Option<ApiPose> {
let pose = self.get_unoffset_pose(base_pose)?;
let offset = self.offset.transform();
// pose is a transform from the unoffset space to native space,
@@ -125,7 +125,7 @@ impl XRReferenceSpace {
/// Gets pose represented by this space
///
/// Does not apply originOffset, use get_viewer_pose instead if you need it
- pub fn get_unoffset_pose(&self, base_pose: &Frame) -> Option<ApiPose> {
+ pub(crate) fn get_unoffset_pose(&self, base_pose: &Frame) -> Option<ApiPose> {
match self.ty {
XRReferenceSpaceType::Local => {
// The eye-level pose is basically whatever the headset pose was at t=0, which
@@ -146,7 +146,7 @@ impl XRReferenceSpace {
}
}
- pub fn get_bounds(&self) -> Option<Vec<Point2D<f32, Floor>>> {
+ pub(crate) fn get_bounds(&self) -> Option<Vec<Point2D<f32, Floor>>> {
self.upcast::<XRSpace>()
.session()
.with_session(|s| s.reference_space_bounds())
diff --git a/components/script/dom/webxr/xrreferencespaceevent.rs b/components/script/dom/webxr/xrreferencespaceevent.rs
index e75aabe14a1..cce439c3757 100644
--- a/components/script/dom/webxr/xrreferencespaceevent.rs
+++ b/components/script/dom/webxr/xrreferencespaceevent.rs
@@ -23,7 +23,7 @@ use crate::dom::xrrigidtransform::XRRigidTransform;
use crate::script_runtime::CanGc;
#[dom_struct]
-pub struct XRReferenceSpaceEvent {
+pub(crate) struct XRReferenceSpaceEvent {
event: Event,
space: Dom<XRReferenceSpace>,
transform: Option<Dom<XRRigidTransform>>,
@@ -42,7 +42,7 @@ impl XRReferenceSpaceEvent {
}
}
- pub fn new(
+ pub(crate) fn new(
global: &GlobalScope,
type_: Atom,
bubbles: bool,
diff --git a/components/script/dom/webxr/xrrenderstate.rs b/components/script/dom/webxr/xrrenderstate.rs
index b2d5219ed00..3c7a12393b3 100644
--- a/components/script/dom/webxr/xrrenderstate.rs
+++ b/components/script/dom/webxr/xrrenderstate.rs
@@ -20,7 +20,7 @@ use crate::dom::xrwebgllayer::XRWebGLLayer;
use crate::script_runtime::{CanGc, JSContext};
#[dom_struct]
-pub struct XRRenderState {
+pub(crate) struct XRRenderState {
reflector_: Reflector,
depth_near: Cell<f64>,
depth_far: Cell<f64>,
@@ -30,7 +30,7 @@ pub struct XRRenderState {
}
impl XRRenderState {
- pub fn new_inherited(
+ pub(crate) fn new_inherited(
depth_near: f64,
depth_far: f64,
inline_vertical_fov: Option<f64>,
@@ -48,7 +48,7 @@ impl XRRenderState {
}
}
- pub fn new(
+ pub(crate) fn new(
global: &GlobalScope,
depth_near: f64,
depth_far: f64,
@@ -69,7 +69,7 @@ impl XRRenderState {
)
}
- pub fn clone_object(&self) -> DomRoot<Self> {
+ pub(crate) fn clone_object(&self) -> DomRoot<Self> {
XRRenderState::new(
&self.global(),
self.depth_near.get(),
@@ -80,30 +80,30 @@ impl XRRenderState {
)
}
- pub fn set_depth_near(&self, depth: f64) {
+ pub(crate) fn set_depth_near(&self, depth: f64) {
self.depth_near.set(depth)
}
- pub fn set_depth_far(&self, depth: f64) {
+ pub(crate) fn set_depth_far(&self, depth: f64) {
self.depth_far.set(depth)
}
- pub fn set_inline_vertical_fov(&self, fov: f64) {
+ pub(crate) fn set_inline_vertical_fov(&self, fov: f64) {
debug_assert!(self.inline_vertical_fov.get().is_some());
self.inline_vertical_fov.set(Some(fov))
}
- pub fn set_base_layer(&self, layer: Option<&XRWebGLLayer>) {
+ pub(crate) fn set_base_layer(&self, layer: Option<&XRWebGLLayer>) {
self.base_layer.set(layer)
}
- pub fn set_layers(&self, layers: Vec<&XRLayer>) {
+ pub(crate) fn set_layers(&self, layers: Vec<&XRLayer>) {
*self.layers.borrow_mut() = layers.into_iter().map(Dom::from_ref).collect();
}
- pub fn with_layers<F, R>(&self, f: F) -> R
+ pub(crate) fn with_layers<F, R>(&self, f: F) -> R
where
F: FnOnce(&[Dom<XRLayer>]) -> R,
{
let layers = self.layers.borrow();
f(&layers)
}
- pub fn has_sub_images(&self, sub_images: &[SubImages]) -> bool {
+ pub(crate) fn has_sub_images(&self, sub_images: &[SubImages]) -> bool {
if let Some(base_layer) = self.base_layer.get() {
match sub_images.len() {
// For inline sessions, there may be a base layer, but it won't have a framebuffer
diff --git a/components/script/dom/webxr/xrrigidtransform.rs b/components/script/dom/webxr/xrrigidtransform.rs
index e215c17cf4e..57c6dd4de0d 100644
--- a/components/script/dom/webxr/xrrigidtransform.rs
+++ b/components/script/dom/webxr/xrrigidtransform.rs
@@ -20,7 +20,7 @@ use crate::dom::xrsession::ApiRigidTransform;
use crate::script_runtime::{CanGc, JSContext};
#[dom_struct]
-pub struct XRRigidTransform {
+pub(crate) struct XRRigidTransform {
reflector_: Reflector,
position: MutNullableDom<DOMPointReadOnly>,
orientation: MutNullableDom<DOMPointReadOnly>,
@@ -44,7 +44,7 @@ impl XRRigidTransform {
}
}
- pub fn new(
+ pub(crate) fn new(
global: &GlobalScope,
transform: ApiRigidTransform,
can_gc: CanGc,
@@ -66,7 +66,7 @@ impl XRRigidTransform {
)
}
- pub fn identity(window: &GlobalScope, can_gc: CanGc) -> DomRoot<XRRigidTransform> {
+ pub(crate) fn identity(window: &GlobalScope, can_gc: CanGc) -> DomRoot<XRRigidTransform> {
let transform = RigidTransform3D::identity();
XRRigidTransform::new(window, transform, can_gc)
}
@@ -182,7 +182,7 @@ impl XRRigidTransformMethods<crate::DomTypeHolder> for XRRigidTransform {
impl XRRigidTransform {
/// <https://immersive-web.github.io/webxr/#dom-xrpose-transform>
- pub fn transform(&self) -> ApiRigidTransform {
+ pub(crate) fn transform(&self) -> ApiRigidTransform {
self.transform
}
}
diff --git a/components/script/dom/webxr/xrsession.rs b/components/script/dom/webxr/xrsession.rs
index 7e45d0c3f55..13ed485139b 100644
--- a/components/script/dom/webxr/xrsession.rs
+++ b/components/script/dom/webxr/xrsession.rs
@@ -71,7 +71,7 @@ use crate::script_runtime::JSContext;
use crate::script_runtime::CanGc;
#[dom_struct]
-pub struct XRSession {
+pub(crate) struct XRSession {
eventtarget: EventTarget,
blend_mode: XREnvironmentBlendMode,
mode: XRSessionMode,
@@ -150,7 +150,7 @@ impl XRSession {
}
}
- pub fn new(
+ pub(crate) fn new(
global: &GlobalScope,
session: Session,
mode: XRSessionMode,
@@ -178,21 +178,21 @@ impl XRSession {
ret
}
- pub fn with_session<R, F: FnOnce(&Session) -> R>(&self, with: F) -> R {
+ pub(crate) fn with_session<R, F: FnOnce(&Session) -> R>(&self, with: F) -> R {
let session = self.session.borrow();
with(&session)
}
- pub fn is_ended(&self) -> bool {
+ pub(crate) fn is_ended(&self) -> bool {
self.ended.get()
}
- pub fn is_immersive(&self) -> bool {
+ pub(crate) fn is_immersive(&self) -> bool {
self.mode != XRSessionMode::Inline
}
// https://immersive-web.github.io/layers/#feature-descriptor-layers
- pub fn has_layers_feature(&self) -> bool {
+ pub(crate) fn has_layers_feature(&self) -> bool {
// We do not support creating layers other than projection layers
// https://github.com/servo/servo/issues/27493
false
@@ -220,7 +220,7 @@ impl XRSession {
self.session.borrow_mut().start_render_loop();
}
- pub fn is_outside_raf(&self) -> bool {
+ pub(crate) fn is_outside_raf(&self) -> bool {
self.outside_raf.get()
}
@@ -252,7 +252,7 @@ impl XRSession {
//
// This enables content that assumes all input sources are accompanied
// by an inputsourceschange event to work properly. Without
- pub fn setup_initial_inputs(&self) {
+ pub(crate) fn setup_initial_inputs(&self) {
let initial_inputs = self.session.borrow().initial_inputs().to_owned();
if initial_inputs.is_empty() {
@@ -519,7 +519,7 @@ impl XRSession {
}
/// Constructs a View suitable for inline sessions using the inlineVerticalFieldOfView and canvas size
- pub fn inline_view(&self) -> View<Viewer> {
+ pub(crate) fn inline_view(&self) -> View<Viewer> {
debug_assert!(!self.is_immersive());
View {
// Inline views have no offset
@@ -528,11 +528,11 @@ impl XRSession {
}
}
- pub fn session_id(&self) -> SessionId {
+ pub(crate) fn session_id(&self) -> SessionId {
self.session.borrow().id()
}
- pub fn dirty_layers(&self) {
+ pub(crate) fn dirty_layers(&self) {
if let Some(layer) = self.RenderState().GetBaseLayer() {
layer.context().mark_as_dirty();
}
@@ -1071,17 +1071,17 @@ impl XRSessionMethods<crate::DomTypeHolder> for XRSession {
}
// The pose of an object in native-space. Should never be exposed.
-pub type ApiPose = RigidTransform3D<f32, ApiSpace, webxr_api::Native>;
+pub(crate) type ApiPose = RigidTransform3D<f32, ApiSpace, webxr_api::Native>;
// A transform between objects in some API-space
-pub type ApiRigidTransform = RigidTransform3D<f32, ApiSpace, ApiSpace>;
+pub(crate) type ApiRigidTransform = RigidTransform3D<f32, ApiSpace, ApiSpace>;
#[derive(Clone, Copy)]
-pub struct BaseSpace;
+pub(crate) struct BaseSpace;
-pub type BaseTransform = RigidTransform3D<f32, webxr_api::Native, BaseSpace>;
+pub(crate) type BaseTransform = RigidTransform3D<f32, webxr_api::Native, BaseSpace>;
#[allow(unsafe_code)]
-pub fn cast_transform<T, U, V, W>(
+pub(crate) fn cast_transform<T, U, V, W>(
transform: RigidTransform3D<f32, T, U>,
) -> RigidTransform3D<f32, V, W> {
unsafe { mem::transmute(transform) }
diff --git a/components/script/dom/webxr/xrsessionevent.rs b/components/script/dom/webxr/xrsessionevent.rs
index fda299a9f2a..98f5ce710b8 100644
--- a/components/script/dom/webxr/xrsessionevent.rs
+++ b/components/script/dom/webxr/xrsessionevent.rs
@@ -20,7 +20,7 @@ use crate::dom::xrsession::XRSession;
use crate::script_runtime::CanGc;
#[dom_struct]
-pub struct XRSessionEvent {
+pub(crate) struct XRSessionEvent {
event: Event,
session: Dom<XRSession>,
}
@@ -34,7 +34,7 @@ impl XRSessionEvent {
}
}
- pub fn new(
+ pub(crate) fn new(
global: &GlobalScope,
type_: Atom,
bubbles: bool,
diff --git a/components/script/dom/webxr/xrspace.rs b/components/script/dom/webxr/xrspace.rs
index 42a2933edee..df7503677b6 100644
--- a/components/script/dom/webxr/xrspace.rs
+++ b/components/script/dom/webxr/xrspace.rs
@@ -18,7 +18,7 @@ use crate::dom::xrsession::{cast_transform, ApiPose, XRSession};
use crate::script_runtime::CanGc;
#[dom_struct]
-pub struct XRSpace {
+pub(crate) struct XRSpace {
eventtarget: EventTarget,
session: Dom<XRSession>,
input_source: MutNullableDom<XRInputSource>,
@@ -27,7 +27,7 @@ pub struct XRSpace {
}
impl XRSpace {
- pub fn new_inherited(session: &XRSession) -> XRSpace {
+ pub(crate) fn new_inherited(session: &XRSession) -> XRSpace {
XRSpace {
eventtarget: EventTarget::new_inherited(),
session: Dom::from_ref(session),
@@ -49,7 +49,7 @@ impl XRSpace {
}
}
- pub fn new_inputspace(
+ pub(crate) fn new_inputspace(
global: &GlobalScope,
session: &XRSession,
input: &XRInputSource,
@@ -62,7 +62,7 @@ impl XRSpace {
)
}
- pub fn space(&self) -> Space {
+ pub(crate) fn space(&self) -> Space {
if let Some(rs) = self.downcast::<XRReferenceSpace>() {
rs.space()
} else if let Some(j) = self.downcast::<XRJointSpace>() {
@@ -89,7 +89,7 @@ impl XRSpace {
/// The reference origin used is common between all
/// get_pose calls for spaces from the same device, so this can be used to compare
/// with other spaces
- pub fn get_pose(&self, base_pose: &Frame) -> Option<ApiPose> {
+ pub(crate) fn get_pose(&self, base_pose: &Frame) -> Option<ApiPose> {
if let Some(reference) = self.downcast::<XRReferenceSpace>() {
reference.get_pose(base_pose)
} else if let Some(joint) = self.downcast::<XRJointSpace>() {
@@ -116,7 +116,7 @@ impl XRSpace {
}
}
- pub fn session(&self) -> &XRSession {
+ pub(crate) fn session(&self) -> &XRSession {
&self.session
}
}
diff --git a/components/script/dom/webxr/xrsubimage.rs b/components/script/dom/webxr/xrsubimage.rs
index 53d2e3ca697..8bf84b82063 100644
--- a/components/script/dom/webxr/xrsubimage.rs
+++ b/components/script/dom/webxr/xrsubimage.rs
@@ -10,7 +10,7 @@ use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::xrviewport::XRViewport;
#[dom_struct]
-pub struct XRSubImage {
+pub(crate) struct XRSubImage {
reflector: Reflector,
viewport: Dom<XRViewport>,
}
diff --git a/components/script/dom/webxr/xrsystem.rs b/components/script/dom/webxr/xrsystem.rs
index 3eace3892f7..82736d540e9 100644
--- a/components/script/dom/webxr/xrsystem.rs
+++ b/components/script/dom/webxr/xrsystem.rs
@@ -37,7 +37,7 @@ use crate::script_runtime::CanGc;
use crate::script_thread::ScriptThread;
#[dom_struct]
-pub struct XRSystem {
+pub(crate) struct XRSystem {
eventtarget: EventTarget,
gamepads: DomRefCell<Vec<Dom<Gamepad>>>,
pending_immersive_session: Cell<bool>,
@@ -61,7 +61,7 @@ impl XRSystem {
}
}
- pub fn new(window: &Window) -> DomRoot<XRSystem> {
+ pub(crate) fn new(window: &Window) -> DomRoot<XRSystem> {
reflect_dom_object(
Box::new(XRSystem::new_inherited(window.pipeline_id())),
window,
@@ -69,15 +69,15 @@ impl XRSystem {
)
}
- pub fn pending_or_active_session(&self) -> bool {
+ pub(crate) fn pending_or_active_session(&self) -> bool {
self.pending_immersive_session.get() || self.active_immersive_session.get().is_some()
}
- pub fn set_pending(&self) {
+ pub(crate) fn set_pending(&self) {
self.pending_immersive_session.set(true)
}
- pub fn set_active_immersive_session(&self, session: &XRSession) {
+ pub(crate) fn set_active_immersive_session(&self, session: &XRSession) {
// XXXManishearth when we support non-immersive (inline) sessions we should
// ensure they never reach these codepaths
self.pending_immersive_session.set(false);
@@ -85,7 +85,7 @@ impl XRSystem {
}
/// <https://immersive-web.github.io/webxr/#ref-for-eventdef-xrsession-end>
- pub fn end_session(&self, session: &XRSession) {
+ pub(crate) fn end_session(&self, session: &XRSession) {
// Step 3
if let Some(active) = self.active_immersive_session.get() {
if Dom::from_ref(&*active) == Dom::from_ref(session) {
@@ -308,7 +308,7 @@ impl XRSystem {
}
// https://github.com/immersive-web/navigation/issues/10
- pub fn dispatch_sessionavailable(&self) {
+ pub(crate) fn dispatch_sessionavailable(&self) {
let xr = Trusted::new(self);
self.global()
.task_manager()
diff --git a/components/script/dom/webxr/xrtest.rs b/components/script/dom/webxr/xrtest.rs
index 59f489f980d..04c4f2f866f 100644
--- a/components/script/dom/webxr/xrtest.rs
+++ b/components/script/dom/webxr/xrtest.rs
@@ -30,20 +30,20 @@ use crate::script_runtime::CanGc;
use crate::script_thread::ScriptThread;
#[dom_struct]
-pub struct XRTest {
+pub(crate) struct XRTest {
reflector: Reflector,
devices_connected: DomRefCell<Vec<Dom<FakeXRDevice>>>,
}
impl XRTest {
- pub fn new_inherited() -> XRTest {
+ pub(crate) fn new_inherited() -> XRTest {
XRTest {
reflector: Reflector::new(),
devices_connected: DomRefCell::new(vec![]),
}
}
- pub fn new(global: &GlobalScope) -> DomRoot<XRTest> {
+ pub(crate) fn new(global: &GlobalScope) -> DomRoot<XRTest> {
reflect_dom_object(Box::new(XRTest::new_inherited()), global, CanGc::note())
}
diff --git a/components/script/dom/webxr/xrview.rs b/components/script/dom/webxr/xrview.rs
index 115fde4ec35..fb2d64087b1 100644
--- a/components/script/dom/webxr/xrview.rs
+++ b/components/script/dom/webxr/xrview.rs
@@ -20,7 +20,7 @@ use crate::dom::xrsession::{cast_transform, BaseSpace, BaseTransform, XRSession}
use crate::script_runtime::{CanGc, JSContext};
#[dom_struct]
-pub struct XRView {
+pub(crate) struct XRView {
reflector_: Reflector,
session: Dom<XRSession>,
eye: XREye,
@@ -54,7 +54,7 @@ impl XRView {
}
}
- pub fn new<V: Copy>(
+ pub(crate) fn new<V: Copy>(
global: &GlobalScope,
session: &XRSession,
view: &View<V>,
@@ -79,11 +79,11 @@ impl XRView {
)
}
- pub fn session(&self) -> &XRSession {
+ pub(crate) fn session(&self) -> &XRSession {
&self.session
}
- pub fn viewport_index(&self) -> usize {
+ pub(crate) fn viewport_index(&self) -> usize {
self.viewport_index
}
}
diff --git a/components/script/dom/webxr/xrviewerpose.rs b/components/script/dom/webxr/xrviewerpose.rs
index 1ab6e1b92e1..f7f1924d963 100644
--- a/components/script/dom/webxr/xrviewerpose.rs
+++ b/components/script/dom/webxr/xrviewerpose.rs
@@ -23,7 +23,7 @@ use crate::realms::enter_realm;
use crate::script_runtime::{CanGc, JSContext};
#[dom_struct]
-pub struct XRViewerPose {
+pub(crate) struct XRViewerPose {
pose: XRPose,
#[ignore_malloc_size_of = "mozjs"]
views: Heap<JSVal>,
@@ -38,7 +38,7 @@ impl XRViewerPose {
}
#[allow(unsafe_code)]
- pub fn new(
+ pub(crate) fn new(
global: &GlobalScope,
session: &XRSession,
to_base: BaseTransform,
diff --git a/components/script/dom/webxr/xrviewport.rs b/components/script/dom/webxr/xrviewport.rs
index 49c137c28b0..1c759be7089 100644
--- a/components/script/dom/webxr/xrviewport.rs
+++ b/components/script/dom/webxr/xrviewport.rs
@@ -13,7 +13,7 @@ use crate::dom::globalscope::GlobalScope;
use crate::script_runtime::CanGc;
#[dom_struct]
-pub struct XRViewport {
+pub(crate) struct XRViewport {
reflector_: Reflector,
#[no_trace]
viewport: Rect<i32, Viewport>,
@@ -27,7 +27,7 @@ impl XRViewport {
}
}
- pub fn new(global: &GlobalScope, viewport: Rect<i32, Viewport>) -> DomRoot<XRViewport> {
+ pub(crate) fn new(global: &GlobalScope, viewport: Rect<i32, Viewport>) -> DomRoot<XRViewport> {
reflect_dom_object(
Box::new(XRViewport::new_inherited(viewport)),
global,
diff --git a/components/script/dom/webxr/xrwebglbinding.rs b/components/script/dom/webxr/xrwebglbinding.rs
index c2d652bb81d..d0e7c3a3d01 100644
--- a/components/script/dom/webxr/xrwebglbinding.rs
+++ b/components/script/dom/webxr/xrwebglbinding.rs
@@ -31,14 +31,17 @@ use crate::dom::xrwebglsubimage::XRWebGLSubImage;
use crate::script_runtime::CanGc;
#[dom_struct]
-pub struct XRWebGLBinding {
+pub(crate) struct XRWebGLBinding {
reflector: Reflector,
session: Dom<XRSession>,
context: Dom<WebGLRenderingContext>,
}
impl XRWebGLBinding {
- pub fn new_inherited(session: &XRSession, context: &WebGLRenderingContext) -> XRWebGLBinding {
+ pub(crate) fn new_inherited(
+ session: &XRSession,
+ context: &WebGLRenderingContext,
+ ) -> XRWebGLBinding {
XRWebGLBinding {
reflector: Reflector::new(),
session: Dom::from_ref(session),
diff --git a/components/script/dom/webxr/xrwebgllayer.rs b/components/script/dom/webxr/xrwebgllayer.rs
index 031bd4b2f4d..0fd4147b80f 100644
--- a/components/script/dom/webxr/xrwebgllayer.rs
+++ b/components/script/dom/webxr/xrwebgllayer.rs
@@ -48,7 +48,7 @@ impl<'a> From<&'a XRWebGLLayerInit> for LayerInit {
}
#[dom_struct]
-pub struct XRWebGLLayer {
+pub(crate) struct XRWebGLLayer {
xr_layer: XRLayer,
antialias: bool,
depth: bool,
@@ -60,7 +60,7 @@ pub struct XRWebGLLayer {
}
impl XRWebGLLayer {
- pub fn new_inherited(
+ pub(crate) fn new_inherited(
session: &XRSession,
context: &WebGLRenderingContext,
init: &XRWebGLLayerInit,
@@ -103,19 +103,19 @@ impl XRWebGLLayer {
)
}
- pub fn layer_id(&self) -> Option<LayerId> {
+ pub(crate) fn layer_id(&self) -> Option<LayerId> {
self.xr_layer.layer_id()
}
- pub fn context_id(&self) -> WebGLContextId {
+ pub(crate) fn context_id(&self) -> WebGLContextId {
self.xr_layer.context_id()
}
- pub fn session(&self) -> &XRSession {
+ pub(crate) fn session(&self) -> &XRSession {
self.xr_layer.session()
}
- pub fn size(&self) -> Size2D<u32, Viewport> {
+ pub(crate) fn size(&self) -> Size2D<u32, Viewport> {
if let Some(framebuffer) = self.framebuffer.as_ref() {
let size = framebuffer.size().unwrap_or((0, 0));
Size2D::new(
@@ -145,7 +145,7 @@ impl XRWebGLLayer {
}
}
- pub fn begin_frame(&self, frame: &XRFrame) -> Option<()> {
+ pub(crate) fn begin_frame(&self, frame: &XRFrame) -> Option<()> {
debug!("XRWebGLLayer begin frame");
let framebuffer = self.framebuffer.as_ref()?;
let context = framebuffer.upcast::<WebGLObject>().context();
@@ -211,7 +211,7 @@ impl XRWebGLLayer {
Some(())
}
- pub fn end_frame(&self, _frame: &XRFrame) -> Option<()> {
+ pub(crate) fn end_frame(&self, _frame: &XRFrame) -> Option<()> {
debug!("XRWebGLLayer end frame");
// TODO: invalidate the old texture
let framebuffer = self.framebuffer.as_ref()?;
diff --git a/components/script/dom/webxr/xrwebglsubimage.rs b/components/script/dom/webxr/xrwebglsubimage.rs
index acdcd22f4a9..67b2c5e8c1d 100644
--- a/components/script/dom/webxr/xrwebglsubimage.rs
+++ b/components/script/dom/webxr/xrwebglsubimage.rs
@@ -12,7 +12,7 @@ use crate::dom::webgltexture::WebGLTexture;
use crate::dom::xrsubimage::XRSubImage;
#[dom_struct]
-pub struct XRWebGLSubImage {
+pub(crate) struct XRWebGLSubImage {
xr_sub_image: XRSubImage,
color_texture: Dom<WebGLTexture>,
depth_stencil_texture: Option<Dom<WebGLTexture>>,