OLD | NEW |
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 15 matching lines...) Expand all Loading... |
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 */ | 30 */ |
31 | 31 |
32 #include "config.h" | 32 #include "config.h" |
33 #include "core/html/track/TextTrack.h" | 33 #include "core/html/track/TextTrack.h" |
34 | 34 |
35 #include "RuntimeEnabledFeatures.h" | 35 #include "RuntimeEnabledFeatures.h" |
36 #include "bindings/v8/ExceptionMessages.h" | |
37 #include "bindings/v8/ExceptionState.h" | 36 #include "bindings/v8/ExceptionState.h" |
38 #include "bindings/v8/ExceptionStatePlaceholder.h" | 37 #include "bindings/v8/ExceptionStatePlaceholder.h" |
39 #include "core/dom/Document.h" | 38 #include "core/dom/Document.h" |
40 #include "core/dom/ExceptionCode.h" | 39 #include "core/dom/ExceptionCode.h" |
41 #include "core/html/HTMLMediaElement.h" | 40 #include "core/html/HTMLMediaElement.h" |
42 #include "core/html/track/TextTrackCueList.h" | 41 #include "core/html/track/TextTrackCueList.h" |
43 #include "core/html/track/TextTrackList.h" | 42 #include "core/html/track/TextTrackList.h" |
44 #include "core/html/track/vtt/VTTRegion.h" | 43 #include "core/html/track/vtt/VTTRegion.h" |
45 #include "core/html/track/vtt/VTTRegionList.h" | 44 #include "core/html/track/vtt/VTTRegionList.h" |
46 | 45 |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 if (!cue) | 259 if (!cue) |
261 return; | 260 return; |
262 | 261 |
263 // 4.8.10.12.5 Text track API | 262 // 4.8.10.12.5 Text track API |
264 | 263 |
265 // The removeCue(cue) method of TextTrack objects, when invoked, must run th
e following steps: | 264 // The removeCue(cue) method of TextTrack objects, when invoked, must run th
e following steps: |
266 | 265 |
267 // 1. If the given cue is not currently listed in the method's TextTrack | 266 // 1. If the given cue is not currently listed in the method's TextTrack |
268 // object's text track's text track list of cues, then throw a NotFoundError
exception. | 267 // object's text track's text track list of cues, then throw a NotFoundError
exception. |
269 if (cue->track() != this) { | 268 if (cue->track() != this) { |
270 exceptionState.throwDOMException(NotFoundError, ExceptionMessages::faile
dToExecute("removeCue", "TextTrack", "The specified cue is not listed in the Tex
tTrack's list of cues.")); | 269 exceptionState.throwDOMException(NotFoundError, "The specified cue is no
t listed in the TextTrack's list of cues."); |
271 return; | 270 return; |
272 } | 271 } |
273 | 272 |
274 // 2. Remove cue from the method's TextTrack object's text track's text trac
k list of cues. | 273 // 2. Remove cue from the method's TextTrack object's text track's text trac
k list of cues. |
275 if (!m_cues || !m_cues->remove(cue)) { | 274 if (!m_cues || !m_cues->remove(cue)) { |
276 exceptionState.throwDOMException(InvalidStateError, ExceptionMessages::f
ailedToExecute("removeCue", "TextTrack", "Failed to remove the specified cue."))
; | 275 exceptionState.throwDOMException(InvalidStateError, "Failed to remove th
e specified cue."); |
277 return; | 276 return; |
278 } | 277 } |
279 | 278 |
280 cue->setTrack(0); | 279 cue->setTrack(0); |
281 if (m_client) | 280 if (m_client) |
282 m_client->textTrackRemoveCue(this, cue); | 281 m_client->textTrackRemoveCue(this, cue); |
283 } | 282 } |
284 | 283 |
285 VTTRegionList* TextTrack::ensureVTTRegionList() | 284 VTTRegionList* TextTrack::ensureVTTRegionList() |
286 { | 285 { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 } | 333 } |
335 | 334 |
336 void TextTrack::removeRegion(VTTRegion* region, ExceptionState &exceptionState) | 335 void TextTrack::removeRegion(VTTRegion* region, ExceptionState &exceptionState) |
337 { | 336 { |
338 if (!region) | 337 if (!region) |
339 return; | 338 return; |
340 | 339 |
341 // 1. If the given region is not currently listed in the method's TextTrack | 340 // 1. If the given region is not currently listed in the method's TextTrack |
342 // object's text track list of regions, then throw a NotFoundError exception
. | 341 // object's text track list of regions, then throw a NotFoundError exception
. |
343 if (region->track() != this) { | 342 if (region->track() != this) { |
344 exceptionState.throwDOMException(NotFoundError, ExceptionMessages::faile
dToExecute("removeRegion", "TextTrack", "The specified region is not listed in t
he TextTrack's list of regions.")); | 343 exceptionState.throwDOMException(NotFoundError, "The specified region is
not listed in the TextTrack's list of regions."); |
345 return; | 344 return; |
346 } | 345 } |
347 | 346 |
348 if (!m_regions || !m_regions->remove(region)) { | 347 if (!m_regions || !m_regions->remove(region)) { |
349 exceptionState.throwDOMException(InvalidStateError, ExceptionMessages::f
ailedToExecute("removeRegion", "TextTrack", "Failed to remove the specified regi
on.")); | 348 exceptionState.throwDOMException(InvalidStateError, "Failed to remove th
e specified region."); |
350 return; | 349 return; |
351 } | 350 } |
352 | 351 |
353 region->setTrack(0); | 352 region->setTrack(0); |
354 } | 353 } |
355 | 354 |
356 void TextTrack::cueWillChange(TextTrackCue* cue) | 355 void TextTrack::cueWillChange(TextTrackCue* cue) |
357 { | 356 { |
358 if (!m_client) | 357 if (!m_client) |
359 return; | 358 return; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 return EventTargetNames::TextTrack; | 424 return EventTargetNames::TextTrack; |
426 } | 425 } |
427 | 426 |
428 ExecutionContext* TextTrack::executionContext() const | 427 ExecutionContext* TextTrack::executionContext() const |
429 { | 428 { |
430 return m_document; | 429 return m_document; |
431 } | 430 } |
432 | 431 |
433 } // namespace WebCore | 432 } // namespace WebCore |
434 | 433 |
OLD | NEW |