Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1018)

Unified Diff: Source/core/html/HTMLMediaElement.cpp

Issue 177123006: Reduce HTMLMediaElement BehaviorRestrictions to a single state bit (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/HTMLMediaElement.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « Source/core/html/HTMLMediaElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698