Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / css / invalidation / invalidation-set-not.html
blob145ecdc0d4b519a73d5f6c5c234e805af1fa97af
1 <!DOCTYPE html>
2 <script src="../../../resources/testharness.js"></script>
3 <script src="../../../resources/testharnessreport.js"></script>
4 <style>
5 #p1 :not(.t1),
6 #p2 :not(.t2) #r2,
7 #p3 :not(.t3) :not(.nomatch),
8 #p4 .t4 :not(.nomatch),
9 #p5 :-webkit-any(:not(.t5), #dummy) #r5,
10 #p6 .t6 #r6:not(.dummy),
11 #p7 + :not(.t7) + :not(.nomatch) #r7,
12 #p8 + .t8 ~ div :not(.nomatch) { background-color: rgb(0, 128, 0); }
13 </style>
14 <div id="p1">
15 <div id="t1" class="t1">
16 <div></div>
17 <div></div>
18 </div>
19 </div>
20 <div id="p2">
21 <div id="t2" class="t2">
22 <div></div>
23 <div id="r2"></div>
24 </div>
25 </div>
26 <div id="p3">
27 <div id="t3" class="t3">
28 <div></div>
29 <div id="r3"></div>
30 </div>
31 </div>
32 <div id="p4">
33 <div id="t4">
34 <div></div>
35 <div id="r4"></div>
36 </div>
37 </div>
38 <div id="p5">
39 <div id="t5" class="t5">
40 <div></div>
41 <div id="r5"></div>
42 </div>
43 </div>
44 <div id="p6">
45 <div id="t6">
46 <div></div>
47 <div id="r6"></div>
48 </div>
49 </div>
50 <div>
51 <div id="p7"></div>
52 <div id="t7" class="t7"></div>
53 <div>
54 <div></div>
55 <div id="r7"></div>
56 </div>
57 </div>
58 <div>
59 <div id="p8"></div>
60 <div id="t8"></div>
61 <div>
62 <div></div>
63 <div id="r8"></div>
64 </div>
65 <fieldset>
66 <div></div>
67 </fieldset>
68 </div>
70 <script>
71 document.body.offsetTop;
73 test(function() {
74 assert_true(!!window.internals, "This test only works with internals exposed present");
75 }, "internals are exposed");
77 test(function() {
78 assert_equals(getComputedStyle(t1).backgroundColor, "rgba(0, 0, 0, 0)", "Background color should initially be transparent");
80 t1.className = "";
81 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1, "Single element style recalc");
82 assert_equals(getComputedStyle(t1).backgroundColor, "rgb(0, 128, 0)", "Background color is green after class change");
83 }, "Negated class without combinators");
85 test(function() {
86 assert_equals(getComputedStyle(r2).backgroundColor, "rgba(0, 0, 0, 0)", "Background color should initially be transparent");
88 t2.className = "";
89 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1, "Recalc changed element and #r2");
90 assert_equals(getComputedStyle(r2).backgroundColor, "rgb(0, 128, 0)", "Background color is green after class change");
91 }, "Id descendant of negated class");
93 test(function() {
94 assert_equals(getComputedStyle(r3).backgroundColor, "rgba(0, 0, 0, 0)", "Background color should initially be transparent");
96 t3.className = "";
97 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 3, "Subtree style recalc");
98 assert_equals(getComputedStyle(r3).backgroundColor, "rgb(0, 128, 0)", "Background color is green after class change");
99 }, "Negated class descendant of negated class");
101 test(function() {
102 assert_equals(getComputedStyle(r4).backgroundColor, "rgba(0, 0, 0, 0)", "Background color should initially be transparent");
104 t4.className = "t4";
105 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 3, "Subtree style recalc");
106 assert_equals(getComputedStyle(r4).backgroundColor, "rgb(0, 128, 0)", "Background color is green after class change");
107 }, "Negated class descendant of class");
109 test(function() {
110 assert_equals(getComputedStyle(r5).backgroundColor, "rgba(0, 0, 0, 0)", "Background color should initially be transparent");
112 t5.className = "";
113 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1, "Recalc changed element and #r5");
114 assert_equals(getComputedStyle(r5).backgroundColor, "rgb(0, 128, 0)", "Background color is green after class change");
115 }, "Id descendant of negated class in :-webkit-any");
117 test(function() {
118 assert_equals(getComputedStyle(r6).backgroundColor, "rgba(0, 0, 0, 0)", "Background color should initially be transparent");
120 t6.className = "t6";
121 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1, "Recalc changed element and #r6");
122 assert_equals(getComputedStyle(r6).backgroundColor, "rgb(0, 128, 0)", "Background color is green after class change");
123 }, "Negated class with id descendant of class");
125 test(function() {
126 assert_equals(getComputedStyle(r7).backgroundColor, "rgba(0, 0, 0, 0)", "Background color should initially be transparent");
128 t7.className = "";
129 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 4, "Recalc changed element and #r7");
130 assert_equals(getComputedStyle(r7).backgroundColor, "rgb(0, 128, 0)", "Background color is green after class change");
131 }, "Id descendant of negated sibling class");
133 test(function() {
134 assert_equals(getComputedStyle(r8).backgroundColor, "rgba(0, 0, 0, 0)", "Background color should initially be transparent");
136 t8.className = "t8";
137 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 6, "Subtree style recalc");
138 assert_equals(getComputedStyle(r8).backgroundColor, "rgb(0, 128, 0)", "Background color is green after class change");
139 }, "Negated class descendant of sibling class");
141 </script>