Commit 9111d612 authored by Mounir Lamouri's avatar Mounir Lamouri Committed by Commit Bot

Picture-in-Picture: check if we have a layer when hiding the interstitial.

When the player is destroyed, it notifies the element which then hides
the interstitial. In a regular scenario, when the interstitial is hidden,
the layer on the page should be visible again. However, when the player
is destroyed, there is no more layer.

Bug: 838147
Change-Id: I1d3a8970246d8f867fecd7ed7a5a1d9f371f7e5c
Reviewed-on: https://chromium-review.googlesource.com/1035262Reviewed-by: default avatarapacible <apacible@chromium.org>
Commit-Queue: Mounir Lamouri <mlamouri@chromium.org>
Cr-Commit-Position: refs/heads/master@{#554798}
parent f0ff5355
<!DOCTYPE html>
<title>No crash when resetting player during PIP</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<video></video>
<script>
async_test(t => {
if (!document.pictureInPictureEnabled)
t.done();
const video = document.querySelector('video');
video.src = '../content/test.ogv';
video.addEventListener('click', t.step_func(() => {
video.requestPictureInPicture().then(t.step_func_done(() => {
video.src = '';
// Do not crash.
}));
}), { once: true });
video.play().then(t.step_func(() => {
const bounds = video.getBoundingClientRect();
chrome.gpuBenchmarking.pointerActionSequence([{
source: 'mouse',
actions: [
{ name: 'pointerDown',
x: bounds.left + bounds.width / 2,
y: bounds.top + bounds.height / 2
},
{ name: 'pointerUp' }
]
}]);
}));
});
</script>
......@@ -78,8 +78,8 @@ void PictureInPictureInterstitial::Hide() {
interstitial_timer_.StartOneShot(kPictureInPictureHiddenAnimationSeconds,
FROM_HERE);
DCHECK(GetVideoElement().PlatformLayer());
GetVideoElement().PlatformLayer()->SetDrawsContent(true);
if (GetVideoElement().PlatformLayer())
GetVideoElement().PlatformLayer()->SetDrawsContent(true);
}
void PictureInPictureInterstitial::ToggleInterstitialTimerFired(TimerBase*) {
......
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