mirror of
https://github.com/servo/servo.git
synced 2025-08-11 16:35:33 +01:00
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>
This commit is contained in:
parent
f220d6d3a5
commit
c94d909a86
585 changed files with 5411 additions and 5013 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue