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:
Josh Matthews 2025-01-10 03:19:19 -05:00 committed by GitHub
parent f220d6d3a5
commit c94d909a86
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
585 changed files with 5411 additions and 5013 deletions

View file

@ -23,7 +23,7 @@ use crate::dom::webglrenderingcontext::{Operation, WebGLRenderingContext};
use crate::script_runtime::CanGc;
#[dom_struct]
pub struct WebGLRenderbuffer {
pub(crate) struct WebGLRenderbuffer {
webgl_object: WebGLObject,
#[no_trace]
id: WebGLRenderbufferId,
@ -49,7 +49,7 @@ impl WebGLRenderbuffer {
}
}
pub fn maybe_new(context: &WebGLRenderingContext) -> Option<DomRoot<Self>> {
pub(crate) fn maybe_new(context: &WebGLRenderingContext) -> Option<DomRoot<Self>> {
let (sender, receiver) = webgl_channel().unwrap();
context.send_command(WebGLCommand::CreateRenderbuffer(sender));
receiver
@ -58,7 +58,7 @@ impl WebGLRenderbuffer {
.map(|id| WebGLRenderbuffer::new(context, id))
}
pub fn new(context: &WebGLRenderingContext, id: WebGLRenderbufferId) -> DomRoot<Self> {
pub(crate) fn new(context: &WebGLRenderingContext, id: WebGLRenderbufferId) -> DomRoot<Self> {
reflect_dom_object(
Box::new(WebGLRenderbuffer::new_inherited(context, id)),
&*context.global(),
@ -68,34 +68,34 @@ impl WebGLRenderbuffer {
}
impl WebGLRenderbuffer {
pub fn id(&self) -> WebGLRenderbufferId {
pub(crate) fn id(&self) -> WebGLRenderbufferId {
self.id
}
pub fn size(&self) -> Option<(i32, i32)> {
pub(crate) fn size(&self) -> Option<(i32, i32)> {
self.size.get()
}
pub fn internal_format(&self) -> u32 {
pub(crate) fn internal_format(&self) -> u32 {
self.internal_format.get().unwrap_or(constants::RGBA4)
}
pub fn mark_initialized(&self) {
pub(crate) fn mark_initialized(&self) {
self.is_initialized.set(true);
}
pub fn is_initialized(&self) -> bool {
pub(crate) fn is_initialized(&self) -> bool {
self.is_initialized.get()
}
pub fn bind(&self, target: u32) {
pub(crate) fn bind(&self, target: u32) {
self.ever_bound.set(true);
self.upcast::<WebGLObject>()
.context()
.send_command(WebGLCommand::BindRenderbuffer(target, Some(self.id)));
}
pub fn delete(&self, operation_fallibility: Operation) {
pub(crate) fn delete(&self, operation_fallibility: Operation) {
if !self.is_deleted.get() {
self.is_deleted.set(true);
@ -125,15 +125,15 @@ impl WebGLRenderbuffer {
}
}
pub fn is_deleted(&self) -> bool {
pub(crate) fn is_deleted(&self) -> bool {
self.is_deleted.get()
}
pub fn ever_bound(&self) -> bool {
pub(crate) fn ever_bound(&self) -> bool {
self.ever_bound.get()
}
pub fn storage(
pub(crate) fn storage(
&self,
api_type: GlType,
sample_count: i32,
@ -270,11 +270,11 @@ impl WebGLRenderbuffer {
Ok(())
}
pub fn attach_to_framebuffer(&self, fb: &WebGLFramebuffer) {
pub(crate) fn attach_to_framebuffer(&self, fb: &WebGLFramebuffer) {
self.attached_framebuffer.set(Some(fb));
}
pub fn detach_from_framebuffer(&self) {
pub(crate) fn detach_from_framebuffer(&self) {
self.attached_framebuffer.set(None);
}
}