Implement addCue and removeCue in TextTrack
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 26 Nov 2011 04:28:39 +0000 (04:28 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 26 Nov 2011 04:28:39 +0000 (04:28 +0000)
commit503fa4222bdbb3256e94e50853f8b999086c7be7
tree208407c545356228f0d1252c223edc74e93b1e65
parentcc3e4dc8b4e9b292ea41227c01bf10290663d733
Implement addCue and removeCue in TextTrack
https://bugs.webkit.org/show_bug.cgi?id=72554

Reviewed by Darin Adler.

Source/WebCore:

Test: media/track/track-add-remove-cue.html

* html/HTMLTrackElement.cpp:
(WebCore::HTMLTrackElement::ensureTrack): Go ahead and allocate a Track even if the feature
    is disabled, it just won't load anything.
(WebCore::HTMLTrackElement::scheduleLoad): Early return if the featue is disabled.
(WebCore::HTMLTrackElement::canLoadUrl): Ditto.

* html/LoadableTextTrack.cpp:
(WebCore::LoadableTextTrack::newCuesAvailable): Add new cues one at a time because
    cues->add(Vector<TextTrackCue*>&) is gone.

* html/TextTrack.cpp:
(WebCore::TextTrack::addCue): Implement.
(WebCore::TextTrack::removeCue): Ditto.
* html/TextTrack.h:

(WebCore::TextTrackCue::TextTrackCue): Initialize every member variable.
(WebCore::TextTrackCue::track): m_track is now a RefPtr.
(WebCore::TextTrackCue::setTrack): Ditto.
* html/TextTrackCue.h:

* html/TextTrackCueList.cpp:
(WebCore::TextTrackCueList::add): Don't ignore out of order cues, the spec text is not
    a conformance requirement. Return bool to indicate success or failure.
(WebCore::TextTrackCueList::remove): Return bool to indicate success or failure.
* html/TextTrackCueList.h:

* loader/TextTrackLoader.cpp:
(WebCore::TextTrackLoader::notifyFinished): Don't change m_state once it is set to Failed.

LayoutTests:

* media/track/track-add-remove-cue-expected.txt: Added.
* media/track/track-add-remove-cue.html: Added.
* media/track/track-webvtt-tc012-out-of-order-expected.txt: Removed.
* media/track/track-webvtt-tc012-out-of-order.html: Removed.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@101185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
15 files changed:
LayoutTests/ChangeLog
LayoutTests/media/track/track-add-remove-cue-expected.txt [new file with mode: 0644]
LayoutTests/media/track/track-add-remove-cue.html [new file with mode: 0644]
LayoutTests/media/track/track-webvtt-tc012-out-of-order-expected.txt [deleted file]
LayoutTests/media/track/track-webvtt-tc012-out-of-order.html [deleted file]
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLTrackElement.cpp
Source/WebCore/html/LoadableTextTrack.cpp
Source/WebCore/html/TextTrack.cpp
Source/WebCore/html/TextTrack.h
Source/WebCore/html/TextTrackCue.cpp
Source/WebCore/html/TextTrackCue.h
Source/WebCore/html/TextTrackCueList.cpp
Source/WebCore/html/TextTrackCueList.h
Source/WebCore/loader/TextTrackLoader.cpp