| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 } else if (track->trackType() == TextTrack::AddTrack) { | 144 } else if (track->trackType() == TextTrack::AddTrack) { |
| 145 tracks = &m_addTrackTracks; | 145 tracks = &m_addTrackTracks; |
| 146 for (size_t i = 0; i < m_inbandTracks.size(); ++i) | 146 for (size_t i = 0; i < m_inbandTracks.size(); ++i) |
| 147 m_inbandTracks[i]->invalidateTrackIndex(); | 147 m_inbandTracks[i]->invalidateTrackIndex(); |
| 148 } else if (track->trackType() == TextTrack::InBand) | 148 } else if (track->trackType() == TextTrack::InBand) |
| 149 tracks = &m_inbandTracks; | 149 tracks = &m_inbandTracks; |
| 150 else | 150 else |
| 151 ASSERT_NOT_REACHED(); | 151 ASSERT_NOT_REACHED(); |
| 152 | 152 |
| 153 size_t index = tracks->find(track); | 153 size_t index = tracks->find(track); |
| 154 if (index == notFound) | 154 if (index == kNotFound) |
| 155 return; | 155 return; |
| 156 | 156 |
| 157 for (size_t i = index; i < tracks->size(); ++i) | 157 for (size_t i = index; i < tracks->size(); ++i) |
| 158 tracks->at(index)->invalidateTrackIndex(); | 158 tracks->at(index)->invalidateTrackIndex(); |
| 159 } | 159 } |
| 160 | 160 |
| 161 void TextTrackList::append(PassRefPtr<TextTrack> prpTrack) | 161 void TextTrackList::append(PassRefPtr<TextTrack> prpTrack) |
| 162 { | 162 { |
| 163 RefPtr<TextTrack> track = prpTrack; | 163 RefPtr<TextTrack> track = prpTrack; |
| 164 | 164 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 193 } else if (track->trackType() == TextTrack::AddTrack) { | 193 } else if (track->trackType() == TextTrack::AddTrack) { |
| 194 tracks = &m_addTrackTracks; | 194 tracks = &m_addTrackTracks; |
| 195 } else if (track->trackType() == TextTrack::InBand) { | 195 } else if (track->trackType() == TextTrack::InBand) { |
| 196 tracks = &m_inbandTracks; | 196 tracks = &m_inbandTracks; |
| 197 inbandTrack = static_cast<InbandTextTrack*>(track); | 197 inbandTrack = static_cast<InbandTextTrack*>(track); |
| 198 } else { | 198 } else { |
| 199 ASSERT_NOT_REACHED(); | 199 ASSERT_NOT_REACHED(); |
| 200 } | 200 } |
| 201 | 201 |
| 202 size_t index = tracks->find(track); | 202 size_t index = tracks->find(track); |
| 203 if (index == notFound) | 203 if (index == kNotFound) |
| 204 return; | 204 return; |
| 205 | 205 |
| 206 invalidateTrackIndexesAfterTrack(track); | 206 invalidateTrackIndexesAfterTrack(track); |
| 207 | 207 |
| 208 ASSERT(track->mediaElement() == m_owner); | 208 ASSERT(track->mediaElement() == m_owner); |
| 209 track->setMediaElement(0); | 209 track->setMediaElement(0); |
| 210 | 210 |
| 211 tracks->remove(index); | 211 tracks->remove(index); |
| 212 | 212 |
| 213 if (inbandTrack) | 213 if (inbandTrack) |
| 214 inbandTrack->trackRemoved(); | 214 inbandTrack->trackRemoved(); |
| 215 } | 215 } |
| 216 | 216 |
| 217 bool TextTrackList::contains(TextTrack* track) const | 217 bool TextTrackList::contains(TextTrack* track) const |
| 218 { | 218 { |
| 219 const Vector<RefPtr<TextTrack> >* tracks = 0; | 219 const Vector<RefPtr<TextTrack> >* tracks = 0; |
| 220 | 220 |
| 221 if (track->trackType() == TextTrack::TrackElement) | 221 if (track->trackType() == TextTrack::TrackElement) |
| 222 tracks = &m_elementTracks; | 222 tracks = &m_elementTracks; |
| 223 else if (track->trackType() == TextTrack::AddTrack) | 223 else if (track->trackType() == TextTrack::AddTrack) |
| 224 tracks = &m_addTrackTracks; | 224 tracks = &m_addTrackTracks; |
| 225 else if (track->trackType() == TextTrack::InBand) | 225 else if (track->trackType() == TextTrack::InBand) |
| 226 tracks = &m_inbandTracks; | 226 tracks = &m_inbandTracks; |
| 227 else | 227 else |
| 228 ASSERT_NOT_REACHED(); | 228 ASSERT_NOT_REACHED(); |
| 229 | 229 |
| 230 return tracks->find(track) != notFound; | 230 return tracks->find(track) != kNotFound; |
| 231 } | 231 } |
| 232 | 232 |
| 233 const AtomicString& TextTrackList::interfaceName() const | 233 const AtomicString& TextTrackList::interfaceName() const |
| 234 { | 234 { |
| 235 return eventNames().interfaceForTextTrackList; | 235 return eventNames().interfaceForTextTrackList; |
| 236 } | 236 } |
| 237 | 237 |
| 238 void TextTrackList::scheduleAddTrackEvent(PassRefPtr<TextTrack> track) | 238 void TextTrackList::scheduleAddTrackEvent(PassRefPtr<TextTrack> track) |
| 239 { | 239 { |
| 240 // 4.8.10.12.3 Sourcing out-of-band text tracks | 240 // 4.8.10.12.3 Sourcing out-of-band text tracks |
| (...skipping 23 matching lines...) Expand all Loading... |
| 264 size_t count = pendingEvents.size(); | 264 size_t count = pendingEvents.size(); |
| 265 for (size_t index = 0; index < count; ++index) | 265 for (size_t index = 0; index < count; ++index) |
| 266 dispatchEvent(pendingEvents[index].release(), IGNORE_EXCEPTION); | 266 dispatchEvent(pendingEvents[index].release(), IGNORE_EXCEPTION); |
| 267 --m_dispatchingEvents; | 267 --m_dispatchingEvents; |
| 268 } | 268 } |
| 269 | 269 |
| 270 Node* TextTrackList::owner() const | 270 Node* TextTrackList::owner() const |
| 271 { | 271 { |
| 272 return m_owner; | 272 return m_owner; |
| 273 } | 273 } |
| OLD | NEW |