| 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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 cueTrack->removeCue(cue.get(), ASSERT_NO_EXCEPTION); | 245 cueTrack->removeCue(cue.get(), ASSERT_NO_EXCEPTION); |
| 246 | 246 |
| 247 // 2. Add cue to the method's TextTrack object's text track's text track lis
t of cues. | 247 // 2. Add cue to the method's TextTrack object's text track's text track lis
t of cues. |
| 248 cue->setTrack(this); | 248 cue->setTrack(this); |
| 249 ensureTextTrackCueList()->add(cue); | 249 ensureTextTrackCueList()->add(cue); |
| 250 | 250 |
| 251 if (m_client) | 251 if (m_client) |
| 252 m_client->textTrackAddCue(this, cue.get()); | 252 m_client->textTrackAddCue(this, cue.get()); |
| 253 } | 253 } |
| 254 | 254 |
| 255 void TextTrack::removeCue(TextTrackCue* cue, ExceptionState& es) | 255 void TextTrack::removeCue(TextTrackCue* cue, ExceptionState& exceptionState) |
| 256 { | 256 { |
| 257 if (!cue) | 257 if (!cue) |
| 258 return; | 258 return; |
| 259 | 259 |
| 260 // 4.8.10.12.5 Text track API | 260 // 4.8.10.12.5 Text track API |
| 261 | 261 |
| 262 // The removeCue(cue) method of TextTrack objects, when invoked, must run th
e following steps: | 262 // The removeCue(cue) method of TextTrack objects, when invoked, must run th
e following steps: |
| 263 | 263 |
| 264 // 1. If the given cue is not currently listed in the method's TextTrack | 264 // 1. If the given cue is not currently listed in the method's TextTrack |
| 265 // object's text track's text track list of cues, then throw a NotFoundError
exception. | 265 // object's text track's text track list of cues, then throw a NotFoundError
exception. |
| 266 if (cue->track() != this) { | 266 if (cue->track() != this) { |
| 267 es.throwUninformativeAndGenericDOMException(NotFoundError); | 267 exceptionState.throwUninformativeAndGenericDOMException(NotFoundError); |
| 268 return; | 268 return; |
| 269 } | 269 } |
| 270 | 270 |
| 271 // 2. Remove cue from the method's TextTrack object's text track's text trac
k list of cues. | 271 // 2. Remove cue from the method's TextTrack object's text track's text trac
k list of cues. |
| 272 if (!m_cues || !m_cues->remove(cue)) { | 272 if (!m_cues || !m_cues->remove(cue)) { |
| 273 es.throwUninformativeAndGenericDOMException(InvalidStateError); | 273 exceptionState.throwUninformativeAndGenericDOMException(InvalidStateErro
r); |
| 274 return; | 274 return; |
| 275 } | 275 } |
| 276 | 276 |
| 277 cue->setTrack(0); | 277 cue->setTrack(0); |
| 278 if (m_client) | 278 if (m_client) |
| 279 m_client->textTrackRemoveCue(this, cue); | 279 m_client->textTrackRemoveCue(this, cue); |
| 280 } | 280 } |
| 281 | 281 |
| 282 VTTRegionList* TextTrack::ensureVTTRegionList() | 282 VTTRegionList* TextTrack::ensureVTTRegionList() |
| 283 { | 283 { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 existingRegion->updateParametersFromRegion(region.get()); | 323 existingRegion->updateParametersFromRegion(region.get()); |
| 324 return; | 324 return; |
| 325 } | 325 } |
| 326 | 326 |
| 327 // Otherwise: add region to the method's TextTrack object's text track | 327 // Otherwise: add region to the method's TextTrack object's text track |
| 328 // list of regions. | 328 // list of regions. |
| 329 region->setTrack(this); | 329 region->setTrack(this); |
| 330 regionList->add(region); | 330 regionList->add(region); |
| 331 } | 331 } |
| 332 | 332 |
| 333 void TextTrack::removeRegion(VTTRegion* region, ExceptionState &es) | 333 void TextTrack::removeRegion(VTTRegion* region, ExceptionState &exceptionState) |
| 334 { | 334 { |
| 335 if (!region) | 335 if (!region) |
| 336 return; | 336 return; |
| 337 | 337 |
| 338 // 1. If the given region is not currently listed in the method's TextTrack | 338 // 1. If the given region is not currently listed in the method's TextTrack |
| 339 // object's text track list of regions, then throw a NotFoundError exception
. | 339 // object's text track list of regions, then throw a NotFoundError exception
. |
| 340 if (region->track() != this) { | 340 if (region->track() != this) { |
| 341 es.throwUninformativeAndGenericDOMException(NotFoundError); | 341 exceptionState.throwUninformativeAndGenericDOMException(NotFoundError); |
| 342 return; | 342 return; |
| 343 } | 343 } |
| 344 | 344 |
| 345 if (!m_regions || !m_regions->remove(region)) { | 345 if (!m_regions || !m_regions->remove(region)) { |
| 346 es.throwUninformativeAndGenericDOMException(InvalidStateError); | 346 exceptionState.throwUninformativeAndGenericDOMException(InvalidStateErro
r); |
| 347 return; | 347 return; |
| 348 } | 348 } |
| 349 | 349 |
| 350 region->setTrack(0); | 350 region->setTrack(0); |
| 351 } | 351 } |
| 352 | 352 |
| 353 void TextTrack::cueWillChange(TextTrackCue* cue) | 353 void TextTrack::cueWillChange(TextTrackCue* cue) |
| 354 { | 354 { |
| 355 if (!m_client) | 355 if (!m_client) |
| 356 return; | 356 return; |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 return EventTargetNames::TextTrack; | 480 return EventTargetNames::TextTrack; |
| 481 } | 481 } |
| 482 | 482 |
| 483 ExecutionContext* TextTrack::executionContext() const | 483 ExecutionContext* TextTrack::executionContext() const |
| 484 { | 484 { |
| 485 return m_document; | 485 return m_document; |
| 486 } | 486 } |
| 487 | 487 |
| 488 } // namespace WebCore | 488 } // namespace WebCore |
| 489 | 489 |
| OLD | NEW |