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

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

Issue 191273002: Revert "Remove the HTMLVideoElement-specific prefixed fullscreen API" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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') | Source/core/html/HTMLVideoElement.h » ('j') | 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 026d69d245791efb86d1062b9b882bd5d27e650f..dd44c288d85888ba86b29eeaa3d14cdf967b0f30 100644
--- a/Source/core/html/HTMLMediaElement.cpp
+++ b/Source/core/html/HTMLMediaElement.cpp
@@ -250,6 +250,7 @@ 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())
@@ -258,7 +259,6 @@ 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)
@@ -288,8 +288,12 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document& docum
WTF_LOG(Media, "HTMLMediaElement::HTMLMediaElement");
ScriptWrappable::init(this);
- if (document.settings() && document.settings()->mediaPlaybackRequiresUserGesture())
- m_userGestureRequiredForPlay = true;
+ if (document.settings()) {
+ if (document.settings()->mediaPlaybackRequiresUserGesture())
+ addBehaviorRestriction(RequireUserGestureForPlayRestriction);
+ if (document.settings()->mediaFullscreenRequiresUserGesture())
+ addBehaviorRestriction(RequireUserGestureForFullscreenRestriction);
+ }
// We must always have a ShadowRoot so children like <source> will not render
// as they never have an insertion point.
@@ -594,7 +598,7 @@ void HTMLMediaElement::load()
WTF_LOG(Media, "HTMLMediaElement::load()");
if (UserGestureIndicator::processingUserGesture())
- m_userGestureRequiredForPlay = false;
+ removeBehaviorsRestrictionsAfterFirstUserGesture();
prepareForLoad();
loadInternal();
@@ -860,7 +864,7 @@ void HTMLMediaElement::loadResource(const KURL& url, ContentType& contentType, c
if (url.protocolIs(mediaSourceBlobProtocol)) {
if (isMediaStreamURL(url.string())) {
loadType = blink::WebMediaPlayer::LoadTypeMediaStream;
- m_userGestureRequiredForPlay = false;
+ removeBehaviorRestriction(RequireUserGestureForPlayRestriction);
} else {
m_mediaSource = HTMLMediaSource::lookup(url.string());
@@ -1616,7 +1620,7 @@ void HTMLMediaElement::setReadyState(MediaPlayer::ReadyState state)
scheduleEvent(EventTypeNames::playing);
}
- if (m_autoplaying && m_paused && autoplay() && !document().isSandboxed(SandboxAutomaticFeatures) && !m_userGestureRequiredForPlay) {
+ if (m_autoplaying && m_paused && autoplay() && !document().isSandboxed(SandboxAutomaticFeatures) && !userGestureRequiredForPlay()) {
m_paused = false;
invalidateCachedTime();
scheduleEvent(EventTypeNames::play);
@@ -1973,10 +1977,10 @@ void HTMLMediaElement::play()
{
WTF_LOG(Media, "HTMLMediaElement::play()");
- if (m_userGestureRequiredForPlay && !UserGestureIndicator::processingUserGesture())
+ if (userGestureRequiredForPlay() && !UserGestureIndicator::processingUserGesture())
return;
if (UserGestureIndicator::processingUserGesture())
- m_userGestureRequiredForPlay = false;
+ removeBehaviorsRestrictionsAfterFirstUserGesture();
playInternal();
}
@@ -3196,6 +3200,14 @@ void HTMLMediaElement::enterFullscreen()
FullscreenElementStack::from(document()).requestFullScreenForElement(this, 0, FullscreenElementStack::ExemptIFrameAllowFullScreenRequirement);
}
+void HTMLMediaElement::exitFullscreen()
+{
+ WTF_LOG(Media, "HTMLMediaElement::exitFullscreen");
+
+ if (document().settings() && document().settings()->fullScreenEnabled() && isFullscreen())
+ FullscreenElementStack::from(document()).webkitCancelFullScreen();
+}
+
void HTMLMediaElement::didBecomeFullscreenElement()
{
if (hasMediaControls())
@@ -3612,6 +3624,11 @@ 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') | Source/core/html/HTMLVideoElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698