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

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

Issue 2411553003: Notify WebMediaPlayer when its ancestor enters/exists fullscreen. (Closed)
Patch Set: Rebased. Add FullscreenObserver. 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/FrameLoaderClientImpl.cpp
diff --git a/third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp b/third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp
index db1de678cac7e8bda77e43567030f9960c02da88..463f2280aaf5ebe4293f79b581b30f4112df2ee6 100644
--- a/third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp
+++ b/third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp
@@ -787,9 +787,28 @@ std::unique_ptr<WebMediaPlayer> FrameLoaderClientImpl::createWebMediaPlayer(
HTMLMediaElementEncryptedMedia& encryptedMedia =
HTMLMediaElementEncryptedMedia::from(htmlMediaElement);
WebString sinkId(HTMLMediaElementAudioOutputDevice::sinkId(htmlMediaElement));
- return wrapUnique(webFrame->client()->createMediaPlayer(
- source, client, &encryptedMedia, encryptedMedia.contentDecryptionModule(),
- sinkId));
+ std::unique_ptr<WebMediaPlayer> mediaPlayer =
+ wrapUnique(webFrame->client()->createMediaPlayer(
+ source, client, &encryptedMedia,
+ encryptedMedia.contentDecryptionModule(), sinkId));
+
+ // Notify WebMediaPlayer: if the current media is active fullscreen element;
+ // or is a descendant of the fullscreen element and covers most of the window.
+ Element* fullscreenElement =
+ Fullscreen::currentFullScreenElementFrom(htmlMediaElement.document());
+ if (fullscreenElement == htmlMediaElement) {
+ mediaPlayer->enteredFullscreen();
+ } else if (fullscreenElement &&
+ fullscreenElement->isShadowIncludingInclusiveAncestorOf(
+ &htmlMediaElement) &&
+ htmlMediaElement.clientWidth() >=
+ htmlMediaElement.document().domWindow()->innerWidth() * 0.9 &&
+ htmlMediaElement.clientHeight() >=
+ htmlMediaElement.document().domWindow()->innerHeight() * 0.9) {
+ mediaPlayer->enteredFullWindow();
+ }
+
+ return mediaPlayer;
}
ObjectContentType FrameLoaderClientImpl::getObjectContentType(
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLMediaElement.cpp ('k') | third_party/WebKit/public/platform/WebMediaPlayer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698