OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved. | 3 * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 | 225 |
226 for (auto& newCue : listOfNewCues) { | 226 for (auto& newCue : listOfNewCues) { |
227 newCue->setTrack(this); | 227 newCue->setTrack(this); |
228 cues->add(newCue.release()); | 228 cues->add(newCue.release()); |
229 } | 229 } |
230 | 230 |
231 if (cueTimeline() && mode() != disabledKeyword()) | 231 if (cueTimeline() && mode() != disabledKeyword()) |
232 cueTimeline()->addCues(this, cues); | 232 cueTimeline()->addCues(this, cues); |
233 } | 233 } |
234 | 234 |
235 TextTrackCueList* TextTrack::activeCues() const | 235 TextTrackCueList* TextTrack::activeCues() |
236 { | 236 { |
237 // 4.8.10.12.5 If the text track mode ... is not the text track disabled mod
e, | 237 // 4.8.10.12.5 If the text track mode ... is not the text track disabled mod
e, |
238 // then the activeCues attribute must return a live TextTrackCueList object
... | 238 // then the activeCues attribute must return a live TextTrackCueList object
... |
239 // ... whose active flag was set when the script started, in text track cue | 239 // ... whose active flag was set when the script started, in text track cue |
240 // order. Otherwise, it must return null. When an object is returned, the | 240 // order. Otherwise, it must return null. When an object is returned, the |
241 // same object must be returned each time. | 241 // same object must be returned each time. |
242 // http://www.whatwg.org/specs/web-apps/current-work/#dom-texttrack-activecu
es | 242 // http://www.whatwg.org/specs/web-apps/current-work/#dom-texttrack-activecu
es |
243 if (m_cues && m_mode != disabledKeyword()) | 243 if (!m_cues || m_mode == disabledKeyword()) |
244 return m_cues->activeCues(); | 244 return nullptr; |
245 return nullptr; | 245 |
| 246 if (!m_activeCues) |
| 247 m_activeCues = TextTrackCueList::create(); |
| 248 |
| 249 m_cues->collectActiveCues(*m_activeCues); |
| 250 return m_activeCues.get(); |
246 } | 251 } |
247 | 252 |
248 void TextTrack::addCue(PassRefPtrWillBeRawPtr<TextTrackCue> prpCue) | 253 void TextTrack::addCue(PassRefPtrWillBeRawPtr<TextTrackCue> prpCue) |
249 { | 254 { |
250 ASSERT(prpCue); | 255 ASSERT(prpCue); |
251 RefPtrWillBeRawPtr<TextTrackCue> cue = prpCue; | 256 RefPtrWillBeRawPtr<TextTrackCue> cue = prpCue; |
252 | 257 |
253 // TODO(93143): Add spec-compliant behavior for negative time values. | 258 // TODO(93143): Add spec-compliant behavior for negative time values. |
254 if (std::isnan(cue->startTime()) || std::isnan(cue->endTime()) || cue->start
Time() < 0 || cue->endTime() < 0) | 259 if (std::isnan(cue->startTime()) || std::isnan(cue->endTime()) || cue->start
Time() < 0 || cue->endTime() < 0) |
255 return; | 260 return; |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 } | 465 } |
461 | 466 |
462 Node* TextTrack::owner() const | 467 Node* TextTrack::owner() const |
463 { | 468 { |
464 return mediaElement(); | 469 return mediaElement(); |
465 } | 470 } |
466 | 471 |
467 DEFINE_TRACE(TextTrack) | 472 DEFINE_TRACE(TextTrack) |
468 { | 473 { |
469 visitor->trace(m_cues); | 474 visitor->trace(m_cues); |
| 475 visitor->trace(m_activeCues); |
470 visitor->trace(m_regions); | 476 visitor->trace(m_regions); |
471 visitor->trace(m_trackList); | 477 visitor->trace(m_trackList); |
472 TrackBase::trace(visitor); | 478 TrackBase::trace(visitor); |
473 EventTargetWithInlineData::trace(visitor); | 479 EventTargetWithInlineData::trace(visitor); |
474 } | 480 } |
475 | 481 |
476 } // namespace blink | 482 } // namespace blink |
OLD | NEW |