aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/texttracklist.rs
diff options
context:
space:
mode:
authorKunal Mohan <kunalmohan99@gmail.com>2019-12-22 21:00:10 +0530
committerKunal Mohan <kunalmohan99@gmail.com>2019-12-23 01:06:58 +0530
commit9b59b9602cdf41a77b8cf111b680c034638a06c0 (patch)
tree4fc75eed115f8cd9916e3452655fe0dfc47f1d9b /components/script/dom/texttracklist.rs
parent43a5f65940f85a30ba3f7fb9cbb96b194cde81b6 (diff)
downloadservo-9b59b9602cdf41a77b8cf111b680c034638a06c0.tar.gz
servo-9b59b9602cdf41a77b8cf111b680c034638a06c0.zip
Add `track_list` member to AudioTrack, VideoTrack, TextTrack structs
Add member to the track structs pointing at their associated tracklist and update it when the track is added or removed from a tracklist.
Diffstat (limited to 'components/script/dom/texttracklist.rs')
-rw-r--r--components/script/dom/texttracklist.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/components/script/dom/texttracklist.rs b/components/script/dom/texttracklist.rs
index f6f9037902e..0e978972d69 100644
--- a/components/script/dom/texttracklist.rs
+++ b/components/script/dom/texttracklist.rs
@@ -94,6 +94,7 @@ impl TextTrackList {
}),
&canceller,
);
+ track.add_track_list(self);
}
}
@@ -101,6 +102,9 @@ impl TextTrackList {
// removed from the TextTrackList.
#[allow(dead_code)]
pub fn remove(&self, idx: usize) {
+ if let Some(track) = self.dom_tracks.borrow().get(idx) {
+ track.remove_track_list();
+ }
self.dom_tracks.borrow_mut().remove(idx);
self.upcast::<EventTarget>()
.fire_event(atom!("removetrack"));