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

@ -88,7 +88,7 @@ const PASSWORD_REPLACEMENT_CHAR: char = '●';
#[derive(Clone, Copy, Default, JSTraceable, PartialEq)]
#[allow(dead_code)]
#[derive(MallocSizeOf)]
pub enum InputType {
pub(crate) enum InputType {
Button,
Checkbox,
Color,
@ -174,7 +174,7 @@ impl InputType {
}
}
pub fn as_ime_type(&self) -> Option<InputMethodType> {
pub(crate) fn as_ime_type(&self) -> Option<InputMethodType> {
match *self {
InputType::Color => Some(InputMethodType::Color),
InputType::Date => Some(InputMethodType::Date),
@ -239,7 +239,7 @@ enum StepDirection {
}
#[dom_struct]
pub struct HTMLInputElement {
pub(crate) struct HTMLInputElement {
htmlelement: HTMLElement,
input_type: Cell<InputType>,
checked_changed: Cell<bool>,
@ -264,7 +264,7 @@ pub struct HTMLInputElement {
}
#[derive(JSTraceable)]
pub struct InputActivationState {
pub(crate) struct InputActivationState {
indeterminate: bool,
checked: bool,
checked_radio: Option<DomRoot<HTMLInputElement>>,
@ -320,7 +320,7 @@ impl HTMLInputElement {
}
#[allow(crown::unrooted_must_root)]
pub fn new(
pub(crate) fn new(
local_name: LocalName,
prefix: Option<Prefix>,
document: &Document,
@ -337,7 +337,7 @@ impl HTMLInputElement {
)
}
pub fn auto_directionality(&self) -> Option<String> {
pub(crate) fn auto_directionality(&self) -> Option<String> {
match self.input_type() {
InputType::Text | InputType::Search | InputType::Url | InputType::Email => {
let value: String = self.Value().to_string();
@ -347,7 +347,7 @@ impl HTMLInputElement {
}
}
pub fn directionality_from_value(value: &str) -> String {
pub(crate) fn directionality_from_value(value: &str) -> String {
if HTMLInputElement::is_first_strong_character_rtl(value) {
"rtl".to_owned()
} else {
@ -399,21 +399,21 @@ impl HTMLInputElement {
}
#[inline]
pub fn input_type(&self) -> InputType {
pub(crate) fn input_type(&self) -> InputType {
self.input_type.get()
}
#[inline]
pub fn is_submit_button(&self) -> bool {
pub(crate) fn is_submit_button(&self) -> bool {
let input_type = self.input_type.get();
input_type == InputType::Submit || input_type == InputType::Image
}
pub fn disable_sanitization(&self) {
pub(crate) fn disable_sanitization(&self) {
self.sanitization_flag.set(false);
}
pub fn enable_sanitization(&self) {
pub(crate) fn enable_sanitization(&self) {
self.sanitization_flag.set(true);
let mut textinput = self.textinput.borrow_mut();
let mut value = textinput.single_line_content().clone();
@ -969,7 +969,7 @@ impl HTMLInputElement {
}
}
pub trait LayoutHTMLInputElementHelpers<'dom> {
pub(crate) trait LayoutHTMLInputElementHelpers<'dom> {
fn value_for_layout(self) -> Cow<'dom, str>;
fn size_for_layout(self) -> u32;
fn selection_for_layout(self) -> Option<Range<usize>>;
@ -1685,7 +1685,7 @@ impl HTMLInputElement {
/// <https://html.spec.whatwg.org/multipage/#constructing-the-form-data-set>
/// Steps range from 5.1 to 5.10 (specific to HTMLInputElement)
pub fn form_datums(
pub(crate) fn form_datums(
&self,
submitter: Option<FormSubmitterElement>,
encoding: Option<&'static Encoding>,
@ -1812,7 +1812,7 @@ impl HTMLInputElement {
}
// https://html.spec.whatwg.org/multipage/#the-input-element:concept-form-reset-control
pub fn reset(&self) {
pub(crate) fn reset(&self) {
match self.input_type() {
InputType::Radio | InputType::Checkbox => {
self.update_checked_state(self.DefaultChecked(), false);