Bug 1532692 - Clear poster attributes from videos that we're cloning to visually. r=jya

Differential Revision: https://phabricator.services.mozilla.com/D22631

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mike Conley 2019-03-08 16:46:44 +00:00
Родитель 54ccd86c68
Коммит 6200b046ce
4 изменённых файлов: 62 добавлений и 1 удалений

Просмотреть файл

@ -461,6 +461,13 @@ void HTMLVideoElement::CloneElementVisually(HTMLVideoElement& aTargetVideo,
EndCloningVisually(); EndCloningVisually();
} }
// If there's a poster set on the target video, clear it, otherwise
// it'll display over top of the cloned frames.
aTargetVideo.UnsetHTMLAttr(nsGkAtoms::poster, rv);
if (rv.Failed()) {
return;
}
if (!SetVisualCloneTarget(&aTargetVideo)) { if (!SetVisualCloneTarget(&aTargetVideo)) {
rv.Throw(NS_ERROR_FAILURE); rv.Throw(NS_ERROR_FAILURE);
return; return;

Просмотреть файл

@ -533,6 +533,7 @@ support-files =
parser.vtt parser.vtt
pixel_aspect_ratio.mp4 pixel_aspect_ratio.mp4
play_promise.js play_promise.js
poster-test.jpg
r11025_msadpcm_c1.wav r11025_msadpcm_c1.wav
r11025_msadpcm_c1.wav^headers^ r11025_msadpcm_c1.wav^headers^
r11025_s16_c1.wav r11025_s16_c1.wav
@ -1342,4 +1343,6 @@ tags = cloneelementvisually
[test_cloneElementVisually_no_suspend.html] [test_cloneElementVisually_no_suspend.html]
skip-if = toolkit == 'android' # Visually cloning is only supported on Desktop for now. skip-if = toolkit == 'android' # Visually cloning is only supported on Desktop for now.
tags = cloneelementvisually tags = cloneelementvisually
[test_cloneElementVisually_poster.html]
skip-if = toolkit == 'android' # Visually cloning is only supported on Desktop for now.
tags = cloneelementvisually

Двоичные данные
dom/media/test/poster-test.jpg Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 57 KiB

Просмотреть файл

@ -0,0 +1,51 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Test cloneElementVisually</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="https://example.com:443/tests/dom/media/test/cloneElementVisually_helpers.js"></script>
<script src="/tests/SimpleTest/AddTask.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
</head>
<body>
<div id="content">
<h1>Original</h1>
<video id="original"></video>
<h1>Clone</h1>
</div>
<div id="results">
<h1>Results</h1>
<canvas id="left"></canvas>
<canvas id="right"></canvas>
</div>
<script type="application/javascript">
/**
* Test that when we start cloning a paused video, the clone displays
* the first paused frame.
*/
add_task(async () => {
await setup();
let originalVideo = document.getElementById("original");
const POSTER_URL = "https://example.com:443/tests/dom/media/test/poster-test.jpg";
originalVideo.setAttribute("poster", POSTER_URL);
await withNewClone(originalVideo, async clone => {
SpecialPowers.wrap(originalVideo).cloneElementVisually(clone);
await originalVideo.play();
await waitForEventOnce(originalVideo, "timeupdate");
originalVideo.pause();
await waitForEventOnce(originalVideo, "pause");
ok(await assertVideosMatch(originalVideo, clone),
"Video with a poster should clone properly.");
});
});
</script>
</body>
</html>