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

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

Issue 224833002: Implement DataCue interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 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
Index: Source/core/html/track/TextTrack.cpp
diff --git a/Source/core/html/track/TextTrack.cpp b/Source/core/html/track/TextTrack.cpp
index 5789476a8f848fd66ba5818692bb11e87bcb4c15..ea0f2ebbed28b8915b2f306fb99b7995273c4797 100644
--- a/Source/core/html/track/TextTrack.cpp
+++ b/Source/core/html/track/TextTrack.cpp
@@ -224,13 +224,24 @@ TextTrackCueList* TextTrack::activeCues() const
return 0;
}
-void TextTrack::addCue(PassRefPtr<TextTrackCue> prpCue)
+void TextTrack::addCue(PassRefPtr<TextTrackCue> prpCue, ExceptionState& exceptionState)
{
if (!prpCue)
return;
RefPtr<TextTrackCue> cue = prpCue;
+ // 4.7.10.12.6 Text tracks exposing in-band metadata
+ // The UA will use DataCue to expose only text track cue objects that belong to a text track that has a text
+ // track kind of metadata.
+ // If a DataCue is added to a TextTrack via the addCue() method but the text track does not have its text
+ // track kind set to metadata, throw a InvalidNodeTypeError exception and don't add the cue to the TextTrackList
acolwell GONE FROM CHROMIUM 2014/04/04 23:25:27 nit: I think there is a typo in the spec. s/TextTr
+ // of the TextTrack.
+ if (cue->cueType() == TextTrackCue::Data && kind() != metadataKeyword()) {
+ exceptionState.throwDOMException(InvalidNodeTypeError, "DataCues can only be added to tracks with kind='metadata'");
philipj_slow 2014/04/04 14:54:33 The spec does say this, but it doesn't make sense.
Brendan Long 2014/04/04 15:07:22 That makes sense. I'll try bring it up on the list
Brendan Long 2014/04/04 15:17:00 New bug: https://www.w3.org/Bugs/Public/show_bug.
+ return;
+ }
+
// TODO(93143): Add spec-compliant behavior for negative time values.
if (std::isnan(cue->startTime()) || std::isnan(cue->endTime()) || cue->startTime() < 0 || cue->endTime() < 0)
return;

Powered by Google App Engine
This is Rietveld 408576698