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

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

Issue 1254613003: Let the WebMediaPlayer decide whether to use overlay video. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: trchen@'s comments Created 5 years, 4 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
Index: Source/core/html/HTMLMediaElement.cpp
diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp
index 4d11d74ae9cdb586dc694f0494e14add9c3e61f5..5f6a15c00e73e077f13f0a549c147ef46f508d29 100644
--- a/Source/core/html/HTMLMediaElement.cpp
+++ b/Source/core/html/HTMLMediaElement.cpp
@@ -65,6 +65,7 @@
#include "core/layout/compositing/DeprecatedPaintLayerCompositor.h"
#include "core/loader/FrameLoader.h"
#include "core/loader/FrameLoaderClient.h"
+#include "core/page/ChromeClient.h"
#include "platform/ContentType.h"
#include "platform/Logging.h"
#include "platform/MIMETypeFromURL.h"
@@ -363,6 +364,7 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document& docum
, m_isFinalizing(false)
, m_initialPlayWithoutUserGestures(false)
, m_autoplayMediaCounted(false)
+ , m_inOverlayFullscreenVideo(false)
, m_audioTracks(AudioTrackList::create(*this))
, m_videoTracks(VideoTrackList::create(*this))
, m_textTracks(nullptr)
@@ -1051,8 +1053,10 @@ void HTMLMediaElement::startPlayerLoad()
m_webMediaPlayer->load(loadType(), kurl, corsMode());
- if (isFullscreen())
- m_webMediaPlayer->enterFullscreen();
+ if (isFullscreen()) {
+ // This handles any transition to or from fullscreen overlay mode.
+ document().frame()->chromeClient().enterFullScreenForElement(this);
+ }
}
void HTMLMediaElement::setPlayerPreload()
@@ -3201,7 +3205,8 @@ void HTMLMediaElement::didBecomeFullscreenElement()
{
if (mediaControls())
mediaControls()->enteredFullscreen();
- if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && isHTMLVideoElement())
+ // Cache this in case the player is destroyed before leaving fullscreen.
+ if ((m_inOverlayFullscreenVideo = useOverlayFullscreenVideo()))
Xianzhu 2015/08/03 22:39:02 Assignment in 'if' is error-prone. Please separate
watk 2015/08/03 23:36:48 Done.
document().layoutView()->compositor()->setNeedsCompositingUpdate(CompositingUpdateRebuildTree);
}
@@ -3209,8 +3214,9 @@ void HTMLMediaElement::willStopBeingFullscreenElement()
{
if (mediaControls())
mediaControls()->exitedFullscreen();
- if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && isHTMLVideoElement())
+ if (m_inOverlayFullscreenVideo)
document().layoutView()->compositor()->setNeedsCompositingUpdate(CompositingUpdateRebuildTree);
+ m_inOverlayFullscreenVideo = false;
}
WebLayer* HTMLMediaElement::platformLayer() const

Powered by Google App Engine
This is Rietveld 408576698