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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 | 407 |
408 return m_trackIndex; | 408 return m_trackIndex; |
409 } | 409 } |
410 | 410 |
411 void TextTrack::invalidateTrackIndex() | 411 void TextTrack::invalidateTrackIndex() |
412 { | 412 { |
413 m_trackIndex = invalidTrackIndex; | 413 m_trackIndex = invalidTrackIndex; |
414 m_renderedTrackIndex = invalidTrackIndex; | 414 m_renderedTrackIndex = invalidTrackIndex; |
415 } | 415 } |
416 | 416 |
417 bool TextTrack::isRendered() | 417 bool TextTrack::isRendered() const |
418 { | 418 { |
419 if (kind() != captionsKeyword() && kind() != subtitlesKeyword()) | 419 if (kind() != captionsKeyword() && kind() != subtitlesKeyword()) |
420 return false; | 420 return false; |
421 | 421 |
422 if (m_mode != showingKeyword()) | 422 if (m_mode != showingKeyword()) |
423 return false; | 423 return false; |
424 | 424 |
425 return true; | 425 return true; |
426 } | 426 } |
427 | 427 |
| 428 bool TextTrack::canBeRendered() const |
| 429 { |
| 430 // A track can be displayed when it's of kind captions or subtitles and hasn
't failed to load. |
| 431 if (kind() != captionsKeyword() && kind() != subtitlesKeyword()) |
| 432 return false; |
| 433 |
| 434 if (getReadinessState() == FailedToLoad) |
| 435 return false; |
| 436 |
| 437 return true; |
| 438 } |
| 439 |
428 TextTrackCueList* TextTrack::ensureTextTrackCueList() | 440 TextTrackCueList* TextTrack::ensureTextTrackCueList() |
429 { | 441 { |
430 if (!m_cues) | 442 if (!m_cues) |
431 m_cues = TextTrackCueList::create(); | 443 m_cues = TextTrackCueList::create(); |
432 | 444 |
433 return m_cues.get(); | 445 return m_cues.get(); |
434 } | 446 } |
435 | 447 |
436 int TextTrack::trackIndexRelativeToRenderedTracks() | 448 int TextTrack::trackIndexRelativeToRenderedTracks() |
437 { | 449 { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 { | 485 { |
474 visitor->trace(m_cues); | 486 visitor->trace(m_cues); |
475 visitor->trace(m_activeCues); | 487 visitor->trace(m_activeCues); |
476 visitor->trace(m_regions); | 488 visitor->trace(m_regions); |
477 visitor->trace(m_trackList); | 489 visitor->trace(m_trackList); |
478 TrackBase::trace(visitor); | 490 TrackBase::trace(visitor); |
479 EventTargetWithInlineData::trace(visitor); | 491 EventTargetWithInlineData::trace(visitor); |
480 } | 492 } |
481 | 493 |
482 } // namespace blink | 494 } // namespace blink |
OLD | NEW |