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

Side by Side Diff: LayoutTests/media/track/cue-style-invalidation.html

Issue 684993007: Support style invalidation for ::cue selectors. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Sort alphabetically Created 6 years, 1 month 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 video::cue(c),
8 video::cue(i:past),
9 video::cue(.b:future) { background-color: red }
10
11 .cue video::cue,
12 .cuefunc video::cue(c),
13 .past video::cue(i:past),
14 .future video::cue(.b:future) { background-color: green }
15
16 // This selector would have triggered sibling subtree recalc if we didn't
17 // support descendant invalidation for ::cue/::cue().
18 #ascendant + div { color: pink }
19 </style>
20 <script>
21 function seeked() {
22 var red = "rgb(255, 0, 0)";
23 var green = "rgb(0, 128, 0)";
24
25 cueNode = textTrackDisplayElement(video, "cue");
26 iNode = cueNode.firstElementChild;
27 cNode = iNode.nextSibling.nextSibling;
28 bNode = cNode.nextSibling.nextSibling;
29
30 testExpected("getComputedStyle(cueNode).backgroundColor", red);
31 ascendant.offsetTop;
32 ascendant.classList.add("cue");
33 if (window.internals)
34 testExpected("internals.updateStyleAndReturnAffectedElementCount()", 9);
35 testExpected("getComputedStyle(cueNode).backgroundColor", green);
36
37 testExpected("getComputedStyle(cNode).backgroundColor", red);
38 ascendant.offsetTop;
39 ascendant.classList.add("cuefunc");
40 if (window.internals)
41 testExpected("internals.updateStyleAndReturnAffectedElementCount()", 2);
42 testExpected("getComputedStyle(cNode).backgroundColor", green);
43
44 testExpected("getComputedStyle(iNode).backgroundColor", red);
45 ascendant.offsetTop;
46 ascendant.classList.add("past");
47 if (window.internals)
48 testExpected("internals.updateStyleAndReturnAffectedElementCount()", 2);
49 testExpected("getComputedStyle(iNode).backgroundColor", green);
50
51 testExpected("getComputedStyle(bNode).backgroundColor", red);
52 ascendant.offsetTop;
53 ascendant.classList.add("future");
54 if (window.internals)
55 testExpected("internals.updateStyleAndReturnAffectedElementCount()", 2);
56 testExpected("getComputedStyle(bNode).backgroundColor", green);
57
58 endTest();
59 }
60
61 window.onload = function() {
62 consoleWrite("Check that descendant style invalidation works with ::cue sele ctors.");
63 findMediaElement();
64 video.src = findMediaFile("video", "../content/test");
65 waitForEvent("seeked", seeked);
66 waitForEvent("canplaythrough", function() { video.currentTime = 0.1; });
67 };
68 </script>
69 <div id="ascendant">
70 <video>
71 <track src="captions-webvtt/invalidation.vtt" kind="captions" default>
72 </video>
73 <div></div>
74 <div></div>
75 </div>
76 <div>
77 <div></div>
78 </div>
OLDNEW
« no previous file with comments | « LayoutTests/media/track/captions-webvtt/invalidation.vtt ('k') | LayoutTests/media/track/cue-style-invalidation-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698