mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00: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
|
@ -18,14 +18,14 @@ use crate::dom::window::Window;
|
|||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct AudioTrackList {
|
||||
pub(crate) struct AudioTrackList {
|
||||
eventtarget: EventTarget,
|
||||
tracks: DomRefCell<Vec<Dom<AudioTrack>>>,
|
||||
media_element: Option<Dom<HTMLMediaElement>>,
|
||||
}
|
||||
|
||||
impl AudioTrackList {
|
||||
pub fn new_inherited(
|
||||
pub(crate) fn new_inherited(
|
||||
tracks: &[&AudioTrack],
|
||||
media_element: Option<&HTMLMediaElement>,
|
||||
) -> AudioTrackList {
|
||||
|
@ -36,7 +36,7 @@ impl AudioTrackList {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(
|
||||
pub(crate) fn new(
|
||||
window: &Window,
|
||||
tracks: &[&AudioTrack],
|
||||
media_element: Option<&HTMLMediaElement>,
|
||||
|
@ -48,29 +48,29 @@ impl AudioTrackList {
|
|||
)
|
||||
}
|
||||
|
||||
pub fn len(&self) -> usize {
|
||||
pub(crate) fn len(&self) -> usize {
|
||||
self.tracks.borrow().len()
|
||||
}
|
||||
|
||||
pub fn find(&self, track: &AudioTrack) -> Option<usize> {
|
||||
pub(crate) fn find(&self, track: &AudioTrack) -> Option<usize> {
|
||||
self.tracks.borrow().iter().position(|t| &**t == track)
|
||||
}
|
||||
|
||||
pub fn item(&self, idx: usize) -> Option<DomRoot<AudioTrack>> {
|
||||
pub(crate) fn item(&self, idx: usize) -> Option<DomRoot<AudioTrack>> {
|
||||
self.tracks
|
||||
.borrow()
|
||||
.get(idx)
|
||||
.map(|track| DomRoot::from_ref(&**track))
|
||||
}
|
||||
|
||||
pub fn enabled_index(&self) -> Option<usize> {
|
||||
pub(crate) fn enabled_index(&self) -> Option<usize> {
|
||||
self.tracks
|
||||
.borrow()
|
||||
.iter()
|
||||
.position(|track| track.enabled())
|
||||
}
|
||||
|
||||
pub fn set_enabled(&self, idx: usize, value: bool) {
|
||||
pub(crate) fn set_enabled(&self, idx: usize, value: bool) {
|
||||
let track = match self.item(idx) {
|
||||
Some(t) => t,
|
||||
None => return,
|
||||
|
@ -96,12 +96,12 @@ impl AudioTrackList {
|
|||
}));
|
||||
}
|
||||
|
||||
pub fn add(&self, track: &AudioTrack) {
|
||||
pub(crate) fn add(&self, track: &AudioTrack) {
|
||||
self.tracks.borrow_mut().push(Dom::from_ref(track));
|
||||
track.add_track_list(self);
|
||||
}
|
||||
|
||||
pub fn clear(&self) {
|
||||
pub(crate) fn clear(&self) {
|
||||
self.tracks
|
||||
.borrow()
|
||||
.iter()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue