Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(549)

Unified Diff: Source/core/html/track/TextTrackList.cpp

Issue 83073006: Add "change" and "removetrack" events to TextTrackList. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@add-track-id-again
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/track/TextTrackList.h ('k') | Source/core/html/track/TextTrackList.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « Source/core/html/track/TextTrackList.h ('k') | Source/core/html/track/TextTrackList.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698