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

Side by Side 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, 8 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 // then the activeCues attribute must return a live TextTrackCueList object ... 217 // then the activeCues attribute must return a live TextTrackCueList object ...
218 // ... whose active flag was set when the script started, in text track cue 218 // ... whose active flag was set when the script started, in text track cue
219 // order. Otherwise, it must return null. When an object is returned, the 219 // order. Otherwise, it must return null. When an object is returned, the
220 // same object must be returned each time. 220 // same object must be returned each time.
221 // http://www.whatwg.org/specs/web-apps/current-work/#dom-texttrack-activecu es 221 // http://www.whatwg.org/specs/web-apps/current-work/#dom-texttrack-activecu es
222 if (m_cues && m_mode != disabledKeyword()) 222 if (m_cues && m_mode != disabledKeyword())
223 return m_cues->activeCues(); 223 return m_cues->activeCues();
224 return 0; 224 return 0;
225 } 225 }
226 226
227 void TextTrack::addCue(PassRefPtr<TextTrackCue> prpCue) 227 void TextTrack::addCue(PassRefPtr<TextTrackCue> prpCue, ExceptionState& exceptio nState)
228 { 228 {
229 if (!prpCue) 229 if (!prpCue)
230 return; 230 return;
231 231
232 RefPtr<TextTrackCue> cue = prpCue; 232 RefPtr<TextTrackCue> cue = prpCue;
233 233
234 // 4.7.10.12.6 Text tracks exposing in-band metadata
235 // The UA will use DataCue to expose only text track cue objects that belong to a text track that has a text
236 // track kind of metadata.
237 // If a DataCue is added to a TextTrack via the addCue() method but the text track does not have its text
238 // track kind set to metadata, throw a InvalidNodeTypeError exception and do n'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
239 // of the TextTrack.
240 if (cue->cueType() == TextTrackCue::Data && kind() != metadataKeyword()) {
241 exceptionState.throwDOMException(InvalidNodeTypeError, "DataCues can onl y 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.
242 return;
243 }
244
234 // TODO(93143): Add spec-compliant behavior for negative time values. 245 // TODO(93143): Add spec-compliant behavior for negative time values.
235 if (std::isnan(cue->startTime()) || std::isnan(cue->endTime()) || cue->start Time() < 0 || cue->endTime() < 0) 246 if (std::isnan(cue->startTime()) || std::isnan(cue->endTime()) || cue->start Time() < 0 || cue->endTime() < 0)
236 return; 247 return;
237 248
238 // 4.8.10.12.5 Text track API 249 // 4.8.10.12.5 Text track API
239 250
240 // The addCue(cue) method of TextTrack objects, when invoked, must run the f ollowing steps: 251 // The addCue(cue) method of TextTrack objects, when invoked, must run the f ollowing steps:
241 252
242 // 1. If the given cue is in a text track list of cues, then remove cue from that text track 253 // 1. If the given cue is in a text track list of cues, then remove cue from that text track
243 // list of cues. 254 // list of cues.
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 { 438 {
428 return m_document; 439 return m_document;
429 } 440 }
430 441
431 HTMLMediaElement* TextTrack::mediaElement() 442 HTMLMediaElement* TextTrack::mediaElement()
432 { 443 {
433 return m_trackList ? m_trackList->owner() : 0; 444 return m_trackList ? m_trackList->owner() : 0;
434 } 445 }
435 446
436 } // namespace WebCore 447 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698