| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 // 4. Download: ... | 267 // 4. Download: ... |
| 268 // If the fetching algorithm fails for any reason (network error, the server
returns an error | 268 // If the fetching algorithm fails for any reason (network error, the server
returns an error |
| 269 // code, a cross-origin check fails, etc), or if URL is the empty string or
has the wrong origin | 269 // code, a cross-origin check fails, etc), or if URL is the empty string or
has the wrong origin |
| 270 // as determined by the condition at the start of this step, or if the fetch
ed resource is not in | 270 // as determined by the condition at the start of this step, or if the fetch
ed resource is not in |
| 271 // a supported format, then queue a task to first change the text track read
iness state to failed | 271 // a supported format, then queue a task to first change the text track read
iness state to failed |
| 272 // to load and then fire a simple event named error at the track element; an
d then, once that task | 272 // to load and then fire a simple event named error at the track element; an
d then, once that task |
| 273 // is queued, move on to the step below labeled monitoring. | 273 // is queued, move on to the step below labeled monitoring. |
| 274 | 274 |
| 275 if (status == Failure) { | 275 if (status == Failure) { |
| 276 setReadyState(HTMLTrackElement::TRACK_ERROR); | 276 setReadyState(HTMLTrackElement::TRACK_ERROR); |
| 277 dispatchEvent(Event::create(eventNames().errorEvent, false, false), IGNO
RE_EXCEPTION_STATE); | 277 dispatchEvent(Event::create(eventNames().errorEvent, false, false), IGNO
RE_EXCEPTION); |
| 278 return; | 278 return; |
| 279 } | 279 } |
| 280 | 280 |
| 281 // If the fetching algorithm does not fail, then the final task that is queu
ed by the networking | 281 // If the fetching algorithm does not fail, then the final task that is queu
ed by the networking |
| 282 // task source must run the following steps: | 282 // task source must run the following steps: |
| 283 // 1. Change the text track readiness state to loaded. | 283 // 1. Change the text track readiness state to loaded. |
| 284 setReadyState(HTMLTrackElement::LOADED); | 284 setReadyState(HTMLTrackElement::LOADED); |
| 285 | 285 |
| 286 // 2. If the file was successfully processed, fire a simple event named
load at the | 286 // 2. If the file was successfully processed, fire a simple event named
load at the |
| 287 // track element. | 287 // track element. |
| 288 dispatchEvent(Event::create(eventNames().loadEvent, false, false), IGNORE_EX
CEPTION_STATE); | 288 dispatchEvent(Event::create(eventNames().loadEvent, false, false), IGNORE_EX
CEPTION); |
| 289 } | 289 } |
| 290 | 290 |
| 291 // NOTE: The values in the TextTrack::ReadinessState enum must stay in sync with
those in HTMLTrackElement::ReadyState. | 291 // NOTE: The values in the TextTrack::ReadinessState enum must stay in sync with
those in HTMLTrackElement::ReadyState. |
| 292 COMPILE_ASSERT(HTMLTrackElement::NONE == static_cast<HTMLTrackElement::ReadyStat
e>(TextTrack::NotLoaded), TextTrackEnumNotLoaded_Is_Wrong_Should_Be_HTMLTrackEle
mentEnumNONE); | 292 COMPILE_ASSERT(HTMLTrackElement::NONE == static_cast<HTMLTrackElement::ReadyStat
e>(TextTrack::NotLoaded), TextTrackEnumNotLoaded_Is_Wrong_Should_Be_HTMLTrackEle
mentEnumNONE); |
| 293 COMPILE_ASSERT(HTMLTrackElement::LOADING == static_cast<HTMLTrackElement::ReadyS
tate>(TextTrack::Loading), TextTrackEnumLoadingIsWrong_ShouldBe_HTMLTrackElement
EnumLOADING); | 293 COMPILE_ASSERT(HTMLTrackElement::LOADING == static_cast<HTMLTrackElement::ReadyS
tate>(TextTrack::Loading), TextTrackEnumLoadingIsWrong_ShouldBe_HTMLTrackElement
EnumLOADING); |
| 294 COMPILE_ASSERT(HTMLTrackElement::LOADED == static_cast<HTMLTrackElement::ReadySt
ate>(TextTrack::Loaded), TextTrackEnumLoaded_Is_Wrong_Should_Be_HTMLTrackElement
EnumLOADED); | 294 COMPILE_ASSERT(HTMLTrackElement::LOADED == static_cast<HTMLTrackElement::ReadySt
ate>(TextTrack::Loaded), TextTrackEnumLoaded_Is_Wrong_Should_Be_HTMLTrackElement
EnumLOADED); |
| 295 COMPILE_ASSERT(HTMLTrackElement::TRACK_ERROR == static_cast<HTMLTrackElement::Re
adyState>(TextTrack::FailedToLoad), TextTrackEnumFailedToLoad_Is_Wrong_Should_Be
_HTMLTrackElementEnumTRACK_ERROR); | 295 COMPILE_ASSERT(HTMLTrackElement::TRACK_ERROR == static_cast<HTMLTrackElement::Re
adyState>(TextTrack::FailedToLoad), TextTrackEnumFailedToLoad_Is_Wrong_Should_Be
_HTMLTrackElementEnumTRACK_ERROR); |
| 296 | 296 |
| 297 void HTMLTrackElement::setReadyState(ReadyState state) | 297 void HTMLTrackElement::setReadyState(ReadyState state) |
| 298 { | 298 { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 { | 358 { |
| 359 Element* parent = parentElement(); | 359 Element* parent = parentElement(); |
| 360 if (parent && parent->isMediaElement()) | 360 if (parent && parent->isMediaElement()) |
| 361 return static_cast<HTMLMediaElement*>(parentNode()); | 361 return static_cast<HTMLMediaElement*>(parentNode()); |
| 362 | 362 |
| 363 return 0; | 363 return 0; |
| 364 } | 364 } |
| 365 | 365 |
| 366 } | 366 } |
| 367 | 367 |
| OLD | NEW |