| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights |
| 3 * reserved. | 3 * 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 | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 const LocalFrame* frame = document.frame(); | 293 const LocalFrame* frame = document.frame(); |
| 294 return frame && frame->isCrossOriginSubframe(); | 294 return frame && frame->isCrossOriginSubframe(); |
| 295 } | 295 } |
| 296 | 296 |
| 297 // Return true if and only if the document settings specifies media playback | 297 // Return true if and only if the document settings specifies media playback |
| 298 // requires user gesture. | 298 // requires user gesture. |
| 299 bool computeLockedPendingUserGesture(Document& document) { | 299 bool computeLockedPendingUserGesture(Document& document) { |
| 300 if (!document.settings()) | 300 if (!document.settings()) |
| 301 return false; | 301 return false; |
| 302 | 302 |
| 303 if (document.settings()->crossOriginMediaPlaybackRequiresUserGesture() && | 303 if (document.settings()->getCrossOriginMediaPlaybackRequiresUserGesture() && |
| 304 isDocumentCrossOrigin(document)) { | 304 isDocumentCrossOrigin(document)) { |
| 305 return true; | 305 return true; |
| 306 } | 306 } |
| 307 | 307 |
| 308 return document.settings()->mediaPlaybackRequiresUserGesture(); | 308 return document.settings()->getMediaPlaybackRequiresUserGesture(); |
| 309 } | 309 } |
| 310 | 310 |
| 311 } // anonymous namespace | 311 } // anonymous namespace |
| 312 | 312 |
| 313 MIMETypeRegistry::SupportsType HTMLMediaElement::supportsType( | 313 MIMETypeRegistry::SupportsType HTMLMediaElement::supportsType( |
| 314 const ContentType& contentType) { | 314 const ContentType& contentType) { |
| 315 DEFINE_STATIC_LOCAL(const String, codecs, ("codecs")); | 315 DEFINE_STATIC_LOCAL(const String, codecs, ("codecs")); |
| 316 | 316 |
| 317 String type = contentType.type().lower(); | 317 String type = contentType.type().lower(); |
| 318 // The codecs string is not lower-cased because MP4 values are case sensitive | 318 // The codecs string is not lower-cased because MP4 values are case sensitive |
| (...skipping 1805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2124 WebMediaPlayer::Preload HTMLMediaElement::preloadType() const { | 2124 WebMediaPlayer::Preload HTMLMediaElement::preloadType() const { |
| 2125 const AtomicString& preload = fastGetAttribute(preloadAttr); | 2125 const AtomicString& preload = fastGetAttribute(preloadAttr); |
| 2126 if (equalIgnoringCase(preload, "none")) { | 2126 if (equalIgnoringCase(preload, "none")) { |
| 2127 UseCounter::count(document(), UseCounter::HTMLMediaElementPreloadNone); | 2127 UseCounter::count(document(), UseCounter::HTMLMediaElementPreloadNone); |
| 2128 return WebMediaPlayer::PreloadNone; | 2128 return WebMediaPlayer::PreloadNone; |
| 2129 } | 2129 } |
| 2130 | 2130 |
| 2131 // If the source scheme is requires network, force preload to 'none' on Data | 2131 // If the source scheme is requires network, force preload to 'none' on Data |
| 2132 // Saver and for low end devices. | 2132 // Saver and for low end devices. |
| 2133 if (document().settings() && | 2133 if (document().settings() && |
| 2134 (document().settings()->dataSaverEnabled() || | 2134 (document().settings()->getDataSaverEnabled() || |
| 2135 document().settings()->forcePreloadNoneForMediaElements()) && | 2135 document().settings()->getForcePreloadNoneForMediaElements()) && |
| 2136 (m_currentSrc.protocol() != "blob" && m_currentSrc.protocol() != "data" && | 2136 (m_currentSrc.protocol() != "blob" && m_currentSrc.protocol() != "data" && |
| 2137 m_currentSrc.protocol() != "file")) { | 2137 m_currentSrc.protocol() != "file")) { |
| 2138 UseCounter::count(document(), | 2138 UseCounter::count(document(), |
| 2139 UseCounter::HTMLMediaElementPreloadForcedNone); | 2139 UseCounter::HTMLMediaElementPreloadForcedNone); |
| 2140 return WebMediaPlayer::PreloadNone; | 2140 return WebMediaPlayer::PreloadNone; |
| 2141 } | 2141 } |
| 2142 | 2142 |
| 2143 if (equalIgnoringCase(preload, "metadata")) { | 2143 if (equalIgnoringCase(preload, "metadata")) { |
| 2144 UseCounter::count(document(), UseCounter::HTMLMediaElementPreloadMetadata); | 2144 UseCounter::count(document(), UseCounter::HTMLMediaElementPreloadMetadata); |
| 2145 return WebMediaPlayer::PreloadMetaData; | 2145 return WebMediaPlayer::PreloadMetaData; |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2808 if (!m_shouldPerformAutomaticTrackSelection) | 2808 if (!m_shouldPerformAutomaticTrackSelection) |
| 2809 return; | 2809 return; |
| 2810 | 2810 |
| 2811 AutomaticTrackSelection::Configuration configuration; | 2811 AutomaticTrackSelection::Configuration configuration; |
| 2812 if (m_processingPreferenceChange) | 2812 if (m_processingPreferenceChange) |
| 2813 configuration.disableCurrentlyEnabledTracks = true; | 2813 configuration.disableCurrentlyEnabledTracks = true; |
| 2814 if (m_textTracksVisible) | 2814 if (m_textTracksVisible) |
| 2815 configuration.forceEnableSubtitleOrCaptionTrack = true; | 2815 configuration.forceEnableSubtitleOrCaptionTrack = true; |
| 2816 | 2816 |
| 2817 Settings* settings = document().settings(); | 2817 Settings* settings = document().settings(); |
| 2818 if (settings) | 2818 if (settings) { |
| 2819 configuration.textTrackKindUserPreference = | 2819 configuration.textTrackKindUserPreference = |
| 2820 settings->textTrackKindUserPreference(); | 2820 settings->getTextTrackKindUserPreference(); |
| 2821 } |
| 2821 | 2822 |
| 2822 AutomaticTrackSelection trackSelection(configuration); | 2823 AutomaticTrackSelection trackSelection(configuration); |
| 2823 trackSelection.perform(*m_textTracks); | 2824 trackSelection.perform(*m_textTracks); |
| 2824 } | 2825 } |
| 2825 | 2826 |
| 2826 bool HTMLMediaElement::havePotentialSourceChild() { | 2827 bool HTMLMediaElement::havePotentialSourceChild() { |
| 2827 // Stash the current <source> node and next nodes so we can restore them after | 2828 // Stash the current <source> node and next nodes so we can restore them after |
| 2828 // checking to see there is another potential. | 2829 // checking to see there is another potential. |
| 2829 HTMLSourceElement* currentSourceNode = m_currentSourceNode; | 2830 HTMLSourceElement* currentSourceNode = m_currentSourceNode; |
| 2830 Node* nextNode = m_nextChildNodeToConsider; | 2831 Node* nextNode = m_nextChildNodeToConsider; |
| (...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3853 if (loadType() == WebMediaPlayer::LoadTypeMediaStream) | 3854 if (loadType() == WebMediaPlayer::LoadTypeMediaStream) |
| 3854 return false; | 3855 return false; |
| 3855 | 3856 |
| 3856 // We want to allow muted video to autoplay if: | 3857 // We want to allow muted video to autoplay if: |
| 3857 // - the flag is enabled; | 3858 // - the flag is enabled; |
| 3858 // - Data Saver is not enabled; | 3859 // - Data Saver is not enabled; |
| 3859 // - Preload was not disabled (low end devices); | 3860 // - Preload was not disabled (low end devices); |
| 3860 // - Autoplay is enabled in settings; | 3861 // - Autoplay is enabled in settings; |
| 3861 if (isHTMLVideoElement() && muted() && | 3862 if (isHTMLVideoElement() && muted() && |
| 3862 RuntimeEnabledFeatures::autoplayMutedVideosEnabled() && | 3863 RuntimeEnabledFeatures::autoplayMutedVideosEnabled() && |
| 3863 !(document().settings() && document().settings()->dataSaverEnabled()) && | |
| 3864 !(document().settings() && | 3864 !(document().settings() && |
| 3865 document().settings()->forcePreloadNoneForMediaElements()) && | 3865 document().settings()->getDataSaverEnabled()) && |
| 3866 !(document().settings() && |
| 3867 document().settings()->getForcePreloadNoneForMediaElements()) && |
| 3866 isAutoplayAllowedPerSettings()) { | 3868 isAutoplayAllowedPerSettings()) { |
| 3867 return false; | 3869 return false; |
| 3868 } | 3870 } |
| 3869 | 3871 |
| 3870 return true; | 3872 return true; |
| 3871 } | 3873 } |
| 3872 | 3874 |
| 3873 bool HTMLMediaElement::isAutoplayAllowedPerSettings() const { | 3875 bool HTMLMediaElement::isAutoplayAllowedPerSettings() const { |
| 3874 LocalFrame* frame = document().frame(); | 3876 LocalFrame* frame = document().frame(); |
| 3875 if (!frame) | 3877 if (!frame) |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4131 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE); | 4133 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE); |
| 4132 } | 4134 } |
| 4133 | 4135 |
| 4134 void HTMLMediaElement::viewportFillDebouncerTimerFired(TimerBase*) { | 4136 void HTMLMediaElement::viewportFillDebouncerTimerFired(TimerBase*) { |
| 4135 m_mostlyFillingViewport = true; | 4137 m_mostlyFillingViewport = true; |
| 4136 if (m_webMediaPlayer) | 4138 if (m_webMediaPlayer) |
| 4137 m_webMediaPlayer->becameDominantVisibleContent(m_mostlyFillingViewport); | 4139 m_webMediaPlayer->becameDominantVisibleContent(m_mostlyFillingViewport); |
| 4138 } | 4140 } |
| 4139 | 4141 |
| 4140 } // namespace blink | 4142 } // namespace blink |
| OLD | NEW |