Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(785)

Unified Diff: Source/core/html/track/TextTrack.cpp

Issue 944823003: Update a cue's insertion order when reinserting it with addCue() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/media/track/opera/interfaces/TextTrack/addCue.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/track/TextTrack.cpp
diff --git a/Source/core/html/track/TextTrack.cpp b/Source/core/html/track/TextTrack.cpp
index 54f2cbdec176b2a2c6a4aefe59f6fb5adc5abd34..52a78446a156ade1fb3174e68ccc056a1252d6e0 100644
--- a/Source/core/html/track/TextTrack.cpp
+++ b/Source/core/html/track/TextTrack.cpp
@@ -234,17 +234,18 @@ void TextTrack::addCue(PassRefPtrWillBeRawPtr<TextTrackCue> prpCue)
if (std::isnan(cue->startTime()) || std::isnan(cue->endTime()) || cue->startTime() < 0 || cue->endTime() < 0)
return;
- // 4.8.10.12.5 Text track API
+ // https://html.spec.whatwg.org/multipage/embedded-content.html#dom-texttrack-addcue
// The addCue(cue) method of TextTrack objects, when invoked, must run the following steps:
- // 1. If the given cue is in a text track list of cues, then remove cue from that text track
- // list of cues.
- TextTrack* cueTrack = cue->track();
- if (cueTrack && cueTrack != this)
+ // (Steps 1 and 2 - pertaining to association of rendering rules - are not implemented.)
+
+ // 3. If the given cue is in a text track list of cues, then remove cue
+ // from that text track list of cues.
+ if (TextTrack* cueTrack = cue->track())
cueTrack->removeCue(cue.get(), ASSERT_NO_EXCEPTION);
- // 2. Add cue to the method's TextTrack object's text track's text track list of cues.
+ // 4. Add cue to the method's TextTrack object's text track's text track list of cues.
cue->setTrack(this);
ensureTextTrackCueList()->add(cue);
@@ -257,20 +258,15 @@ void TextTrack::removeCue(TextTrackCue* cue, ExceptionState& exceptionState)
if (!cue)
return;
- // 4.8.10.12.5 Text track API
+ // https://html.spec.whatwg.org/multipage/embedded-content.html#dom-texttrack-removecue
// The removeCue(cue) method of TextTrack objects, when invoked, must run the following steps:
// 1. If the given cue is not currently listed in the method's TextTrack
// object's text track's text track list of cues, then throw a NotFoundError exception.
- if (cue->track() != this) {
- exceptionState.throwDOMException(NotFoundError, "The specified cue is not listed in the TextTrack's list of cues.");
- return;
- }
-
// 2. Remove cue from the method's TextTrack object's text track's text track list of cues.
- if (!m_cues || !m_cues->remove(cue)) {
philipj_slow 2015/02/23 13:32:13 If this shouldn't be possible, can we assert it in
fs 2015/02/23 14:04:49 Yes. There're a few of these invariants - in this
- exceptionState.throwDOMException(InvalidStateError, "Failed to remove the specified cue.");
+ if (cue->track() != this || !m_cues || !m_cues->remove(cue)) {
+ exceptionState.throwDOMException(NotFoundError, "The specified cue is not listed in the TextTrack's list of cues.");
return;
}
« no previous file with comments | « LayoutTests/media/track/opera/interfaces/TextTrack/addCue.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698