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

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

Issue 2411553003: Notify WebMediaPlayer when its ancestor enters/exists fullscreen. (Closed)
Patch Set: Created 4 years, 2 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: 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 cb8efeffd7bb3e843c17fa3f5debc2591e0afc5f..68029b4b7001860d8ad47a61406781f784d91805 100644
--- a/third_party/WebKit/Source/web/FullscreenController.cpp
+++ b/third_party/WebKit/Source/web/FullscreenController.cpp
@@ -31,6 +31,7 @@
#include "web/FullscreenController.h"
#include "core/dom/Document.h"
+#include "core/dom/ElementTraversal.h"
#include "core/dom/Fullscreen.h"
#include "core/frame/FrameView.h"
#include "core/frame/LocalFrame.h"
@@ -86,6 +87,18 @@ void FullscreenController::didEnterFullscreen() {
if (videoElement->usesOverlayFullscreenVideo() &&
m_webViewImpl->layerTreeView())
m_webViewImpl->layerTreeView()->setHasTransparentBackground(true);
+ } else {
+ for (HTMLVideoElement& videoElement :
+ Traversal<HTMLVideoElement>::descendantsOf(*element)) {
esprehn 2016/10/11 21:40:04 I still don't think we should land this. It requir
+ if (videoElement.webMediaPlayer() &&
+ videoElement.clientWidth() >=
+ videoElement.document().domWindow()->innerWidth() * 0.9 &&
+ videoElement.clientHeight() >=
+ videoElement.document().domWindow()->innerHeight() * 0.9) {
+ videoElement.webMediaPlayer()->enterFullWindow();
+ break;
+ }
+ }
}
}
@@ -120,6 +133,15 @@ void FullscreenController::didExitFullscreen() {
m_needsScrollAndScaleRestore = true;
fullscreen->didExitFullscreen();
+
+ for (HTMLVideoElement& videoElement :
+ Traversal<HTMLVideoElement>::descendantsOf(*element)) {
+ if (videoElement.webMediaPlayer() &&
+ videoElement.webMediaPlayer()->isFullWindow()) {
+ videoElement.webMediaPlayer()->exitFullWindow();
foolip 2016/10/11 09:37:13 Test and comment somewhere on what happens if the
xjz 2016/10/11 19:27:26 The WebMediaPlayer get destroyed and the romoting
+ break;
+ }
+ }
}
}
}

Powered by Google App Engine
This is Rietveld 408576698