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