Commit 72c31415 authored by Jennifer Apacible's avatar Jennifer Apacible Committed by Commit Bot

[Picture in Picture] Avoid "disable rendering" optimisation in PiP mode.

WebContents activates the "disable rendering" optimisation when the
WebContents is hidden. This means that when a video is playing in
Picture-in-Picture, then the WebContents is hidden, the video will stop
playing in the Picture-in-Picture window.

Similarly to content capturing (e.g. mirroring / tab capture), this
optimisation should not be activated when in Picture-in-Picture mode.

This will only affect one tab at a time, as users cannot enter
Picture-in-Picture mode from multiple tabs.

Bug: 848812
Change-Id: I98a0e769ad4c412ea50db4de2ab63e64f3b752f2
Reviewed-on: https://chromium-review.googlesource.com/1105339Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Commit-Queue: apacible <apacible@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568496}
parent 1ec4e039
......@@ -1640,9 +1640,10 @@ void WebContentsImpl::WasShown() {
}
void WebContentsImpl::WasHidden() {
// If there are entities capturing screenshots or video (e.g., mirroring),
// don't activate the "disable rendering" optimization.
if (!IsBeingCaptured()) {
// If there are entities capturing screenshots or video (e.g. mirroring),
// or in Picture-in-Picture mode, don't activate the "disable rendering"
// optimization.
if (!IsBeingCaptured() && !HasPictureInPictureVideo()) {
// |GetRenderViewHost()| can be NULL if the user middle clicks a link to
// open a tab in the background, then closes the tab before selecting it.
// This is because closing the tab calls WebContentsImpl::Destroy(), which
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment