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

@ -15,7 +15,7 @@ use crate::dom::webglrenderingcontext::{Operation, WebGLRenderingContext};
use crate::script_runtime::CanGc;
#[dom_struct]
pub struct WebGLTransformFeedback {
pub(crate) struct WebGLTransformFeedback {
webgl_object: WebGLObject,
id: u32,
marked_for_deletion: Cell<bool>,
@ -36,7 +36,7 @@ impl WebGLTransformFeedback {
}
}
pub fn new(context: &WebGLRenderingContext) -> DomRoot<Self> {
pub(crate) fn new(context: &WebGLRenderingContext) -> DomRoot<Self> {
let (sender, receiver) = webgl_channel().unwrap();
context.send_command(WebGLCommand::CreateTransformFeedback(sender));
let id = receiver.recv().unwrap();
@ -50,19 +50,19 @@ impl WebGLTransformFeedback {
}
impl WebGLTransformFeedback {
pub fn bind(&self, context: &WebGLRenderingContext, target: u32) {
pub(crate) fn bind(&self, context: &WebGLRenderingContext, target: u32) {
context.send_command(WebGLCommand::BindTransformFeedback(target, self.id()));
self.has_been_bound.set(true);
}
pub fn begin(&self, context: &WebGLRenderingContext, primitive_mode: u32) {
pub(crate) fn begin(&self, context: &WebGLRenderingContext, primitive_mode: u32) {
if self.has_been_bound.get() && !self.is_active() {
context.send_command(WebGLCommand::BeginTransformFeedback(primitive_mode));
self.set_active(true);
}
}
pub fn end(&self, context: &WebGLRenderingContext) {
pub(crate) fn end(&self, context: &WebGLRenderingContext) {
if self.has_been_bound.get() && self.is_active() {
if self.is_paused() {
context.send_command(WebGLCommand::ResumeTransformFeedback());
@ -72,37 +72,37 @@ impl WebGLTransformFeedback {
}
}
pub fn resume(&self, context: &WebGLRenderingContext) {
pub(crate) fn resume(&self, context: &WebGLRenderingContext) {
if self.is_active() && self.is_paused() {
context.send_command(WebGLCommand::ResumeTransformFeedback());
self.set_pause(false);
}
}
pub fn pause(&self, context: &WebGLRenderingContext) {
pub(crate) fn pause(&self, context: &WebGLRenderingContext) {
if self.is_active() && !self.is_paused() {
context.send_command(WebGLCommand::PauseTransformFeedback());
self.set_pause(true);
}
}
pub fn id(&self) -> u32 {
pub(crate) fn id(&self) -> u32 {
self.id
}
pub fn is_valid(&self) -> bool {
pub(crate) fn is_valid(&self) -> bool {
!self.marked_for_deletion.get()
}
pub fn is_active(&self) -> bool {
pub(crate) fn is_active(&self) -> bool {
self.is_active.get()
}
pub fn is_paused(&self) -> bool {
pub(crate) fn is_paused(&self) -> bool {
self.is_paused.get()
}
pub fn delete(&self, operation_fallibility: Operation) {
pub(crate) fn delete(&self, operation_fallibility: Operation) {
if self.is_valid() && self.id() != 0 {
self.marked_for_deletion.set(true);
let context = self.upcast::<WebGLObject>().context();
@ -114,13 +114,13 @@ impl WebGLTransformFeedback {
}
}
pub fn set_active(&self, value: bool) {
pub(crate) fn set_active(&self, value: bool) {
if self.is_valid() && self.has_been_bound.get() {
self.is_active.set(value);
}
}
pub fn set_pause(&self, value: bool) {
pub(crate) fn set_pause(&self, value: bool) {
if self.is_valid() && self.is_active() {
self.is_active.set(value);
}