aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/audiotracklist.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2020-01-02 21:34:24 -0500
committerGitHub <noreply@github.com>2020-01-02 21:34:24 -0500
commitd47f0ad1f672c7f1543eb753fc87c6acdf9f16e8 (patch)
tree1f268254b8b9657faa2f4b1d9b899e45401d0478 /components/script/dom/audiotracklist.rs
parent097a91112e5e83775b589e74c8412f0c37a07f75 (diff)
parent9b59b9602cdf41a77b8cf111b680c034638a06c0 (diff)
downloadservo-d47f0ad1f672c7f1543eb753fc87c6acdf9f16e8.tar.gz
servo-d47f0ad1f672c7f1543eb753fc87c6acdf9f16e8.zip
Auto merge of #25364 - kunalmohan:22912-MediaTracks, r=jdm
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. r?@jdm <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #22912 (GitHub issue number if applicable) <!-- Either: --> - [X] There are tests for these changes <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Diffstat (limited to 'components/script/dom/audiotracklist.rs')
-rw-r--r--components/script/dom/audiotracklist.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/components/script/dom/audiotracklist.rs b/components/script/dom/audiotracklist.rs
index e26f23cb2a8..5191221b7d9 100644
--- a/components/script/dom/audiotracklist.rs
+++ b/components/script/dom/audiotracklist.rs
@@ -104,9 +104,14 @@ impl AudioTrackList {
pub fn add(&self, track: &AudioTrack) {
self.tracks.borrow_mut().push(Dom::from_ref(track));
+ track.add_track_list(self);
}
pub fn clear(&self) {
+ self.tracks
+ .borrow()
+ .iter()
+ .for_each(|t| t.remove_track_list());
self.tracks.borrow_mut().clear();
}
}