| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple 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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 } | 299 } |
| 300 | 300 |
| 301 HTMLMediaElement::~HTMLMediaElement() | 301 HTMLMediaElement::~HTMLMediaElement() |
| 302 { | 302 { |
| 303 WTF_LOG(Media, "HTMLMediaElement::~HTMLMediaElement"); | 303 WTF_LOG(Media, "HTMLMediaElement::~HTMLMediaElement"); |
| 304 | 304 |
| 305 m_asyncEventQueue->close(); | 305 m_asyncEventQueue->close(); |
| 306 | 306 |
| 307 setShouldDelayLoadEvent(false); | 307 setShouldDelayLoadEvent(false); |
| 308 | 308 |
| 309 #if !ENABLE(OILPAN) |
| 309 if (m_textTracks) | 310 if (m_textTracks) |
| 310 m_textTracks->clearOwner(); | 311 m_textTracks->clearOwner(); |
| 312 #endif |
| 311 | 313 |
| 312 if (m_mediaController) { | 314 if (m_mediaController) { |
| 313 m_mediaController->removeMediaElement(this); | 315 m_mediaController->removeMediaElement(this); |
| 314 m_mediaController = nullptr; | 316 m_mediaController = nullptr; |
| 315 } | 317 } |
| 316 | 318 |
| 317 closeMediaSource(); | 319 closeMediaSource(); |
| 318 | 320 |
| 319 removeElementFromDocumentMap(this, &document()); | 321 removeElementFromDocumentMap(this, &document()); |
| 320 | 322 |
| (...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1254 | 1256 |
| 1255 void HTMLMediaElement::textTrackRemoveCues(TextTrack*, const TextTrackCueList* c
ues) | 1257 void HTMLMediaElement::textTrackRemoveCues(TextTrack*, const TextTrackCueList* c
ues) |
| 1256 { | 1258 { |
| 1257 WTF_LOG(Media, "HTMLMediaElement::textTrackRemoveCues"); | 1259 WTF_LOG(Media, "HTMLMediaElement::textTrackRemoveCues"); |
| 1258 | 1260 |
| 1259 TrackDisplayUpdateScope scope(this); | 1261 TrackDisplayUpdateScope scope(this); |
| 1260 for (size_t i = 0; i < cues->length(); ++i) | 1262 for (size_t i = 0; i < cues->length(); ++i) |
| 1261 textTrackRemoveCue(cues->item(i)->track(), cues->item(i)); | 1263 textTrackRemoveCue(cues->item(i)->track(), cues->item(i)); |
| 1262 } | 1264 } |
| 1263 | 1265 |
| 1264 void HTMLMediaElement::textTrackAddCue(TextTrack* track, PassRefPtr<TextTrackCue
> cue) | 1266 void HTMLMediaElement::textTrackAddCue(TextTrack* track, PassRefPtrWillBeRawPtr<
TextTrackCue> cue) |
| 1265 { | 1267 { |
| 1266 if (track->mode() == TextTrack::disabledKeyword()) | 1268 if (track->mode() == TextTrack::disabledKeyword()) |
| 1267 return; | 1269 return; |
| 1268 | 1270 |
| 1269 // Negative duration cues need be treated in the interval tree as | 1271 // Negative duration cues need be treated in the interval tree as |
| 1270 // zero-length cues. | 1272 // zero-length cues. |
| 1271 double endTime = max(cue->startTime(), cue->endTime()); | 1273 double endTime = max(cue->startTime(), cue->endTime()); |
| 1272 | 1274 |
| 1273 CueInterval interval = m_cueTree.createInterval(cue->startTime(), endTime, c
ue.get()); | 1275 CueInterval interval = m_cueTree.createInterval(cue->startTime(), endTime, c
ue.get()); |
| 1274 if (!m_cueTree.contains(interval)) | 1276 if (!m_cueTree.contains(interval)) |
| 1275 m_cueTree.add(interval); | 1277 m_cueTree.add(interval); |
| 1276 updateActiveTextTrackCues(currentTime()); | 1278 updateActiveTextTrackCues(currentTime()); |
| 1277 } | 1279 } |
| 1278 | 1280 |
| 1279 void HTMLMediaElement::textTrackRemoveCue(TextTrack*, PassRefPtr<TextTrackCue> c
ue) | 1281 void HTMLMediaElement::textTrackRemoveCue(TextTrack*, PassRefPtrWillBeRawPtr<Tex
tTrackCue> cue) |
| 1280 { | 1282 { |
| 1281 // Negative duration cues need to be treated in the interval tree as | 1283 // Negative duration cues need to be treated in the interval tree as |
| 1282 // zero-length cues. | 1284 // zero-length cues. |
| 1283 double endTime = max(cue->startTime(), cue->endTime()); | 1285 double endTime = max(cue->startTime(), cue->endTime()); |
| 1284 | 1286 |
| 1285 CueInterval interval = m_cueTree.createInterval(cue->startTime(), endTime, c
ue.get()); | 1287 CueInterval interval = m_cueTree.createInterval(cue->startTime(), endTime, c
ue.get()); |
| 1286 m_cueTree.remove(interval); | 1288 m_cueTree.remove(interval); |
| 1287 | 1289 |
| 1288 // Since the cue will be removed from the media element and likely the | 1290 // Since the cue will be removed from the media element and likely the |
| 1289 // TextTrack might also be destructed, notifying the region of the cue | 1291 // TextTrack might also be destructed, notifying the region of the cue |
| (...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2220 play(); | 2222 play(); |
| 2221 else | 2223 else |
| 2222 pause(); | 2224 pause(); |
| 2223 } | 2225 } |
| 2224 } | 2226 } |
| 2225 | 2227 |
| 2226 void HTMLMediaElement::mediaPlayerDidAddTextTrack(WebInbandTextTrack* webTrack) | 2228 void HTMLMediaElement::mediaPlayerDidAddTextTrack(WebInbandTextTrack* webTrack) |
| 2227 { | 2229 { |
| 2228 // 4.8.10.12.2 Sourcing in-band text tracks | 2230 // 4.8.10.12.2 Sourcing in-band text tracks |
| 2229 // 1. Associate the relevant data with a new text track and its correspondin
g new TextTrack object. | 2231 // 1. Associate the relevant data with a new text track and its correspondin
g new TextTrack object. |
| 2230 RefPtr<InbandTextTrack> textTrack = InbandTextTrack::create(document(), webT
rack); | 2232 RefPtrWillBeRawPtr<InbandTextTrack> textTrack = InbandTextTrack::create(docu
ment(), webTrack); |
| 2231 | 2233 |
| 2232 // 2. Set the new text track's kind, label, and language based on the semant
ics of the relevant data, | 2234 // 2. Set the new text track's kind, label, and language based on the semant
ics of the relevant data, |
| 2233 // as defined by the relevant specification. If there is no label in that da
ta, then the label must | 2235 // as defined by the relevant specification. If there is no label in that da
ta, then the label must |
| 2234 // be set to the empty string. | 2236 // be set to the empty string. |
| 2235 // 3. Associate the text track list of cues with the rules for updating the
text track rendering appropriate | 2237 // 3. Associate the text track list of cues with the rules for updating the
text track rendering appropriate |
| 2236 // for the format in question. | 2238 // for the format in question. |
| 2237 // 4. If the new text track's kind is metadata, then set the text track in-b
and metadata track dispatch type | 2239 // 4. If the new text track's kind is metadata, then set the text track in-b
and metadata track dispatch type |
| 2238 // as follows, based on the type of the media resource: | 2240 // as follows, based on the type of the media resource: |
| 2239 // 5. Populate the new text track's list of cues with the cues parsed so far
, folllowing the guidelines for exposing | 2241 // 5. Populate the new text track's list of cues with the cues parsed so far
, folllowing the guidelines for exposing |
| 2240 // cues, and begin updating it dynamically as necessary. | 2242 // cues, and begin updating it dynamically as necessary. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2255 addTextTrack(textTrack.get()); | 2257 addTextTrack(textTrack.get()); |
| 2256 } | 2258 } |
| 2257 | 2259 |
| 2258 void HTMLMediaElement::mediaPlayerDidRemoveTextTrack(WebInbandTextTrack* webTrac
k) | 2260 void HTMLMediaElement::mediaPlayerDidRemoveTextTrack(WebInbandTextTrack* webTrac
k) |
| 2259 { | 2261 { |
| 2260 if (!m_textTracks) | 2262 if (!m_textTracks) |
| 2261 return; | 2263 return; |
| 2262 | 2264 |
| 2263 // This cast is safe because we created the InbandTextTrack with the WebInba
ndTextTrack | 2265 // This cast is safe because we created the InbandTextTrack with the WebInba
ndTextTrack |
| 2264 // passed to mediaPlayerDidAddTextTrack. | 2266 // passed to mediaPlayerDidAddTextTrack. |
| 2265 RefPtr<InbandTextTrack> textTrack = static_cast<InbandTextTrack*>(webTrack->
client()); | 2267 RefPtrWillBeRawPtr<InbandTextTrack> textTrack = static_cast<InbandTextTrack*
>(webTrack->client()); |
| 2266 if (!textTrack) | 2268 if (!textTrack) |
| 2267 return; | 2269 return; |
| 2268 | 2270 |
| 2269 removeTextTrack(textTrack.get()); | 2271 removeTextTrack(textTrack.get()); |
| 2270 } | 2272 } |
| 2271 | 2273 |
| 2272 void HTMLMediaElement::closeCaptionTracksChanged() | 2274 void HTMLMediaElement::closeCaptionTracksChanged() |
| 2273 { | 2275 { |
| 2274 if (hasMediaControls()) | 2276 if (hasMediaControls()) |
| 2275 mediaControls()->closedCaptionTracksChanged(); | 2277 mediaControls()->closedCaptionTracksChanged(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2292 | 2294 |
| 2293 void HTMLMediaElement::forgetResourceSpecificTracks() | 2295 void HTMLMediaElement::forgetResourceSpecificTracks() |
| 2294 { | 2296 { |
| 2295 if (m_textTracks) { | 2297 if (m_textTracks) { |
| 2296 TrackDisplayUpdateScope scope(this); | 2298 TrackDisplayUpdateScope scope(this); |
| 2297 m_textTracks->removeAllInbandTracks(); | 2299 m_textTracks->removeAllInbandTracks(); |
| 2298 closeCaptionTracksChanged(); | 2300 closeCaptionTracksChanged(); |
| 2299 } | 2301 } |
| 2300 } | 2302 } |
| 2301 | 2303 |
| 2302 PassRefPtr<TextTrack> HTMLMediaElement::addTextTrack(const AtomicString& kind, c
onst AtomicString& label, const AtomicString& language, ExceptionState& exceptio
nState) | 2304 PassRefPtrWillBeRawPtr<TextTrack> HTMLMediaElement::addTextTrack(const AtomicStr
ing& kind, const AtomicString& label, const AtomicString& language, ExceptionSta
te& exceptionState) |
| 2303 { | 2305 { |
| 2304 // 4.8.10.12.4 Text track API | 2306 // 4.8.10.12.4 Text track API |
| 2305 // The addTextTrack(kind, label, language) method of media elements, when in
voked, must run the following steps: | 2307 // The addTextTrack(kind, label, language) method of media elements, when in
voked, must run the following steps: |
| 2306 | 2308 |
| 2307 // 1. If kind is not one of the following strings, then throw a SyntaxError
exception and abort these steps | 2309 // 1. If kind is not one of the following strings, then throw a SyntaxError
exception and abort these steps |
| 2308 if (!TextTrack::isValidKindKeyword(kind)) { | 2310 if (!TextTrack::isValidKindKeyword(kind)) { |
| 2309 exceptionState.throwDOMException(SyntaxError, "The 'kind' provided ('" +
kind + "') is invalid."); | 2311 exceptionState.throwDOMException(SyntaxError, "The 'kind' provided ('" +
kind + "') is invalid."); |
| 2310 return nullptr; | 2312 return nullptr; |
| 2311 } | 2313 } |
| 2312 | 2314 |
| 2313 // 2. If the label argument was omitted, let label be the empty string. | 2315 // 2. If the label argument was omitted, let label be the empty string. |
| 2314 // 3. If the language argument was omitted, let language be the empty string
. | 2316 // 3. If the language argument was omitted, let language be the empty string
. |
| 2315 // 4. Create a new TextTrack object. | 2317 // 4. Create a new TextTrack object. |
| 2316 | 2318 |
| 2317 // 5. Create a new text track corresponding to the new object, and set its t
ext track kind to kind, its text | 2319 // 5. Create a new text track corresponding to the new object, and set its t
ext track kind to kind, its text |
| 2318 // track label to label, its text track language to language... | 2320 // track label to label, its text track language to language... |
| 2319 RefPtr<TextTrack> textTrack = TextTrack::create(document(), kind, label, lan
guage); | 2321 RefPtrWillBeRawPtr<TextTrack> textTrack = TextTrack::create(document(), kind
, label, language); |
| 2320 | 2322 |
| 2321 // Note, due to side effects when changing track parameters, we have to | 2323 // Note, due to side effects when changing track parameters, we have to |
| 2322 // first append the track to the text track list. | 2324 // first append the track to the text track list. |
| 2323 | 2325 |
| 2324 // 6. Add the new text track to the media element's list of text tracks. | 2326 // 6. Add the new text track to the media element's list of text tracks. |
| 2325 addTextTrack(textTrack.get()); | 2327 addTextTrack(textTrack.get()); |
| 2326 | 2328 |
| 2327 // ... its text track readiness state to the text track loaded state ... | 2329 // ... its text track readiness state to the text track loaded state ... |
| 2328 textTrack->setReadinessState(TextTrack::Loaded); | 2330 textTrack->setReadinessState(TextTrack::Loaded); |
| 2329 | 2331 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2340 | 2342 |
| 2341 return m_textTracks.get(); | 2343 return m_textTracks.get(); |
| 2342 } | 2344 } |
| 2343 | 2345 |
| 2344 void HTMLMediaElement::didAddTrackElement(HTMLTrackElement* trackElement) | 2346 void HTMLMediaElement::didAddTrackElement(HTMLTrackElement* trackElement) |
| 2345 { | 2347 { |
| 2346 // 4.8.10.12.3 Sourcing out-of-band text tracks | 2348 // 4.8.10.12.3 Sourcing out-of-band text tracks |
| 2347 // When a track element's parent element changes and the new parent is a med
ia element, | 2349 // When a track element's parent element changes and the new parent is a med
ia element, |
| 2348 // then the user agent must add the track element's corresponding text track
to the | 2350 // then the user agent must add the track element's corresponding text track
to the |
| 2349 // media element's list of text tracks ... [continues in TextTrackList::appe
nd] | 2351 // media element's list of text tracks ... [continues in TextTrackList::appe
nd] |
| 2350 RefPtr<TextTrack> textTrack = trackElement->track(); | 2352 RefPtrWillBeRawPtr<TextTrack> textTrack = trackElement->track(); |
| 2351 if (!textTrack) | 2353 if (!textTrack) |
| 2352 return; | 2354 return; |
| 2353 | 2355 |
| 2354 addTextTrack(textTrack.get()); | 2356 addTextTrack(textTrack.get()); |
| 2355 | 2357 |
| 2356 // Do not schedule the track loading until parsing finishes so we don't star
t before all tracks | 2358 // Do not schedule the track loading until parsing finishes so we don't star
t before all tracks |
| 2357 // in the markup have been added. | 2359 // in the markup have been added. |
| 2358 if (isFinishedParsingChildren()) | 2360 if (isFinishedParsingChildren()) |
| 2359 scheduleDelayedAction(LoadTextTrackResource); | 2361 scheduleDelayedAction(LoadTextTrackResource); |
| 2360 | 2362 |
| 2361 if (hasMediaControls()) | 2363 if (hasMediaControls()) |
| 2362 mediaControls()->closedCaptionTracksChanged(); | 2364 mediaControls()->closedCaptionTracksChanged(); |
| 2363 } | 2365 } |
| 2364 | 2366 |
| 2365 void HTMLMediaElement::didRemoveTrackElement(HTMLTrackElement* trackElement) | 2367 void HTMLMediaElement::didRemoveTrackElement(HTMLTrackElement* trackElement) |
| 2366 { | 2368 { |
| 2367 #if !LOG_DISABLED | 2369 #if !LOG_DISABLED |
| 2368 KURL url = trackElement->getNonEmptyURLAttribute(srcAttr); | 2370 KURL url = trackElement->getNonEmptyURLAttribute(srcAttr); |
| 2369 WTF_LOG(Media, "HTMLMediaElement::didRemoveTrackElement - 'src' is %s", urlF
orLoggingMedia(url).utf8().data()); | 2371 WTF_LOG(Media, "HTMLMediaElement::didRemoveTrackElement - 'src' is %s", urlF
orLoggingMedia(url).utf8().data()); |
| 2370 #endif | 2372 #endif |
| 2371 | 2373 |
| 2372 RefPtr<TextTrack> textTrack = trackElement->track(); | 2374 RefPtrWillBeRawPtr<TextTrack> textTrack = trackElement->track(); |
| 2373 if (!textTrack) | 2375 if (!textTrack) |
| 2374 return; | 2376 return; |
| 2375 | 2377 |
| 2376 textTrack->setHasBeenConfigured(false); | 2378 textTrack->setHasBeenConfigured(false); |
| 2377 | 2379 |
| 2378 if (!m_textTracks) | 2380 if (!m_textTracks) |
| 2379 return; | 2381 return; |
| 2380 | 2382 |
| 2381 // 4.8.10.12.3 Sourcing out-of-band text tracks | 2383 // 4.8.10.12.3 Sourcing out-of-band text tracks |
| 2382 // When a track element's parent element changes and the old parent was a me
dia element, | 2384 // When a track element's parent element changes and the old parent was a me
dia element, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2424 | 2426 |
| 2425 void HTMLMediaElement::configureTextTrackGroup(const TrackGroup& group) | 2427 void HTMLMediaElement::configureTextTrackGroup(const TrackGroup& group) |
| 2426 { | 2428 { |
| 2427 ASSERT(group.tracks.size()); | 2429 ASSERT(group.tracks.size()); |
| 2428 | 2430 |
| 2429 WTF_LOG(Media, "HTMLMediaElement::configureTextTrackGroup(%d)", group.kind); | 2431 WTF_LOG(Media, "HTMLMediaElement::configureTextTrackGroup(%d)", group.kind); |
| 2430 | 2432 |
| 2431 Settings* settings = document().settings(); | 2433 Settings* settings = document().settings(); |
| 2432 | 2434 |
| 2433 // First, find the track in the group that should be enabled (if any). | 2435 // First, find the track in the group that should be enabled (if any). |
| 2434 Vector<RefPtr<TextTrack> > currentlyEnabledTracks; | 2436 WillBeHeapVector<RefPtrWillBeMember<TextTrack> > currentlyEnabledTracks; |
| 2435 RefPtr<TextTrack> trackToEnable; | 2437 RefPtrWillBeRawPtr<TextTrack> trackToEnable = nullptr; |
| 2436 RefPtr<TextTrack> defaultTrack; | 2438 RefPtrWillBeRawPtr<TextTrack> defaultTrack = nullptr; |
| 2437 RefPtr<TextTrack> fallbackTrack; | 2439 RefPtrWillBeRawPtr<TextTrack> fallbackTrack = nullptr; |
| 2438 int highestTrackScore = 0; | 2440 int highestTrackScore = 0; |
| 2439 for (size_t i = 0; i < group.tracks.size(); ++i) { | 2441 for (size_t i = 0; i < group.tracks.size(); ++i) { |
| 2440 RefPtr<TextTrack> textTrack = group.tracks[i]; | 2442 RefPtrWillBeRawPtr<TextTrack> textTrack = group.tracks[i]; |
| 2441 | 2443 |
| 2442 if (m_processingPreferenceChange && textTrack->mode() == TextTrack::show
ingKeyword()) | 2444 if (m_processingPreferenceChange && textTrack->mode() == TextTrack::show
ingKeyword()) |
| 2443 currentlyEnabledTracks.append(textTrack); | 2445 currentlyEnabledTracks.append(textTrack); |
| 2444 | 2446 |
| 2445 int trackScore = textTrackSelectionScore(*textTrack, settings); | 2447 int trackScore = textTrackSelectionScore(*textTrack, settings); |
| 2446 if (trackScore) { | 2448 if (trackScore) { |
| 2447 // * If the text track kind is { [subtitles or captions] [descriptio
ns] } and the user has indicated an interest in having a | 2449 // * If the text track kind is { [subtitles or captions] [descriptio
ns] } and the user has indicated an interest in having a |
| 2448 // track with this text track kind, text track language, and text tr
ack label enabled, and there is no | 2450 // track with this text track kind, text track language, and text tr
ack label enabled, and there is no |
| 2449 // other text track in the media element's list of text tracks with
a text track kind of either subtitles | 2451 // other text track in the media element's list of text tracks with
a text track kind of either subtitles |
| 2450 // or captions whose text track mode is showing | 2452 // or captions whose text track mode is showing |
| (...skipping 25 matching lines...) Expand all Loading... |
| 2476 // If no track matches the user's preferred language and non was marked 'def
ault', enable the first track | 2478 // If no track matches the user's preferred language and non was marked 'def
ault', enable the first track |
| 2477 // because the user has explicitly stated a preference for this kind of trac
k. | 2479 // because the user has explicitly stated a preference for this kind of trac
k. |
| 2478 if (!fallbackTrack && m_closedCaptionsVisible && group.kind == TrackGroup::C
aptionsAndSubtitles) | 2480 if (!fallbackTrack && m_closedCaptionsVisible && group.kind == TrackGroup::C
aptionsAndSubtitles) |
| 2479 fallbackTrack = group.tracks[0]; | 2481 fallbackTrack = group.tracks[0]; |
| 2480 | 2482 |
| 2481 if (!trackToEnable && fallbackTrack) | 2483 if (!trackToEnable && fallbackTrack) |
| 2482 trackToEnable = fallbackTrack; | 2484 trackToEnable = fallbackTrack; |
| 2483 | 2485 |
| 2484 if (currentlyEnabledTracks.size()) { | 2486 if (currentlyEnabledTracks.size()) { |
| 2485 for (size_t i = 0; i < currentlyEnabledTracks.size(); ++i) { | 2487 for (size_t i = 0; i < currentlyEnabledTracks.size(); ++i) { |
| 2486 RefPtr<TextTrack> textTrack = currentlyEnabledTracks[i]; | 2488 RefPtrWillBeRawPtr<TextTrack> textTrack = currentlyEnabledTracks[i]; |
| 2487 if (textTrack != trackToEnable) | 2489 if (textTrack != trackToEnable) |
| 2488 textTrack->setMode(TextTrack::disabledKeyword()); | 2490 textTrack->setMode(TextTrack::disabledKeyword()); |
| 2489 } | 2491 } |
| 2490 } | 2492 } |
| 2491 | 2493 |
| 2492 if (trackToEnable) | 2494 if (trackToEnable) |
| 2493 trackToEnable->setMode(TextTrack::showingKeyword()); | 2495 trackToEnable->setMode(TextTrack::showingKeyword()); |
| 2494 } | 2496 } |
| 2495 | 2497 |
| 2496 void HTMLMediaElement::configureTextTracks() | 2498 void HTMLMediaElement::configureTextTracks() |
| 2497 { | 2499 { |
| 2498 TrackGroup captionAndSubtitleTracks(TrackGroup::CaptionsAndSubtitles); | 2500 TrackGroup captionAndSubtitleTracks(TrackGroup::CaptionsAndSubtitles); |
| 2499 TrackGroup descriptionTracks(TrackGroup::Description); | 2501 TrackGroup descriptionTracks(TrackGroup::Description); |
| 2500 TrackGroup chapterTracks(TrackGroup::Chapter); | 2502 TrackGroup chapterTracks(TrackGroup::Chapter); |
| 2501 TrackGroup metadataTracks(TrackGroup::Metadata); | 2503 TrackGroup metadataTracks(TrackGroup::Metadata); |
| 2502 TrackGroup otherTracks(TrackGroup::Other); | 2504 TrackGroup otherTracks(TrackGroup::Other); |
| 2503 | 2505 |
| 2504 if (!m_textTracks) | 2506 if (!m_textTracks) |
| 2505 return; | 2507 return; |
| 2506 | 2508 |
| 2507 for (size_t i = 0; i < m_textTracks->length(); ++i) { | 2509 for (size_t i = 0; i < m_textTracks->length(); ++i) { |
| 2508 RefPtr<TextTrack> textTrack = m_textTracks->item(i); | 2510 RefPtrWillBeRawPtr<TextTrack> textTrack = m_textTracks->item(i); |
| 2509 if (!textTrack) | 2511 if (!textTrack) |
| 2510 continue; | 2512 continue; |
| 2511 | 2513 |
| 2512 String kind = textTrack->kind(); | 2514 String kind = textTrack->kind(); |
| 2513 TrackGroup* currentGroup; | 2515 TrackGroup* currentGroup; |
| 2514 if (kind == TextTrack::subtitlesKeyword() || kind == TextTrack::captions
Keyword()) | 2516 if (kind == TextTrack::subtitlesKeyword() || kind == TextTrack::captions
Keyword()) |
| 2515 currentGroup = &captionAndSubtitleTracks; | 2517 currentGroup = &captionAndSubtitleTracks; |
| 2516 else if (kind == TextTrack::descriptionsKeyword()) | 2518 else if (kind == TextTrack::descriptionsKeyword()) |
| 2517 currentGroup = &descriptionTracks; | 2519 currentGroup = &descriptionTracks; |
| 2518 else if (kind == TextTrack::chaptersKeyword()) | 2520 else if (kind == TextTrack::chaptersKeyword()) |
| (...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3387 { | 3389 { |
| 3388 if (!m_textTracks) | 3390 if (!m_textTracks) |
| 3389 return; | 3391 return; |
| 3390 | 3392 |
| 3391 // Mark all tracks as not "configured" so that configureTextTracks() | 3393 // Mark all tracks as not "configured" so that configureTextTracks() |
| 3392 // will reconsider which tracks to display in light of new user preferences | 3394 // will reconsider which tracks to display in light of new user preferences |
| 3393 // (e.g. default tracks should not be displayed if the user has turned off | 3395 // (e.g. default tracks should not be displayed if the user has turned off |
| 3394 // captions and non-default tracks should be displayed based on language | 3396 // captions and non-default tracks should be displayed based on language |
| 3395 // preferences if the user has turned captions on). | 3397 // preferences if the user has turned captions on). |
| 3396 for (unsigned i = 0; i < m_textTracks->length(); ++i) { | 3398 for (unsigned i = 0; i < m_textTracks->length(); ++i) { |
| 3397 RefPtr<TextTrack> textTrack = m_textTracks->item(i); | 3399 RefPtrWillBeRawPtr<TextTrack> textTrack = m_textTracks->item(i); |
| 3398 String kind = textTrack->kind(); | 3400 String kind = textTrack->kind(); |
| 3399 | 3401 |
| 3400 if (kind == TextTrack::subtitlesKeyword() || kind == TextTrack::captions
Keyword()) | 3402 if (kind == TextTrack::subtitlesKeyword() || kind == TextTrack::captions
Keyword()) |
| 3401 textTrack->setHasBeenConfigured(false); | 3403 textTrack->setHasBeenConfigured(false); |
| 3402 } | 3404 } |
| 3403 configureTextTracks(); | 3405 configureTextTracks(); |
| 3404 } | 3406 } |
| 3405 | 3407 |
| 3406 bool HTMLMediaElement::willRespondToMouseClickEvents() | 3408 bool HTMLMediaElement::willRespondToMouseClickEvents() |
| 3407 { | 3409 { |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3640 m_mediaSource->setWebMediaSourceAndOpen(adoptPtr(webMediaSource)); | 3642 m_mediaSource->setWebMediaSourceAndOpen(adoptPtr(webMediaSource)); |
| 3641 } | 3643 } |
| 3642 | 3644 |
| 3643 bool HTMLMediaElement::isInteractiveContent() const | 3645 bool HTMLMediaElement::isInteractiveContent() const |
| 3644 { | 3646 { |
| 3645 return fastHasAttribute(controlsAttr); | 3647 return fastHasAttribute(controlsAttr); |
| 3646 } | 3648 } |
| 3647 | 3649 |
| 3648 void HTMLMediaElement::trace(Visitor* visitor) | 3650 void HTMLMediaElement::trace(Visitor* visitor) |
| 3649 { | 3651 { |
| 3652 visitor->trace(m_textTracks); |
| 3653 visitor->trace(m_textTracksWhenResourceSelectionBegan); |
| 3650 Supplementable<HTMLMediaElement>::trace(visitor); | 3654 Supplementable<HTMLMediaElement>::trace(visitor); |
| 3651 HTMLElement::trace(visitor); | 3655 HTMLElement::trace(visitor); |
| 3652 } | 3656 } |
| 3653 | 3657 |
| 3654 } | 3658 } |
| OLD | NEW |