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

Unified Diff: third_party/WebKit/Source/web/FrameLoaderClientImpl.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/FrameLoaderClientImpl.cpp
diff --git a/third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp b/third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp
index db1de678cac7e8bda77e43567030f9960c02da88..5a035b76475f40acf9b3a30ce9cf5a35532752a3 100644
--- a/third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp
+++ b/third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp
@@ -787,9 +787,26 @@ 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();
foolip 2016/10/11 09:37:13 Does the case where the media element itself is th
xjz 2016/10/11 19:27:25 It's currently handled same for Media Remoting.
foolip 2016/10/12 11:51:42 Yes, but wouldn't it be covered by any heuristic u
xjz 2016/10/12 17:40:57 The heuristic used for when the fullscreen element
+ } else if (fullscreenElement->contains(&htmlMediaElement) &&
+ htmlMediaElement.clientWidth() >=
+ htmlMediaElement.document().domWindow()->innerWidth() * 0.9 &&
foolip 2016/10/11 09:37:13 This check could pass for two videos where one obs
xjz 2016/10/11 19:27:26 Yes, it could be. I think this case is not common
+ htmlMediaElement.clientHeight() >=
+ htmlMediaElement.document().domWindow()->innerHeight() * 0.9) {
+ mediaPlayer->enterFullWindow();
+ }
+
+ return mediaPlayer;
}
ObjectContentType FrameLoaderClientImpl::getObjectContentType(

Powered by Google App Engine
This is Rietveld 408576698