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

Unified Diff: third_party/WebKit/Source/web/FullscreenController.cpp

Issue 2204673004: WIP - WebMediaPlayer switch media renderer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move the notification to FullscreenController. Created 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/FullscreenController.cpp
diff --git a/third_party/WebKit/Source/web/FullscreenController.cpp b/third_party/WebKit/Source/web/FullscreenController.cpp
index 1d0f0fcc1cfe818faf7921877ab15ccf4eba3ca6..ee1303bebd4256fed53f0ae8c8c1eb773633eccc 100644
--- a/third_party/WebKit/Source/web/FullscreenController.cpp
+++ b/third_party/WebKit/Source/web/FullscreenController.cpp
@@ -37,9 +37,11 @@
#include "core/frame/PageScaleConstraintsSet.h"
#include "core/html/HTMLMediaElement.h"
#include "core/html/HTMLVideoElement.h"
+#include "platform/LayoutTestSupport.h"
#include "platform/RuntimeEnabledFeatures.h"
#include "public/platform/WebLayerTreeView.h"
#include "public/web/WebFrameClient.h"
+#include "third_party/WebKit/Source/core/dom/TagCollection.h"
#include "web/WebLocalFrameImpl.h"
#include "web/WebSettingsImpl.h"
#include "web/WebViewImpl.h"
@@ -84,6 +86,21 @@ void FullscreenController::didEnterFullscreen()
Fullscreen::from(document).didEnterFullscreenForElement(element);
DCHECK_EQ(Fullscreen::currentFullScreenElementFrom(document), element);
+ // Notify WebMediaPlayer when video enters full screen, and the full screen
+ // element is not a HTMLMediaElement.
+ if (!isHTMLMediaElement(element)) {
liberato (no reviews please) 2016/08/03 21:54:17 could early-out on isRunningLayoutTest here, rathe
xjz 2016/08/04 02:28:15 Done with the helper. Yes, it could have multiple
+ TagCollection* collection = element->getElementsByTagName("video");
+ for (unsigned i = 0; i < collection->length(); ++i) {
+ Element* collectElement = collection->item(i);
+ if (isHTMLMediaElement(collectElement)) {
liberato (no reviews please) 2016/08/03 21:54:17 if (!is)... continue; will save {} nesting.
xjz 2016/08/04 02:28:15 Done.
+ HTMLMediaElement* videoElement = toHTMLMediaElement(collectElement);
+ if (videoElement->webMediaPlayer()
+ && !LayoutTestSupport::isRunningLayoutTest())
+ videoElement->webMediaPlayer()->enteredFullscreen();
liberato (no reviews please) 2016/08/03 21:54:17 entered/exitedFullscreen shouldn't be called for a
xjz 2016/08/04 02:28:16 I agree. Now add WebMediaPlayer::updateMediaInFull
+ }
+ }
+ }
+
if (isHTMLVideoElement(element)) {
HTMLVideoElement* videoElement = toHTMLVideoElement(element);
if (videoElement->usesOverlayFullscreenVideo() && m_webViewImpl->layerTreeView())
@@ -119,6 +136,20 @@ void FullscreenController::didExitFullscreen()
if (m_haveEnteredFullscreen)
m_needsScrollAndScaleRestore = true;
+ // Notify WebMediaPlayer when video exits full screen, and the
+ // full screen element is not a HTMLMediaElement.
+ if (!isHTMLMediaElement(element)) {
+ TagCollection* collection = element->getElementsByTagName("video");
+ for (unsigned i = 0; i < collection->length(); ++i) {
+ Element* collectElement = collection->item(i);
+ if (isHTMLMediaElement(collectElement)) {
+ HTMLMediaElement* videoElement = toHTMLMediaElement(collectElement);
+ if (videoElement->webMediaPlayer())
+ videoElement->webMediaPlayer()->exitedFullscreen();
+ }
+ }
+ }
+
fullscreen->didExitFullscreen();
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698