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

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: Address Xianzhu'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
« 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 63eda2639e62a01ca9a5fd97b8bdfc5a2bd153f8..a2926deb6a3b0153ff297bdc134593e948f116c0 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"
@@ -361,6 +362,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)
@@ -1049,8 +1051,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()
@@ -3199,7 +3203,9 @@ void HTMLMediaElement::didBecomeFullscreenElement()
{
if (mediaControls())
mediaControls()->enteredFullscreen();
- if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && isHTMLVideoElement())
+ // Cache this in case the player is destroyed before leaving fullscreen.
+ m_inOverlayFullscreenVideo = usesOverlayFullscreenVideo();
+ if (m_inOverlayFullscreenVideo)
document().layoutView()->compositor()->setNeedsCompositingUpdate(CompositingUpdateRebuildTree);
}
@@ -3207,8 +3213,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
« 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