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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/media/track/cue-style-invalidation.html
diff --git a/LayoutTests/media/track/cue-style-invalidation.html b/LayoutTests/media/track/cue-style-invalidation.html
new file mode 100644
index 0000000000000000000000000000000000000000..3998324630178374959def92ef926db6a0d73c1a
--- /dev/null
+++ b/LayoutTests/media/track/cue-style-invalidation.html
@@ -0,0 +1,78 @@
+<!DOCTYPE html>
+<script src="../media-file.js"></script>
+<script src="../video-test.js"></script>
+<script src="../media-controls.js"></script>
+<style>
+video::cue,
+video::cue(c),
+video::cue(i:past),
+video::cue(.b:future) { background-color: red }
+
+.cue video::cue,
+.cuefunc video::cue(c),
+.past video::cue(i:past),
+.future video::cue(.b:future) { background-color: green }
+
+// This selector would have triggered sibling subtree recalc if we didn't
+// support descendant invalidation for ::cue/::cue().
+#ascendant + div { color: pink }
+</style>
+<script>
+function seeked() {
+ var red = "rgb(255, 0, 0)";
+ var green = "rgb(0, 128, 0)";
+
+ cueNode = textTrackDisplayElement(video, "cue");
+ iNode = cueNode.firstElementChild;
+ cNode = iNode.nextSibling.nextSibling;
+ bNode = cNode.nextSibling.nextSibling;
+
+ testExpected("getComputedStyle(cueNode).backgroundColor", red);
+ ascendant.offsetTop;
+ ascendant.classList.add("cue");
+ if (window.internals)
+ testExpected("internals.updateStyleAndReturnAffectedElementCount()", 9);
+ testExpected("getComputedStyle(cueNode).backgroundColor", green);
+
+ testExpected("getComputedStyle(cNode).backgroundColor", red);
+ ascendant.offsetTop;
+ ascendant.classList.add("cuefunc");
+ if (window.internals)
+ testExpected("internals.updateStyleAndReturnAffectedElementCount()", 2);
+ testExpected("getComputedStyle(cNode).backgroundColor", green);
+
+ testExpected("getComputedStyle(iNode).backgroundColor", red);
+ ascendant.offsetTop;
+ ascendant.classList.add("past");
+ if (window.internals)
+ testExpected("internals.updateStyleAndReturnAffectedElementCount()", 2);
+ testExpected("getComputedStyle(iNode).backgroundColor", green);
+
+ testExpected("getComputedStyle(bNode).backgroundColor", red);
+ ascendant.offsetTop;
+ ascendant.classList.add("future");
+ if (window.internals)
+ testExpected("internals.updateStyleAndReturnAffectedElementCount()", 2);
+ testExpected("getComputedStyle(bNode).backgroundColor", green);
+
+ endTest();
+}
+
+window.onload = function() {
+ consoleWrite("Check that descendant style invalidation works with ::cue selectors.");
+ findMediaElement();
+ video.src = findMediaFile("video", "../content/test");
+ waitForEvent("seeked", seeked);
+ waitForEvent("canplaythrough", function() { video.currentTime = 0.1; });
+};
+</script>
+<div id="ascendant">
+ <video>
+ <track src="captions-webvtt/invalidation.vtt" kind="captions" default>
+ </video>
+ <div></div>
+ <div></div>
+</div>
+<div>
+ <div></div>
+</div>
« 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