Chromium Code Reviews| Index: Source/core/html/track/TextTrackList.cpp |
| diff --git a/Source/core/html/track/TextTrackList.cpp b/Source/core/html/track/TextTrackList.cpp |
| index cc3cbaa69c3ba5f4bb6a1c847fda6b9b95a73448..cea563750d78d429f6c4346c3f3eb358a524f225 100644 |
| --- a/Source/core/html/track/TextTrackList.cpp |
| +++ b/Source/core/html/track/TextTrackList.cpp |
| @@ -210,6 +210,8 @@ void TextTrackList::remove(TextTrack* track) |
| if (inbandTrack) |
| inbandTrack->trackRemoved(); |
| + |
| + scheduleRemoveTrackEvent(track); |
| } |
| bool TextTrackList::contains(TextTrack* track) const |
| @@ -259,6 +261,48 @@ void TextTrackList::scheduleAddTrackEvent(PassRefPtr<TextTrack> track) |
| m_pendingEventTimer.startOneShot(0); |
| } |
| +void TextTrackList::scheduleChangeEvent() |
| +{ |
| + // 4.8.10.12.1 Text track model |
| + // Whenever a text track that is in a media element's list of text tracks |
| + // has its text track mode change value, the user agent must run the |
| + // following steps for the media element: |
| + // ... |
| + // Fire a simple event named change at the media element's textTracks |
| + // attribute's TextTrackList object. |
| + |
| + EventInit initializer; |
| + initializer.bubbles = false; |
| + initializer.cancelable = false; |
| + |
| + m_pendingEvents.append(Event::create(EventTypeNames::change, initializer)); |
| + if (!m_pendingEventTimer.isActive()) |
| + m_pendingEventTimer.startOneShot(0); |
| +} |
| + |
| +void TextTrackList::scheduleRemoveTrackEvent(PassRefPtr<TextTrack> track) |
| +{ |
| + // 4.8.10.12.3 Sourcing out-of-band text tracks |
| + // When a track element's parent element changes and the old parent was a |
| + // media element, then the user agent must remove the track element's |
| + // corresponding text track from the media element's list of text tracks, |
| + // and then queue a task to fire a trusted event with the name removetrack, |
| + // that does not bubble and is not cancelable, and that uses the TrackEvent |
| + // interface, with the track attribute initialized to the text track's |
| + // TextTrack object, at the media element's textTracks attribute's |
| + // TextTrackList object. |
| + |
| + RefPtr<TrackBase> trackRef = track; |
|
acolwell GONE FROM CHROMIUM
2013/11/22 23:47:58
nit: Please move this to a scheduleTrackEvent(cons
|
| + TrackEventInit initializer; |
| + initializer.track = trackRef; |
| + initializer.bubbles = false; |
| + initializer.cancelable = false; |
| + |
| + m_pendingEvents.append(TrackEvent::create(EventTypeNames::removetrack, initializer)); |
|
acolwell GONE FROM CHROMIUM
2013/11/22 23:47:58
m_pendingEvents & m_pendingEventTimer should reall
|
| + if (!m_pendingEventTimer.isActive()) |
| + m_pendingEventTimer.startOneShot(0); |
| +} |
| + |
| void TextTrackList::asyncEventTimerFired(Timer<TextTrackList>*) |
| { |
| Vector<RefPtr<Event> > pendingEvents; |