OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>Text track cue layout after controls are added</title> | 2 <title>Text track cue layout after controls are added</title> |
3 <style> | 3 <style> |
4 ::cue { | 4 ::cue { |
5 font-size: 50px; | 5 font-size: 50px; |
6 } | 6 } |
7 </style> | 7 </style> |
8 <video style="border:1px solid gray"> | 8 <!-- Width should be large enough to display all of the media controls. --> |
| 9 <video style="border:1px solid gray; width: 500px;"> |
9 <source src="opera/track/webvtt/rendering/reftest/media/white.webm" type="vide
o/webm"> | 10 <source src="opera/track/webvtt/rendering/reftest/media/white.webm" type="vide
o/webm"> |
10 <source src="opera/track/webvtt/rendering/reftest/media/white.mp4" type="video
/mp4"> | 11 <source src="opera/track/webvtt/rendering/reftest/media/white.mp4" type="video
/mp4"> |
11 </video> | 12 </video> |
12 <script> | 13 <script> |
13 // Without testRunner.layoutAndPaintAsyncThen there is no guarantee for when the
first | 14 // Without testRunner.layoutAndPaintAsyncThen there is no guarantee for when the
first |
14 // cue layout is done, so make no attempt to work without testRunner. | 15 // cue layout is done, so make no attempt to work without testRunner. |
15 testRunner.waitUntilDone(); | 16 testRunner.waitUntilDone(); |
16 | 17 |
17 // Add a cue that will overlap with the video controls. | 18 // Add a cue that will overlap with the video controls. |
18 var video = document.querySelector("video"); | 19 var video = document.querySelector("video"); |
19 var track = video.addTextTrack("captions"); | 20 var track = video.addTextTrack("captions"); |
20 track.addCue(new VTTCue(0, 1, "text")); | 21 track.addCue(new VTTCue(0, 1, "text")); |
21 track.mode = "showing"; | 22 track.mode = "showing"; |
22 | 23 |
23 video.onloadeddata = function() { | 24 video.onloadeddata = function() { |
24 testRunner.layoutAndPaintAsyncThen(function() { | 25 testRunner.layoutAndPaintAsyncThen(function() { |
25 // Add the controls. The cue should move to avoid overlap. Defer this | 26 // Add the controls. The cue should move to avoid overlap. Defer this |
26 // until the controls resize. | 27 // until the controls resize. |
27 video.controls = true; | 28 video.controls = true; |
28 // Wait for the relayout to happen. | 29 // Wait for the relayout to happen. |
29 window.requestAnimationFrame(function() { | 30 window.requestAnimationFrame(function() { |
30 testRunner.notifyDone(); | 31 testRunner.notifyDone(); |
31 }); | 32 }); |
32 }); | 33 }); |
33 }; | 34 }; |
34 </script> | 35 </script> |
OLD | NEW |