mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
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:
parent
f220d6d3a5
commit
c94d909a86
585 changed files with 5411 additions and 5013 deletions
|
@ -26,7 +26,7 @@ use crate::script_runtime::CanGc;
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#validity-states
|
||||
#[derive(Clone, Copy, JSTraceable, MallocSizeOf)]
|
||||
pub struct ValidationFlags(u32);
|
||||
pub(crate) struct ValidationFlags(u32);
|
||||
|
||||
bitflags! {
|
||||
impl ValidationFlags: u32 {
|
||||
|
@ -74,7 +74,7 @@ impl fmt::Display for ValidationFlags {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#validitystate
|
||||
#[dom_struct]
|
||||
pub struct ValidityState {
|
||||
pub(crate) struct ValidityState {
|
||||
reflector_: Reflector,
|
||||
element: Dom<Element>,
|
||||
custom_error_message: DomRefCell<DOMString>,
|
||||
|
@ -91,7 +91,7 @@ impl ValidityState {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(window: &Window, element: &Element) -> DomRoot<ValidityState> {
|
||||
pub(crate) fn new(window: &Window, element: &Element) -> DomRoot<ValidityState> {
|
||||
reflect_dom_object(
|
||||
Box::new(ValidityState::new_inherited(element)),
|
||||
window,
|
||||
|
@ -100,12 +100,12 @@ impl ValidityState {
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#custom-validity-error-message
|
||||
pub fn custom_error_message(&self) -> Ref<DOMString> {
|
||||
pub(crate) fn custom_error_message(&self) -> Ref<DOMString> {
|
||||
self.custom_error_message.borrow()
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#custom-validity-error-message
|
||||
pub fn set_custom_error_message(&self, error: DOMString) {
|
||||
pub(crate) fn set_custom_error_message(&self, error: DOMString) {
|
||||
*self.custom_error_message.borrow_mut() = error;
|
||||
self.perform_validation_and_update(ValidationFlags::CUSTOM_ERROR);
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ impl ValidityState {
|
|||
/// if [ValidationFlags::CUSTOM_ERROR] is in `update_flags` and a custom
|
||||
/// error has been set on this [ValidityState], the state will be updated
|
||||
/// to reflect the existance of a custom error.
|
||||
pub fn perform_validation_and_update(&self, update_flags: ValidationFlags) {
|
||||
pub(crate) fn perform_validation_and_update(&self, update_flags: ValidationFlags) {
|
||||
let mut invalid_flags = self.invalid_flags.get();
|
||||
invalid_flags.remove(update_flags);
|
||||
|
||||
|
@ -135,15 +135,15 @@ impl ValidityState {
|
|||
self.update_pseudo_classes();
|
||||
}
|
||||
|
||||
pub fn update_invalid_flags(&self, update_flags: ValidationFlags) {
|
||||
pub(crate) fn update_invalid_flags(&self, update_flags: ValidationFlags) {
|
||||
self.invalid_flags.set(update_flags);
|
||||
}
|
||||
|
||||
pub fn invalid_flags(&self) -> ValidationFlags {
|
||||
pub(crate) fn invalid_flags(&self) -> ValidationFlags {
|
||||
self.invalid_flags.get()
|
||||
}
|
||||
|
||||
pub fn update_pseudo_classes(&self) {
|
||||
pub(crate) fn update_pseudo_classes(&self) {
|
||||
if self.element.is_instance_validatable() {
|
||||
let is_valid = self.invalid_flags.get().is_empty();
|
||||
self.element.set_state(ElementState::VALID, is_valid);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue