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

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

Issue 2235473002: Notify WebMediaPlayer when HTML video enters full screen. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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..3196aad11716794d969dab929d8d22a907cc89b3 100644
--- a/third_party/WebKit/Source/web/FullscreenController.cpp
+++ b/third_party/WebKit/Source/web/FullscreenController.cpp
@@ -40,6 +40,7 @@
#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"
@@ -60,6 +61,25 @@ FullscreenController::FullscreenController(WebViewImpl* webViewImpl)
{
}
+// Notify the current media element or all its child media elements when
+// the |element| enters/exits full screen.
+void FullscreenController::updateMediaInFullscreen(Element* element, bool isFullscreen)
+{
+ if (!element)
+ return;
+ if (isHTMLMediaElement(element)) {
+ toHTMLMediaElement(element)->updateMediaInFullscreen(isFullscreen);
+ } else {
+ TagCollection* collection = element->getElementsByTagName("video");
fs 2016/08/10 17:30:13 Drive-by: You should be able to do: for (HTMLVide
xjz 2016/08/10 21:33:29 Thanks for the review! I'll address it in the next
+ for (unsigned i = 0; i < collection->length(); ++i) {
+ Element* childElement = collection->item(i);
+ if (!isHTMLMediaElement(childElement))
+ continue;
+ toHTMLMediaElement(childElement)->updateMediaInFullscreen(isFullscreen);
+ }
+ }
+}
+
void FullscreenController::didEnterFullscreen()
{
if (!m_provisionalFullScreenElement)
@@ -84,6 +104,7 @@ void FullscreenController::didEnterFullscreen()
Fullscreen::from(document).didEnterFullscreenForElement(element);
DCHECK_EQ(Fullscreen::currentFullScreenElementFrom(document), element);
+ updateMediaInFullscreen(element, true);
if (isHTMLVideoElement(element)) {
HTMLVideoElement* videoElement = toHTMLVideoElement(element);
if (videoElement->usesOverlayFullscreenVideo() && m_webViewImpl->layerTreeView())
@@ -119,6 +140,7 @@ void FullscreenController::didExitFullscreen()
if (m_haveEnteredFullscreen)
m_needsScrollAndScaleRestore = true;
+ updateMediaInFullscreen(element, false);
fullscreen->didExitFullscreen();
}
}

Powered by Google App Engine
This is Rietveld 408576698