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

@ -31,7 +31,7 @@ use crate::script_runtime::CanGc;
use crate::stylesheet_loader::{StylesheetLoader, StylesheetOwner};
#[dom_struct]
pub struct HTMLStyleElement {
pub(crate) struct HTMLStyleElement {
htmlelement: HTMLElement,
#[ignore_malloc_size_of = "Arc"]
#[no_trace]
@ -65,7 +65,7 @@ impl HTMLStyleElement {
}
#[allow(crown::unrooted_must_root)]
pub fn new(
pub(crate) fn new(
local_name: LocalName,
prefix: Option<Prefix>,
document: &Document,
@ -83,7 +83,7 @@ impl HTMLStyleElement {
)
}
pub fn parse_own_css(&self) {
pub(crate) fn parse_own_css(&self) {
let node = self.upcast::<Node>();
let element = self.upcast::<Element>();
assert!(node.is_connected());
@ -144,7 +144,7 @@ impl HTMLStyleElement {
// FIXME(emilio): This is duplicated with HTMLLinkElement::set_stylesheet.
#[allow(crown::unrooted_must_root)]
pub fn set_stylesheet(&self, s: Arc<Stylesheet>) {
pub(crate) fn set_stylesheet(&self, s: Arc<Stylesheet>) {
let stylesheets_owner = self.stylesheet_list_owner();
if let Some(ref s) = *self.stylesheet.borrow() {
stylesheets_owner.remove_stylesheet(self.upcast(), s)
@ -154,11 +154,11 @@ impl HTMLStyleElement {
stylesheets_owner.add_stylesheet(self.upcast(), s);
}
pub fn get_stylesheet(&self) -> Option<Arc<Stylesheet>> {
pub(crate) fn get_stylesheet(&self) -> Option<Arc<Stylesheet>> {
self.stylesheet.borrow().clone()
}
pub fn get_cssom_stylesheet(&self) -> Option<DomRoot<CSSStyleSheet>> {
pub(crate) fn get_cssom_stylesheet(&self) -> Option<DomRoot<CSSStyleSheet>> {
self.get_stylesheet().map(|sheet| {
self.cssom_stylesheet.or_init(|| {
CSSStyleSheet::new(