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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/css/invalidation/nth-pseudo.html

Issue 2254443002: CL for perf tryjob on win (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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="../../../resources/testharness.js"></script>
3 <script src="../../../resources/testharnessreport.js"></script>
4 <style>
5 #t1 > span:nth-child(even) {
6 background-color: green
7 }
8 #t2 > span:nth-last-child(even) {
9 background-color: green
10 }
11 #t3 > .second:nth-child(2) {
12 background-color: green
13 }
14 </style>
15 <div id="t1">
16 <span></span>
17 </div>
18 <div id="t2">
19 <span></span>
20 </div>
21 <div id="t3">
22 <div class="second"></div>
23 <div></div>
24 <div></div>
25 <div></div>
26 </div>
27
28 <script>
29 function backgroundIsGreen(element) {
30 assert_equals(getComputedStyle(element).backgroundColor, "rgb(0, 128, 0) ");
31 }
32
33 function backgroundIsTransparent(element) {
34 assert_equals(getComputedStyle(element).backgroundColor, "rgba(0, 0, 0, 0)");
35 }
36
37 test(() => {
38 t1.offsetTop;
39 assert_equals(t1.lastChild.nodeType, Node.TEXT_NODE);
40 t1.insertBefore(document.createElement("span"), t1.lastChild);
41 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1);
42 }, "Appending an element sibling should not affect :nth-child of preceeding siblings.");
43
44 test(() => {
45 t2.offsetTop;
46 assert_equals(t2.firstChild.nodeType, Node.TEXT_NODE);
47 assert_equals(t2.firstChild.nextSibling.nodeType, Node.ELEMENT_NODE);
48 t2.insertBefore(document.createElement("span"), t2.firstChild.nextSiblin g);
49 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1);
50 }, "Prepending an element sibling should not affect :nth-last-child of succe eding siblings.");
51
52 test(() => {
53 t3.offsetTop;
54 let second = t3.querySelector(".second");
55 backgroundIsTransparent(second);
56 t3.insertBefore(document.createElement("div"), t3.firstChild);
57 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 2);
58 backgroundIsGreen(second);
59 }, "Prepending an element sibling causing :nth-child class invalidation.");
60
61 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698