mirror of
https://github.com/servo/servo.git
synced 2025-09-30 00:29:14 +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
|
@ -14,20 +14,20 @@ use crate::dom::window::Window;
|
|||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct TextTrackCueList {
|
||||
pub(crate) struct TextTrackCueList {
|
||||
reflector_: Reflector,
|
||||
dom_cues: DomRefCell<Vec<Dom<TextTrackCue>>>,
|
||||
}
|
||||
|
||||
impl TextTrackCueList {
|
||||
pub fn new_inherited(cues: &[&TextTrackCue]) -> TextTrackCueList {
|
||||
pub(crate) fn new_inherited(cues: &[&TextTrackCue]) -> TextTrackCueList {
|
||||
TextTrackCueList {
|
||||
reflector_: Reflector::new(),
|
||||
dom_cues: DomRefCell::new(cues.iter().map(|g| Dom::from_ref(&**g)).collect()),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new(window: &Window, cues: &[&TextTrackCue]) -> DomRoot<TextTrackCueList> {
|
||||
pub(crate) fn new(window: &Window, cues: &[&TextTrackCue]) -> DomRoot<TextTrackCueList> {
|
||||
reflect_dom_object(
|
||||
Box::new(TextTrackCueList::new_inherited(cues)),
|
||||
window,
|
||||
|
@ -35,14 +35,14 @@ impl TextTrackCueList {
|
|||
)
|
||||
}
|
||||
|
||||
pub fn item(&self, idx: usize) -> Option<DomRoot<TextTrackCue>> {
|
||||
pub(crate) fn item(&self, idx: usize) -> Option<DomRoot<TextTrackCue>> {
|
||||
self.dom_cues
|
||||
.borrow()
|
||||
.get(idx)
|
||||
.map(|t| DomRoot::from_ref(&**t))
|
||||
}
|
||||
|
||||
pub fn find(&self, cue: &TextTrackCue) -> Option<usize> {
|
||||
pub(crate) fn find(&self, cue: &TextTrackCue) -> Option<usize> {
|
||||
self.dom_cues
|
||||
.borrow()
|
||||
.iter()
|
||||
|
@ -51,14 +51,14 @@ impl TextTrackCueList {
|
|||
.map(|(i, _)| i)
|
||||
}
|
||||
|
||||
pub fn add(&self, cue: &TextTrackCue) {
|
||||
pub(crate) fn add(&self, cue: &TextTrackCue) {
|
||||
// Only add a cue if it does not exist in the list
|
||||
if self.find(cue).is_none() {
|
||||
self.dom_cues.borrow_mut().push(Dom::from_ref(cue));
|
||||
}
|
||||
}
|
||||
|
||||
pub fn remove(&self, idx: usize) {
|
||||
pub(crate) fn remove(&self, idx: usize) {
|
||||
self.dom_cues.borrow_mut().remove(idx);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue