| 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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 , m_playingRemotely(false) | 356 , m_playingRemotely(false) |
| 357 #if ENABLE(OILPAN) | 357 #if ENABLE(OILPAN) |
| 358 , m_isFinalizing(false) | 358 , m_isFinalizing(false) |
| 359 , m_closeMediaSourceWhenFinalizing(false) | 359 , m_closeMediaSourceWhenFinalizing(false) |
| 360 #endif | 360 #endif |
| 361 , m_initialPlayWithoutUserGestures(false) | 361 , m_initialPlayWithoutUserGestures(false) |
| 362 , m_autoplayMediaCounted(false) | 362 , m_autoplayMediaCounted(false) |
| 363 , m_audioTracks(AudioTrackList::create(*this)) | 363 , m_audioTracks(AudioTrackList::create(*this)) |
| 364 , m_videoTracks(VideoTrackList::create(*this)) | 364 , m_videoTracks(VideoTrackList::create(*this)) |
| 365 , m_textTracks(nullptr) | 365 , m_textTracks(nullptr) |
| 366 , m_performAutomaticTextTrackSelection(true) |
| 366 #if ENABLE(WEB_AUDIO) | 367 #if ENABLE(WEB_AUDIO) |
| 367 , m_audioSourceNode(nullptr) | 368 , m_audioSourceNode(nullptr) |
| 368 #endif | 369 #endif |
| 369 { | 370 { |
| 370 ASSERT(RuntimeEnabledFeatures::mediaEnabled()); | 371 ASSERT(RuntimeEnabledFeatures::mediaEnabled()); |
| 371 | 372 |
| 372 WTF_LOG(Media, "HTMLMediaElement::HTMLMediaElement(%p)", this); | 373 WTF_LOG(Media, "HTMLMediaElement::HTMLMediaElement(%p)", this); |
| 373 | 374 |
| 374 if (document.settings() && document.settings()->mediaPlaybackRequiresUserGes
ture()) | 375 if (document.settings() && document.settings()->mediaPlaybackRequiresUserGes
ture()) |
| 375 m_userGestureRequiredForPlay = true; | 376 m_userGestureRequiredForPlay = true; |
| (...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1160 // Mark this track as "configured" so configureTextTracks won't change the m
ode again. | 1161 // Mark this track as "configured" so configureTextTracks won't change the m
ode again. |
| 1161 if (track->trackType() == TextTrack::TrackElement) | 1162 if (track->trackType() == TextTrack::TrackElement) |
| 1162 track->setHasBeenConfigured(true); | 1163 track->setHasBeenConfigured(true); |
| 1163 | 1164 |
| 1164 configureTextTrackDisplay(AssumeVisibleChange); | 1165 configureTextTrackDisplay(AssumeVisibleChange); |
| 1165 | 1166 |
| 1166 ASSERT(textTracks()->contains(track)); | 1167 ASSERT(textTracks()->contains(track)); |
| 1167 textTracks()->scheduleChangeEvent(); | 1168 textTracks()->scheduleChangeEvent(); |
| 1168 } | 1169 } |
| 1169 | 1170 |
| 1171 void HTMLMediaElement::setAutomaticTextTrackSelection(bool enabled) |
| 1172 { |
| 1173 m_performAutomaticTextTrackSelection = enabled; |
| 1174 } |
| 1175 |
| 1170 bool HTMLMediaElement::isSafeToLoadURL(const KURL& url, InvalidURLAction actionI
fInvalid) | 1176 bool HTMLMediaElement::isSafeToLoadURL(const KURL& url, InvalidURLAction actionI
fInvalid) |
| 1171 { | 1177 { |
| 1172 if (!url.isValid()) { | 1178 if (!url.isValid()) { |
| 1173 WTF_LOG(Media, "HTMLMediaElement::isSafeToLoadURL(%p, %s) -> FALSE becau
se url is invalid", this, urlForLoggingMedia(url).utf8().data()); | 1179 WTF_LOG(Media, "HTMLMediaElement::isSafeToLoadURL(%p, %s) -> FALSE becau
se url is invalid", this, urlForLoggingMedia(url).utf8().data()); |
| 1174 return false; | 1180 return false; |
| 1175 } | 1181 } |
| 1176 | 1182 |
| 1177 LocalFrame* frame = document().frame(); | 1183 LocalFrame* frame = document().frame(); |
| 1178 if (!frame || !document().securityOrigin()->canDisplay(url)) { | 1184 if (!frame || !document().securityOrigin()->canDisplay(url)) { |
| 1179 if (actionIfInvalid == Complain) | 1185 if (actionIfInvalid == Complain) |
| (...skipping 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2474 size_t index = m_textTracksWhenResourceSelectionBegan.find(textTrack.get()); | 2480 size_t index = m_textTracksWhenResourceSelectionBegan.find(textTrack.get()); |
| 2475 if (index != kNotFound) | 2481 if (index != kNotFound) |
| 2476 m_textTracksWhenResourceSelectionBegan.remove(index); | 2482 m_textTracksWhenResourceSelectionBegan.remove(index); |
| 2477 } | 2483 } |
| 2478 | 2484 |
| 2479 void HTMLMediaElement::honorUserPreferencesForAutomaticTextTrackSelection() | 2485 void HTMLMediaElement::honorUserPreferencesForAutomaticTextTrackSelection() |
| 2480 { | 2486 { |
| 2481 if (!m_textTracks || !m_textTracks->length()) | 2487 if (!m_textTracks || !m_textTracks->length()) |
| 2482 return; | 2488 return; |
| 2483 | 2489 |
| 2490 if (!m_performAutomaticTextTrackSelection) |
| 2491 return; |
| 2492 |
| 2484 AutomaticTrackSelection::Configuration configuration; | 2493 AutomaticTrackSelection::Configuration configuration; |
| 2485 if (m_processingPreferenceChange) | 2494 if (m_processingPreferenceChange) |
| 2486 configuration.disableCurrentlyEnabledTracks = true; | 2495 configuration.disableCurrentlyEnabledTracks = true; |
| 2487 if (m_closedCaptionsVisible) | 2496 if (m_closedCaptionsVisible) |
| 2488 configuration.forceEnableSubtitleOrCaptionTrack = true; | 2497 configuration.forceEnableSubtitleOrCaptionTrack = true; |
| 2489 | 2498 |
| 2490 AutomaticTrackSelection trackSelection(configuration); | 2499 AutomaticTrackSelection trackSelection(configuration); |
| 2491 trackSelection.perform(*m_textTracks); | 2500 trackSelection.perform(*m_textTracks); |
| 2492 | 2501 |
| 2493 textTracksChanged(); | 2502 textTracksChanged(); |
| (...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3673 | 3682 |
| 3674 #if ENABLE(WEB_AUDIO) | 3683 #if ENABLE(WEB_AUDIO) |
| 3675 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) | 3684 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) |
| 3676 { | 3685 { |
| 3677 if (!visitor->isHeapObjectAlive(m_audioSourceNode) && audioSourceProvider()) | 3686 if (!visitor->isHeapObjectAlive(m_audioSourceNode) && audioSourceProvider()) |
| 3678 audioSourceProvider()->setClient(nullptr); | 3687 audioSourceProvider()->setClient(nullptr); |
| 3679 } | 3688 } |
| 3680 #endif | 3689 #endif |
| 3681 | 3690 |
| 3682 } | 3691 } |
| OLD | NEW |