Chromium Code Reviews| 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(); |
| } |
| } |