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

Side by Side Diff: LayoutTests/media/track/track-css-reset-user-override-settings.html

Issue 921833003: Expose APIs for text track settings (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressed comments from fs and added a new test Created 5 years, 10 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
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src=../media-file.js></script>
3 <script src=../video-test.js></script>
4 <script src=../media-controls.js></script>
5 <style>
6 video::cue {
7 color: lime;
8 background-color: yellow;
9 text-shadow: 4px 4px #ff0000;
10 font-size: 10px;
11 font-family: serif;
12 font-style: normal;
13 font-variant: normal;
14 }
15 video::-webkit-media-text-track-display {
16 background-color: purple;
17 }
18 </style>
19 <script>
20
21 function userSettings() {
22 if (window.internals) {
23 internals.settings.setTextTrackTextColor("cyan");
24 internals.settings.setTextTrackBackgroundColor("green");
25 internals.settings.setTextTrackWindowColor("blue");
26 internals.settings.setTextTrackTextShadow("2px 2px #ff0000")
27 internals.settings.setTextTrackTextSize("14px");
28 internals.settings.setTextTrackFontFamily("fantasy");
29 internals.settings.setTextTrackFontStyle("italic");
30 internals.settings.setTextTrackFontVariant("small-caps");
31 }
32 }
33
34 function resetSettings() {
35 if (window.internals) {
36 internals.settings.setTextTrackTextColor("");
37 internals.settings.setTextTrackBackgroundColor("");
38 internals.settings.setTextTrackWindowColor("");
39 internals.settings.setTextTrackTextShadow("")
40 internals.settings.setTextTrackTextSize("");
41 internals.settings.setTextTrackFontFamily("");
42 internals.settings.setTextTrackFontStyle("");
43 internals.settings.setTextTrackFontVariant("");
44 }
45 }
46
47 function checkExpected() {
48 cue = textTrackDisplayElement(video, 'cue');
49 display = textTrackDisplayElement(video, 'display');
50 testExpected("getComputedStyle(cue).color", "rgb(0, 255, 0)");
51 testExpected("getComputedStyle(cue).backgroundColor", "rgb(255, 255, 0)" );
52 testExpected("getComputedStyle(display).backgroundColor", "rgb(128, 0, 1 28)");
53 testExpected("getComputedStyle(cue).textShadow", "rgb(255, 0, 0) 4px 4px 0px");
54 testExpected("getComputedStyle(cue).fontSize", "10px");
55 testExpected("getComputedStyle(cue).fontFamily", "serif");
56 testExpected("getComputedStyle(cue).fontStyle", "normal");
57 testExpected("getComputedStyle(cue).fontVariant", "normal");
58 endTest();
59 }
60
61 window.onload = function() {
62 userSettings();
63 // reset should make the text tracks use the settings specified in the s tylesheet
64 resetSettings();
65 consoleWrite("Test that WebVTT objects user override styles when reset, refer to css specified styles.");
66 findMediaElement();
67 video.src = findMediaFile('video', '../content/test');
68 waitForEvent('canplaythrough', checkExpected);
69 }
70
71 </script>
72 <video>
73 <track src="captions-webvtt/styling.vtt" kind="captions" default>
74 </video>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698