Index: Source/core/html/HTMLMediaElement.cpp |
diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp |
index 00dd8693be3b35898ee12af2129452a5aa5ca0e7..5e1f5b1299c3a07844cdd9bb7d9ddf1c57e9b20e 100644 |
--- a/Source/core/html/HTMLMediaElement.cpp |
+++ b/Source/core/html/HTMLMediaElement.cpp |
@@ -275,7 +275,6 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document& docum |
, m_loadState(WaitingForSource) |
, m_webLayer(0) |
, m_opaque(false) |
- , m_restrictions(NoRestrictions) |
, m_preload(MediaPlayer::Auto) |
, m_displayMode(Unknown) |
, m_cachedTime(MediaPlayer::invalidTime()) |
@@ -284,6 +283,7 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document& docum |
, m_fragmentStartTime(MediaPlayer::invalidTime()) |
, m_fragmentEndTime(MediaPlayer::invalidTime()) |
, m_pendingActionFlags(0) |
+ , m_userGestureRequiredForPlay(false) |
, m_playing(false) |
, m_shouldDelayLoadEvent(false) |
, m_haveFiredLoadedData(false) |
@@ -314,10 +314,8 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document& docum |
WTF_LOG(Media, "HTMLMediaElement::HTMLMediaElement"); |
ScriptWrappable::init(this); |
- if (document.settings()) { |
- if (document.settings()->mediaPlaybackRequiresUserGesture()) |
- addBehaviorRestriction(RequireUserGestureForPlayRestriction); |
- } |
+ if (document.settings() && document.settings()->mediaPlaybackRequiresUserGesture()) |
+ m_userGestureRequiredForPlay = true; |
// We must always have a ShadowRoot so children like <source> will not render |
// as they never have an insertion point. |
@@ -621,7 +619,7 @@ void HTMLMediaElement::load() |
WTF_LOG(Media, "HTMLMediaElement::load()"); |
if (UserGestureIndicator::processingUserGesture()) |
- removeBehaviorsRestrictionsAfterFirstUserGesture(); |
+ m_userGestureRequiredForPlay = false; |
prepareForLoad(); |
loadInternal(); |
@@ -858,7 +856,7 @@ void HTMLMediaElement::loadResource(const KURL& url, ContentType& contentType, c |
if (url.protocolIs(mediaSourceBlobProtocol)) { |
if (isMediaStreamURL(url.string())) { |
loadType = blink::WebMediaPlayer::LoadTypeMediaStream; |
- removeBehaviorRestriction(RequireUserGestureForPlayRestriction); |
+ m_userGestureRequiredForPlay = false; |
} else { |
m_mediaSource = HTMLMediaSource::lookup(url.string()); |
@@ -1608,7 +1606,7 @@ void HTMLMediaElement::setReadyState(MediaPlayer::ReadyState state) |
scheduleEvent(EventTypeNames::playing); |
} |
- if (m_autoplaying && m_paused && autoplay() && !document().isSandboxed(SandboxAutomaticFeatures) && !userGestureRequiredForPlay()) { |
+ if (m_autoplaying && m_paused && autoplay() && !document().isSandboxed(SandboxAutomaticFeatures) && !m_userGestureRequiredForPlay) { |
m_paused = false; |
invalidateCachedTime(); |
scheduleEvent(EventTypeNames::play); |
@@ -2126,10 +2124,10 @@ void HTMLMediaElement::play() |
{ |
WTF_LOG(Media, "HTMLMediaElement::play()"); |
- if (userGestureRequiredForPlay() && !UserGestureIndicator::processingUserGesture()) |
+ if (m_userGestureRequiredForPlay && !UserGestureIndicator::processingUserGesture()) |
return; |
if (UserGestureIndicator::processingUserGesture()) |
- removeBehaviorsRestrictionsAfterFirstUserGesture(); |
+ m_userGestureRequiredForPlay = false; |
playInternal(); |
} |
@@ -3873,11 +3871,6 @@ MediaPlayerClient::CORSMode HTMLMediaElement::mediaPlayerCORSMode() const |
return Anonymous; |
} |
-void HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture() |
-{ |
- m_restrictions = NoRestrictions; |
-} |
- |
void HTMLMediaElement::mediaPlayerSetWebLayer(blink::WebLayer* webLayer) |
{ |
if (webLayer == m_webLayer) |