OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>Test that ::cue pseudo-element properties are applied to WebVTT node obje
cts only.</title> | 2 <title>Test that ::cue pseudo-element properties are applied to WebVTT node obje
cts only.</title> |
3 <script src="../media-file.js"></script> | 3 <script src="../media-file.js"></script> |
4 <script src="../media-controls.js"></script> | 4 <script src="../media-controls.js"></script> |
5 <script src="../../resources/testharness.js"></script> | 5 <script src="../../resources/testharness.js"></script> |
6 <script src="../../resources/testharnessreport.js"></script> | 6 <script src="../../resources/testharnessreport.js"></script> |
7 <style> | 7 <style> |
8 ::cue { word-spacing: 100px; } | 8 ::cue { word-spacing: 100px; } |
9 ::cue(c) { padding-left: 10px; color: red; } | 9 ::cue(c) { padding-left: 10px; color: red; } |
10 .cue { | 10 .cue { |
11 display: inline; | 11 display: inline; |
12 background-color: green; | 12 background-color: green; |
13 } | 13 } |
14 </style> | 14 </style> |
15 <video> | 15 <video> |
16 <track src="captions-webvtt/whitelist.vtt" kind="captions" default> | 16 <track src="captions-webvtt/whitelist.vtt" kind="captions" default> |
17 </video> | 17 </video> |
18 <div class="cue"></div> | 18 <div class="cue"></div> |
19 <script> | 19 <script> |
20 async_test(function(t) { | 20 async_test(function(t) { |
21 var video = document.querySelector("video"); | 21 var video = document.querySelector("video"); |
22 video.src = findMediaFile("video", "../content/test"); | 22 video.src = findMediaFile("video", "../content/test"); |
23 | 23 |
24 video.onseeked = t.step_func_done(function() { | 24 video.onseeked = t.step_func_done(function() { |
25 var cueNode = textTrackDisplayElement(video, "cue").firstElementChild; | 25 var cueNode = textTrackCueElementByIndex(video, 0).firstChild.firstEleme
ntChild; |
26 var cueStyle = getComputedStyle(cueNode); | 26 var cueStyle = getComputedStyle(cueNode); |
27 assert_equals(cueStyle.color, "rgb(255, 0, 0)"); | 27 assert_equals(cueStyle.color, "rgb(255, 0, 0)"); |
28 assert_equals(cueStyle.padding, "0px"); | 28 assert_equals(cueStyle.padding, "0px"); |
29 assert_equals(cueStyle.wordSpacing, "0px"); | 29 assert_equals(cueStyle.wordSpacing, "0px"); |
30 | 30 |
31 cueNode = cueNode.nextElementSibling; | 31 cueNode = cueNode.nextElementSibling; |
32 cueStyle = getComputedStyle(cueNode); | 32 cueStyle = getComputedStyle(cueNode); |
33 assert_equals(cueStyle.color, "rgb(255, 0, 0)"); | 33 assert_equals(cueStyle.color, "rgb(255, 0, 0)"); |
34 assert_equals(cueStyle.padding, "0px"); | 34 assert_equals(cueStyle.padding, "0px"); |
35 assert_equals(cueStyle.wordSpacing, "0px"); | 35 assert_equals(cueStyle.wordSpacing, "0px"); |
36 | 36 |
37 cueNode = cueNode.nextElementSibling; | 37 cueNode = cueNode.nextElementSibling; |
38 cueStyle = getComputedStyle(cueNode); | 38 cueStyle = getComputedStyle(cueNode); |
39 assert_equals(cueStyle.color, "rgb(255, 0, 0)"); | 39 assert_equals(cueStyle.color, "rgb(255, 0, 0)"); |
40 assert_equals(cueStyle.padding, "0px"); | 40 assert_equals(cueStyle.padding, "0px"); |
41 assert_equals(cueStyle.wordSpacing, "0px"); | 41 assert_equals(cueStyle.wordSpacing, "0px"); |
42 | 42 |
43 // Test that filtering doesn't apply to elements with class "cue" outsid
e WebVTT scope. | 43 // Test that filtering doesn't apply to elements with class "cue" outsid
e WebVTT scope. |
44 cueNode = document.getElementsByClassName("cue")[0]; | 44 cueNode = document.getElementsByClassName("cue")[0]; |
45 assert_equals(getComputedStyle(cueNode).display, "inline"); | 45 assert_equals(getComputedStyle(cueNode).display, "inline"); |
46 }); | 46 }); |
47 | 47 |
48 video.currentTime = 0.1; | 48 video.currentTime = 0.1; |
49 }); | 49 }); |
50 | 50 |
51 </script> | 51 </script> |
OLD | NEW |