Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(530)

Side by Side Diff: third_party/WebKit/LayoutTests/media/track/track-cue-rendering.html

Issue 2803243002: Use a ResizeObserver to determine default font-size for text tracks (Closed)
Patch Set: Rebase Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/HTMLMediaElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <title>Test that default positioned TextTrack's cues are rendered correctly.</ti tle> 2 <title>Test that default positioned TextTrack's cues are rendered correctly.</ti tle>
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 <script src="../../resources/run-after-layout-and-paint.js"></script>
7 <video> 8 <video>
8 <track src="captions-webvtt/captions.vtt" kind="captions" default> 9 <track src="captions-webvtt/captions.vtt" kind="captions" default>
9 </video> 10 </video>
10 <script> 11 <script>
11 async_test(function(t) { 12 async_test(function(t) {
12 var video = document.querySelector("video"); 13 var video = document.querySelector("video");
13 var testTrack = document.querySelector("track"); 14 var testTrack = document.querySelector("track");
14 video.src = findMediaFile("video", "../content/test"); 15 video.src = findMediaFile("video", "../content/test");
15 16
16 var cueTextIndex = 0; 17 var cueTextIndex = 0;
17 var cueText = [ "Lorem", "ipsum", "dolor", "sit" ]; 18 var cueText = [ "Lorem", "ipsum", "dolor", "sit" ];
18 video.onseeked = t.step_func(function() { 19 video.onseeked = t.step_func(function() {
19 assert_equals(video.currentTime, cueTextIndex + 0.5); 20 assert_equals(video.currentTime, cueTextIndex + 0.5);
20 assert_equals(testTrack.track.activeCues.length, 1); 21 assert_equals(testTrack.track.activeCues.length, 1);
21 assert_equals(testTrack.track.activeCues[0].text, cueText[cueTextIndex]) ; 22 assert_equals(testTrack.track.activeCues[0].text, cueText[cueTextIndex]) ;
22 23
23 var testCueDisplayBox = textTrackDisplayElement(video); 24 var testCueDisplayBox = textTrackDisplayElement(video);
24 assert_equals(testCueDisplayBox.innerText, cueText[cueTextIndex]); 25 assert_equals(testCueDisplayBox.innerText, cueText[cueTextIndex]);
25 assert_equals(2 * testCueDisplayBox.offsetLeft, video.videoWidth - testC ueDisplayBox.offsetWidth) 26 assert_equals(2 * testCueDisplayBox.offsetLeft, video.videoWidth - testC ueDisplayBox.offsetWidth)
26 27
27 if (++cueTextIndex == cueText.length) { 28 if (++cueTextIndex == cueText.length) {
28 // Test the cue display colors and font. 29 // Test the cue display colors and font.
29 testFontSize(320, 240); 30 testFontSize([[2560, 1440], [1280, 960], [640, 480], [320, 240]]);
30 testFontSize(640, 480);
31 testFontSize(1280, 960);
32 testFontSize(2560, 1440);
33
34 assert_equals(getComputedStyle(textTrackContainerElement(video)).fon tFamily, "sans-serif");
35 assert_equals(getComputedStyle(textTrackContainerElement(video)).col or, "rgb(255, 255, 255)");
36 assert_equals(getComputedStyle(textTrackDisplayElement(video).firstC hild).backgroundColor, "rgba(0, 0, 0, 0.8)");
37
38 t.done();
39 } else { 31 } else {
40 video.currentTime += 1; 32 video.currentTime += 1;
41 } 33 }
42 }); 34 });
43 35
44 function testFontSize(width, height) { 36 function testFontSize(subjects) {
45 video.width = width; 37 var dimensions = subjects.shift();
46 video.height = height; 38 video.width = dimensions[0];
47 // Force a relayout of the document 39 video.height = dimensions[1];
48 document.body.offsetTop; 40 runAfterLayoutAndPaint(t.step_func(function() {
49 assert_equals(getComputedStyle(textTrackContainerElement(video)).fontSiz e, parseInt(height * 0.05) + "px"); 41 assert_equals(getComputedStyle(textTrackContainerElement(video)).fon tSize, parseInt(video.height * 0.05) + "px");
42 if (subjects.length) {
43 testFontSize(subjects);
44 } else {
45 assert_equals(getComputedStyle(textTrackContainerElement(video)) .fontFamily, "sans-serif");
46 assert_equals(getComputedStyle(textTrackContainerElement(video)) .color, "rgb(255, 255, 255)");
47 assert_equals(getComputedStyle(textTrackDisplayElement(video).fi rstChild).backgroundColor, "rgba(0, 0, 0, 0.8)");
48
49 t.done();
50 }
51 }));
50 } 52 }
51 53
52 video.currentTime = 0.5; 54 video.currentTime = 0.5;
53 }); 55 });
54 </script> 56 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/HTMLMediaElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698