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..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(); |
| } |
| } |