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

@ -19,27 +19,27 @@ use crate::script_runtime::CanGc;
#[crown::unrooted_must_root_lint::must_root]
#[derive(JSTraceable, MallocSizeOf)]
pub enum StyleSheetListOwner {
pub(crate) enum StyleSheetListOwner {
Document(Dom<Document>),
ShadowRoot(Dom<ShadowRoot>),
}
impl StyleSheetListOwner {
pub fn stylesheet_count(&self) -> usize {
pub(crate) fn stylesheet_count(&self) -> usize {
match *self {
StyleSheetListOwner::Document(ref doc) => doc.stylesheet_count(),
StyleSheetListOwner::ShadowRoot(ref shadow_root) => shadow_root.stylesheet_count(),
}
}
pub fn stylesheet_at(&self, index: usize) -> Option<DomRoot<CSSStyleSheet>> {
pub(crate) fn stylesheet_at(&self, index: usize) -> Option<DomRoot<CSSStyleSheet>> {
match *self {
StyleSheetListOwner::Document(ref doc) => doc.stylesheet_at(index),
StyleSheetListOwner::ShadowRoot(ref shadow_root) => shadow_root.stylesheet_at(index),
}
}
pub fn add_stylesheet(&self, owner: &Element, sheet: Arc<Stylesheet>) {
pub(crate) fn add_stylesheet(&self, owner: &Element, sheet: Arc<Stylesheet>) {
match *self {
StyleSheetListOwner::Document(ref doc) => doc.add_stylesheet(owner, sheet),
StyleSheetListOwner::ShadowRoot(ref shadow_root) => {
@ -48,7 +48,7 @@ impl StyleSheetListOwner {
}
}
pub fn remove_stylesheet(&self, owner: &Element, s: &Arc<Stylesheet>) {
pub(crate) fn remove_stylesheet(&self, owner: &Element, s: &Arc<Stylesheet>) {
match *self {
StyleSheetListOwner::Document(ref doc) => doc.remove_stylesheet(owner, s),
StyleSheetListOwner::ShadowRoot(ref shadow_root) => {
@ -57,7 +57,7 @@ impl StyleSheetListOwner {
}
}
pub fn invalidate_stylesheets(&self) {
pub(crate) fn invalidate_stylesheets(&self) {
match *self {
StyleSheetListOwner::Document(ref doc) => doc.invalidate_stylesheets(),
StyleSheetListOwner::ShadowRoot(ref shadow_root) => {
@ -68,7 +68,7 @@ impl StyleSheetListOwner {
}
#[dom_struct]
pub struct StyleSheetList {
pub(crate) struct StyleSheetList {
reflector_: Reflector,
document_or_shadow_root: StyleSheetListOwner,
}
@ -83,7 +83,7 @@ impl StyleSheetList {
}
#[allow(crown::unrooted_must_root)]
pub fn new(window: &Window, doc_or_sr: StyleSheetListOwner) -> DomRoot<StyleSheetList> {
pub(crate) fn new(window: &Window, doc_or_sr: StyleSheetListOwner) -> DomRoot<StyleSheetList> {
reflect_dom_object(
Box::new(StyleSheetList::new_inherited(doc_or_sr)),
window,