| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 if (textTrack->trackType() == TextTrack::InBand) | 55 if (textTrack->trackType() == TextTrack::InBand) |
| 56 return m_elementTracks.size() + m_addTrackTracks.size() + | 56 return m_elementTracks.size() + m_addTrackTracks.size() + |
| 57 m_inbandTracks.find(textTrack); | 57 m_inbandTracks.find(textTrack); |
| 58 | 58 |
| 59 NOTREACHED(); | 59 NOTREACHED(); |
| 60 | 60 |
| 61 return -1; | 61 return -1; |
| 62 } | 62 } |
| 63 | 63 |
| 64 int TextTrackList::getTrackIndexRelativeToRenderedTracks(TextTrack* textTrack) { | 64 int TextTrackList::getTrackIndexRelativeToRenderedTracks(TextTrack* textTrack) { |
| 65 // Calculate the "Let n be the number of text tracks whose text track mode is
showing and that are in the media element's list of text tracks before track." | 65 // Calculate the "Let n be the number of text tracks whose text track mode is |
| 66 // showing and that are in the media element's list of text tracks before |
| 67 // track." |
| 66 int trackIndex = 0; | 68 int trackIndex = 0; |
| 67 | 69 |
| 68 for (size_t i = 0; i < m_elementTracks.size(); ++i) { | 70 for (size_t i = 0; i < m_elementTracks.size(); ++i) { |
| 69 if (!m_elementTracks[i]->isRendered()) | 71 if (!m_elementTracks[i]->isRendered()) |
| 70 continue; | 72 continue; |
| 71 | 73 |
| 72 if (m_elementTracks[i] == textTrack) | 74 if (m_elementTracks[i] == textTrack) |
| 73 return trackIndex; | 75 return trackIndex; |
| 74 ++trackIndex; | 76 ++trackIndex; |
| 75 } | 77 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 93 } | 95 } |
| 94 | 96 |
| 95 NOTREACHED(); | 97 NOTREACHED(); |
| 96 | 98 |
| 97 return -1; | 99 return -1; |
| 98 } | 100 } |
| 99 | 101 |
| 100 TextTrack* TextTrackList::anonymousIndexedGetter(unsigned index) { | 102 TextTrack* TextTrackList::anonymousIndexedGetter(unsigned index) { |
| 101 // 4.8.10.12.1 Text track model | 103 // 4.8.10.12.1 Text track model |
| 102 // The text tracks are sorted as follows: | 104 // The text tracks are sorted as follows: |
| 103 // 1. The text tracks corresponding to track element children of the media ele
ment, in tree order. | 105 // 1. The text tracks corresponding to track element children of the media |
| 104 // 2. Any text tracks added using the addTextTrack() method, in the order they
were added, oldest first. | 106 // element, in tree order. |
| 105 // 3. Any media-resource-specific text tracks (text tracks corresponding to da
ta in the media | 107 // 2. Any text tracks added using the addTextTrack() method, in the order they |
| 106 // resource), in the order defined by the media resource's format specificatio
n. | 108 // were added, oldest first. |
| 109 // 3. Any media-resource-specific text tracks (text tracks corresponding to |
| 110 // data in the media resource), in the order defined by the media resource's |
| 111 // format specification. |
| 107 | 112 |
| 108 if (index < m_elementTracks.size()) | 113 if (index < m_elementTracks.size()) |
| 109 return m_elementTracks[index]; | 114 return m_elementTracks[index]; |
| 110 | 115 |
| 111 index -= m_elementTracks.size(); | 116 index -= m_elementTracks.size(); |
| 112 if (index < m_addTrackTracks.size()) | 117 if (index < m_addTrackTracks.size()) |
| 113 return m_addTrackTracks[index]; | 118 return m_addTrackTracks[index]; |
| 114 | 119 |
| 115 index -= m_addTrackTracks.size(); | 120 index -= m_addTrackTracks.size(); |
| 116 if (index < m_inbandTracks.size()) | 121 if (index < m_inbandTracks.size()) |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 } | 245 } |
| 241 | 246 |
| 242 void TextTrackList::scheduleTrackEvent(const AtomicString& eventName, | 247 void TextTrackList::scheduleTrackEvent(const AtomicString& eventName, |
| 243 TextTrack* track) { | 248 TextTrack* track) { |
| 244 m_asyncEventQueue->enqueueEvent(TrackEvent::create(eventName, track)); | 249 m_asyncEventQueue->enqueueEvent(TrackEvent::create(eventName, track)); |
| 245 } | 250 } |
| 246 | 251 |
| 247 void TextTrackList::scheduleAddTrackEvent(TextTrack* track) { | 252 void TextTrackList::scheduleAddTrackEvent(TextTrack* track) { |
| 248 // 4.8.10.12.3 Sourcing out-of-band text tracks | 253 // 4.8.10.12.3 Sourcing out-of-band text tracks |
| 249 // 4.8.10.12.4 Text track API | 254 // 4.8.10.12.4 Text track API |
| 250 // ... then queue a task to fire an event with the name addtrack, that does no
t | 255 // ... then queue a task to fire an event with the name addtrack, that does |
| 251 // bubble and is not cancelable, and that uses the TrackEvent interface, with | 256 // not bubble and is not cancelable, and that uses the TrackEvent interface, |
| 252 // the track attribute initialized to the text track's TextTrack object, at | 257 // with the track attribute initialized to the text track's TextTrack object, |
| 253 // the media element's textTracks attribute's TextTrackList object. | 258 // at the media element's textTracks attribute's TextTrackList object. |
| 254 scheduleTrackEvent(EventTypeNames::addtrack, track); | 259 scheduleTrackEvent(EventTypeNames::addtrack, track); |
| 255 } | 260 } |
| 256 | 261 |
| 257 void TextTrackList::scheduleChangeEvent() { | 262 void TextTrackList::scheduleChangeEvent() { |
| 258 // 4.8.10.12.1 Text track model | 263 // 4.8.10.12.1 Text track model |
| 259 // Whenever a text track that is in a media element's list of text tracks | 264 // Whenever a text track that is in a media element's list of text tracks |
| 260 // has its text track mode change value, the user agent must run the | 265 // has its text track mode change value, the user agent must run the |
| 261 // following steps for the media element: | 266 // following steps for the media element: |
| 262 // ... | 267 // ... |
| 263 // Fire a simple event named change at the media element's textTracks | 268 // Fire a simple event named change at the media element's textTracks |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 } | 306 } |
| 302 | 307 |
| 303 DEFINE_TRACE_WRAPPERS(TextTrackList) { | 308 DEFINE_TRACE_WRAPPERS(TextTrackList) { |
| 304 for (auto track : m_addTrackTracks) | 309 for (auto track : m_addTrackTracks) |
| 305 visitor->traceWrappers(track); | 310 visitor->traceWrappers(track); |
| 306 for (auto track : m_elementTracks) | 311 for (auto track : m_elementTracks) |
| 307 visitor->traceWrappers(track); | 312 visitor->traceWrappers(track); |
| 308 for (auto track : m_inbandTracks) | 313 for (auto track : m_inbandTracks) |
| 309 visitor->traceWrappers(track); | 314 visitor->traceWrappers(track); |
| 310 } | 315 } |
| OLD | NEW |