diff options
author | Josh Matthews <josh@joshmatthews.net> | 2025-01-10 03:19:19 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-10 08:19:19 +0000 |
commit | c94d909a8688589209cdf0c7ae58e40f9b8c411e (patch) | |
tree | 12febf23eed4438249fd4d276c4d8b35dee22a97 /components/script/dom/webxr/xrsession.rs | |
parent | f220d6d3a52296794cd19935e9e59cc75a179a44 (diff) | |
download | servo-c94d909a8688589209cdf0c7ae58e40f9b8c411e.tar.gz servo-c94d909a8688589209cdf0c7ae58e40f9b8c411e.zip |
script: Limit public exports. (#34915)
* script: Restrict reexport visibility of DOM types.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* script: Mass pub->pub(crate) conversion.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* script: Hide existing dead code warnings.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Formatting.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Fix clippy warnings.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Formatting.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Fix unit tests.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Fix clippy.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* More formatting.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
---------
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Diffstat (limited to 'components/script/dom/webxr/xrsession.rs')
-rw-r--r-- | components/script/dom/webxr/xrsession.rs | 32 |
1 files changed, 16 insertions, 16 deletions
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) } |