mirror of
https://github.com/servo/servo.git
synced 2025-08-16 02:45:36 +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
|
@ -18,14 +18,14 @@ use crate::dom::window::Window;
|
|||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct VideoTrackList {
|
||||
pub(crate) struct VideoTrackList {
|
||||
eventtarget: EventTarget,
|
||||
tracks: DomRefCell<Vec<Dom<VideoTrack>>>,
|
||||
media_element: Option<Dom<HTMLMediaElement>>,
|
||||
}
|
||||
|
||||
impl VideoTrackList {
|
||||
pub fn new_inherited(
|
||||
pub(crate) fn new_inherited(
|
||||
tracks: &[&VideoTrack],
|
||||
media_element: Option<&HTMLMediaElement>,
|
||||
) -> VideoTrackList {
|
||||
|
@ -36,7 +36,7 @@ impl VideoTrackList {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(
|
||||
pub(crate) fn new(
|
||||
window: &Window,
|
||||
tracks: &[&VideoTrack],
|
||||
media_element: Option<&HTMLMediaElement>,
|
||||
|
@ -48,29 +48,29 @@ impl VideoTrackList {
|
|||
)
|
||||
}
|
||||
|
||||
pub fn len(&self) -> usize {
|
||||
pub(crate) fn len(&self) -> usize {
|
||||
self.tracks.borrow().len()
|
||||
}
|
||||
|
||||
pub fn find(&self, track: &VideoTrack) -> Option<usize> {
|
||||
pub(crate) fn find(&self, track: &VideoTrack) -> Option<usize> {
|
||||
self.tracks.borrow().iter().position(|t| &**t == track)
|
||||
}
|
||||
|
||||
pub fn item(&self, idx: usize) -> Option<DomRoot<VideoTrack>> {
|
||||
pub(crate) fn item(&self, idx: usize) -> Option<DomRoot<VideoTrack>> {
|
||||
self.tracks
|
||||
.borrow()
|
||||
.get(idx)
|
||||
.map(|track| DomRoot::from_ref(&**track))
|
||||
}
|
||||
|
||||
pub fn selected_index(&self) -> Option<usize> {
|
||||
pub(crate) fn selected_index(&self) -> Option<usize> {
|
||||
self.tracks
|
||||
.borrow()
|
||||
.iter()
|
||||
.position(|track| track.selected())
|
||||
}
|
||||
|
||||
pub fn set_selected(&self, idx: usize, value: bool) {
|
||||
pub(crate) fn set_selected(&self, idx: usize, value: bool) {
|
||||
let track = match self.item(idx) {
|
||||
Some(t) => t,
|
||||
None => return,
|
||||
|
@ -100,7 +100,7 @@ impl VideoTrackList {
|
|||
}));
|
||||
}
|
||||
|
||||
pub fn add(&self, track: &VideoTrack) {
|
||||
pub(crate) fn add(&self, track: &VideoTrack) {
|
||||
self.tracks.borrow_mut().push(Dom::from_ref(track));
|
||||
if track.selected() {
|
||||
if let Some(idx) = self.selected_index() {
|
||||
|
@ -110,7 +110,7 @@ impl VideoTrackList {
|
|||
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