| Index: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
|
| diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
|
| index 331a06c88bcee6e3001349418be3edf341f982c6..ed596d00d9df66b3052914fec0e6c9c47b0352e2 100644
|
| --- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
|
| +++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
|
| @@ -3709,8 +3709,11 @@ bool HTMLMediaElement::isGestureNeededForPlayback() const
|
| // We want to allow muted video to autoplay if:
|
| // - the flag is enabled;
|
| // - Data Saver is not enabled;
|
| - if (muted() && RuntimeEnabledFeatures::autoplayMutedVideosEnabled()
|
| - && !(document().settings() && document().settings()->dataSaverEnabled())) {
|
| + // - Autoplay is enabled in settings;
|
| + if (muted()
|
| + && RuntimeEnabledFeatures::autoplayMutedVideosEnabled()
|
| + && !(document().settings() && document().settings()->dataSaverEnabled())
|
| + && isAutoplayAllowedPerSettings()) {
|
| return false;
|
| }
|
|
|
| @@ -3720,6 +3723,15 @@ bool HTMLMediaElement::isGestureNeededForPlayback() const
|
| return true;
|
| }
|
|
|
| +bool HTMLMediaElement::isAutoplayAllowedPerSettings() const
|
| +{
|
| + LocalFrame* frame = document().frame();
|
| + if (!frame)
|
| + return false;
|
| + FrameLoaderClient* frameLoaderClient = frame->loader().client();
|
| + return frameLoaderClient && frameLoaderClient->allowAutoplay(false);
|
| +}
|
| +
|
| void HTMLMediaElement::setNetworkState(NetworkState state)
|
| {
|
| if (m_networkState != state) {
|
| @@ -3959,11 +3971,7 @@ String HTMLMediaElement::AutoplayHelperClientImpl::autoplayExperimentMode() cons
|
|
|
| bool HTMLMediaElement::AutoplayHelperClientImpl::isAutoplayAllowedPerSettings() const
|
| {
|
| - LocalFrame* frame = m_element->document().frame();
|
| - if (!frame)
|
| - return false;
|
| - FrameLoaderClient* frameLoaderClient = frame->loader().client();
|
| - return frameLoaderClient && frameLoaderClient->allowAutoplay(false);
|
| + return m_element->isAutoplayAllowedPerSettings();
|
| }
|
|
|
| void HTMLMediaElement::AutoplayHelperClientImpl::setRequestPositionUpdates(bool request)
|
|
|