| 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 1780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2099 WebMediaPlayer::Preload HTMLMediaElement::preloadType() const { | 2099 WebMediaPlayer::Preload HTMLMediaElement::preloadType() const { |
| 2100 const AtomicString& preload = fastGetAttribute(preloadAttr); | 2100 const AtomicString& preload = fastGetAttribute(preloadAttr); |
| 2101 if (equalIgnoringCase(preload, "none")) { | 2101 if (equalIgnoringCase(preload, "none")) { |
| 2102 UseCounter::count(document(), UseCounter::HTMLMediaElementPreloadNone); | 2102 UseCounter::count(document(), UseCounter::HTMLMediaElementPreloadNone); |
| 2103 return WebMediaPlayer::PreloadNone; | 2103 return WebMediaPlayer::PreloadNone; |
| 2104 } | 2104 } |
| 2105 | 2105 |
| 2106 // If the source scheme is requires network, force preload to 'none' on Data | 2106 // If the source scheme is requires network, force preload to 'none' on Data |
| 2107 // Saver and for low end devices. | 2107 // Saver and for low end devices. |
| 2108 if (document().settings() && | 2108 if (document().settings() && |
| 2109 (document().settings()->dataSaverEnabled() || | 2109 (document().settings()->GetDataSaverEnabled() || |
| 2110 document().settings()->forcePreloadNoneForMediaElements()) && | 2110 document().settings()->GetForcePreloadNoneForMediaElements()) && |
| 2111 (m_currentSrc.protocol() != "blob" && m_currentSrc.protocol() != "data" && | 2111 (m_currentSrc.protocol() != "blob" && m_currentSrc.protocol() != "data" && |
| 2112 m_currentSrc.protocol() != "file")) { | 2112 m_currentSrc.protocol() != "file")) { |
| 2113 UseCounter::count(document(), | 2113 UseCounter::count(document(), |
| 2114 UseCounter::HTMLMediaElementPreloadForcedNone); | 2114 UseCounter::HTMLMediaElementPreloadForcedNone); |
| 2115 return WebMediaPlayer::PreloadNone; | 2115 return WebMediaPlayer::PreloadNone; |
| 2116 } | 2116 } |
| 2117 | 2117 |
| 2118 if (equalIgnoringCase(preload, "metadata")) { | 2118 if (equalIgnoringCase(preload, "metadata")) { |
| 2119 UseCounter::count(document(), UseCounter::HTMLMediaElementPreloadMetadata); | 2119 UseCounter::count(document(), UseCounter::HTMLMediaElementPreloadMetadata); |
| 2120 return WebMediaPlayer::PreloadMetaData; | 2120 return WebMediaPlayer::PreloadMetaData; |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2783 if (!m_shouldPerformAutomaticTrackSelection) | 2783 if (!m_shouldPerformAutomaticTrackSelection) |
| 2784 return; | 2784 return; |
| 2785 | 2785 |
| 2786 AutomaticTrackSelection::Configuration configuration; | 2786 AutomaticTrackSelection::Configuration configuration; |
| 2787 if (m_processingPreferenceChange) | 2787 if (m_processingPreferenceChange) |
| 2788 configuration.disableCurrentlyEnabledTracks = true; | 2788 configuration.disableCurrentlyEnabledTracks = true; |
| 2789 if (m_textTracksVisible) | 2789 if (m_textTracksVisible) |
| 2790 configuration.forceEnableSubtitleOrCaptionTrack = true; | 2790 configuration.forceEnableSubtitleOrCaptionTrack = true; |
| 2791 | 2791 |
| 2792 Settings* settings = document().settings(); | 2792 Settings* settings = document().settings(); |
| 2793 if (settings) | 2793 if (settings) { |
| 2794 configuration.textTrackKindUserPreference = | 2794 configuration.textTrackKindUserPreference = |
| 2795 settings->textTrackKindUserPreference(); | 2795 settings->GetTextTrackKindUserPreference(); |
| 2796 } |
| 2796 | 2797 |
| 2797 AutomaticTrackSelection trackSelection(configuration); | 2798 AutomaticTrackSelection trackSelection(configuration); |
| 2798 trackSelection.perform(*m_textTracks); | 2799 trackSelection.perform(*m_textTracks); |
| 2799 } | 2800 } |
| 2800 | 2801 |
| 2801 bool HTMLMediaElement::havePotentialSourceChild() { | 2802 bool HTMLMediaElement::havePotentialSourceChild() { |
| 2802 // Stash the current <source> node and next nodes so we can restore them after | 2803 // Stash the current <source> node and next nodes so we can restore them after |
| 2803 // checking to see there is another potential. | 2804 // checking to see there is another potential. |
| 2804 HTMLSourceElement* currentSourceNode = m_currentSourceNode; | 2805 HTMLSourceElement* currentSourceNode = m_currentSourceNode; |
| 2805 Node* nextNode = m_nextChildNodeToConsider; | 2806 Node* nextNode = m_nextChildNodeToConsider; |
| (...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3828 if (loadType() == WebMediaPlayer::LoadTypeMediaStream) | 3829 if (loadType() == WebMediaPlayer::LoadTypeMediaStream) |
| 3829 return false; | 3830 return false; |
| 3830 | 3831 |
| 3831 // We want to allow muted video to autoplay if: | 3832 // We want to allow muted video to autoplay if: |
| 3832 // - the flag is enabled; | 3833 // - the flag is enabled; |
| 3833 // - Data Saver is not enabled; | 3834 // - Data Saver is not enabled; |
| 3834 // - Preload was not disabled (low end devices); | 3835 // - Preload was not disabled (low end devices); |
| 3835 // - Autoplay is enabled in settings; | 3836 // - Autoplay is enabled in settings; |
| 3836 if (isHTMLVideoElement() && muted() && | 3837 if (isHTMLVideoElement() && muted() && |
| 3837 RuntimeEnabledFeatures::autoplayMutedVideosEnabled() && | 3838 RuntimeEnabledFeatures::autoplayMutedVideosEnabled() && |
| 3838 !(document().settings() && document().settings()->dataSaverEnabled()) && | |
| 3839 !(document().settings() && | 3839 !(document().settings() && |
| 3840 document().settings()->forcePreloadNoneForMediaElements()) && | 3840 document().settings()->GetDataSaverEnabled()) && |
| 3841 !(document().settings() && |
| 3842 document().settings()->GetForcePreloadNoneForMediaElements()) && |
| 3841 isAutoplayAllowedPerSettings()) { | 3843 isAutoplayAllowedPerSettings()) { |
| 3842 return false; | 3844 return false; |
| 3843 } | 3845 } |
| 3844 | 3846 |
| 3845 return true; | 3847 return true; |
| 3846 } | 3848 } |
| 3847 | 3849 |
| 3848 bool HTMLMediaElement::isAutoplayAllowedPerSettings() const { | 3850 bool HTMLMediaElement::isAutoplayAllowedPerSettings() const { |
| 3849 LocalFrame* frame = document().frame(); | 3851 LocalFrame* frame = document().frame(); |
| 3850 if (!frame) | 3852 if (!frame) |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4106 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE); | 4108 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE); |
| 4107 } | 4109 } |
| 4108 | 4110 |
| 4109 void HTMLMediaElement::viewportFillDebouncerTimerFired(TimerBase*) { | 4111 void HTMLMediaElement::viewportFillDebouncerTimerFired(TimerBase*) { |
| 4110 m_mostlyFillingViewport = true; | 4112 m_mostlyFillingViewport = true; |
| 4111 if (m_webMediaPlayer) | 4113 if (m_webMediaPlayer) |
| 4112 m_webMediaPlayer->becameDominantVisibleContent(m_mostlyFillingViewport); | 4114 m_webMediaPlayer->becameDominantVisibleContent(m_mostlyFillingViewport); |
| 4113 } | 4115 } |
| 4114 | 4116 |
| 4115 } // namespace blink | 4117 } // namespace blink |
| OLD | NEW |