Negative timestamps for TextTrackCues should not be allowed.
authorannacc@chromium.org <annacc@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Aug 2012 20:08:53 +0000 (20:08 +0000)
committerannacc@chromium.org <annacc@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Aug 2012 20:08:53 +0000 (20:08 +0000)
commit48c271c7edcb636c7adbff5d3ec41c2903defd5a
tree1d47f883789f7e48af60cb744341b2375537b1f8
parentbd8fe4e020cd038afb8fa9cad6420208d1b2abcd
Negative timestamps for TextTrackCues should not be allowed.
https://bugs.webkit.org/show_bug.cgi?id=92939

Reviewed by Eric Carlson.

Make sure cues added in JavaScript are not allowed negative timestamps.
Attempting to add a cue with a negative timestamp is not successful
and setting a timestamp to a negative value has no effect.

Source/WebCore:

Test: media/track/track-cue-negative-timestamp.html

* html/track/TextTrack.cpp:
(WebCore::TextTrack::addCue): If the cue's startTime or endTime is
    negative, do not add the cue.
* html/track/TextTrackCue.cpp:
(WebCore::TextTrackCue::setStartTime): Ignore negative values.
(WebCore::TextTrackCue::setEndTime): Ignore negative values.
* html/track/TextTrackCueList.cpp:
(WebCore::TextTrackCueList::add): Add ASSERTs to check startTime and
    endTime are positive.

LayoutTests:

* media/track/track-cue-negative-timestamp-expected.txt: Added.
* media/track/track-cue-negative-timestamp.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@124645 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/media/track/track-cue-negative-timestamp-expected.txt [new file with mode: 0644]
LayoutTests/media/track/track-cue-negative-timestamp.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/html/track/TextTrack.cpp
Source/WebCore/html/track/TextTrackCue.cpp
Source/WebCore/html/track/TextTrackCueList.cpp