summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/embedded-content/media-elements/track/track-element/track-cue-rendering-after-controls-removed.html
blob: 76019c9b41e4fd4c56f4252d399f088b7b3e4470 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<!DOCTYPE html>
<html class="reftest-wait">
<script src="/common/reftest-wait.js"></script>
<link rel="match" href="track-cue-rendering-after-controls-removed-ref.html">
<title>Text track cue layout after controls are removed</title>
<style>
::cue {
  font-size: 50px;
}
</style>
<video controls style="border:1px solid gray">
  <source src="/media/white.webm" type="video/webm">
  <source src="/media/white.mp4" type="video/mp4">
</video>
<script>
// Add a cue that will overlap with the video controls.
var video = document.querySelector("video");
var track = video.addTextTrack("captions");
track.addCue(new VTTCue(0, 1, "text"));
track.mode = "showing";

video.onloadeddata = function() {
  // Double nesting of requestAnimationFrame to
  // make sure cue layout and paint happens.
  window.requestAnimationFrame(function() {
    window.requestAnimationFrame(function() {
      // Remove the controls. The cue should not move.
      video.controls = false;
      takeScreenshot();
    });
  });
};
</script>
</html>