Unset the active flag when TextTrackCues go away
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Feb 2012 20:03:27 +0000 (20:03 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Feb 2012 20:03:27 +0000 (20:03 +0000)
commit2baaea4b5a12e2fffc0ec1afcdf19bc00d105c39
treee5eabeff05f10dee234fe024b8452c95cd0df050
parenta22419a7138b84d1b8d119bcbc207f312ef03efe
Unset the active flag when TextTrackCues go away
https://bugs.webkit.org/show_bug.cgi?id=72552

Reviewed by Maciej Stachowiak.

Source/WebCore:

Test: media/track/track-active-cues.html

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::loadTimerFired): Configure new text tracks before preparing to load
    so we know about all tracks when resource selection begins.
(WebCore::HTMLMediaElement::prepareForLoad): Call updateActiveTextTrackCues after setting
    to m_readyState is HAVE_NOTHING so all cues get deactivated. Don't build list of
    available text tracks because resource selection won't actually start until after the load timer fires.
(WebCore::HTMLMediaElement::loadInternal): Build list of non-disabled tracks.
(WebCore::HTMLMediaElement::updateActiveTextTrackCues):  Clear the active flag on all cues
    when m_readyState is HAVE_NOTHING or m_player is 0.
(WebCore::HTMLMediaElement::setReadyState): Don't update m_readyState when tracks which haven't
    loaded yet will prevent events from firing. Call updateActiveTextTrackCues to ensure that the
    first cue(s) are shown as soon as possible.
(WebCore::HTMLMediaElement::userCancelledLoad): Call updateActiveTextTrackCues when when m_readyState
    is HAVE_NOTHING so all cues get deactivated.

LayoutTests:

* media/track/track-active-cues-expected.txt: Added.
* media/track/track-active-cues.html: Added.
* track-cue-mutable-text.html: Update to not run test until track and video have
    both loaded.
* media/video-test.js:
(waitForEventsAndCall): New, call the specified function after the list of events
    has been seen.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@107831 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/media/track/track-active-cues-expected.txt [new file with mode: 0644]
LayoutTests/media/track/track-active-cues.html [new file with mode: 0644]
LayoutTests/media/track/track-cue-mutable-text.html
LayoutTests/media/video-test.js
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLMediaElement.cpp