2 <script src=
"../../../resources/testharness.js"></script>
3 <script src=
"../../../resources/testharnessreport.js"></script>
9 .t5 :-webkit-any(div.ca.cb, *.cc.cd#r5b),
10 .t6 ~ div
> span.c#r6,
12 .t8 + * ~ div.c#p8 span,
14 .t10 + div
> :-webkit-any(div.ca.cb, *.cc.cd#r10b) { background-color: rgb(
0,
128,
0); }
21 <span class=
"c"></span>
22 <span class=
"c" id=
"r1"></span>
28 <span class=
"c"></span>
29 <span class=
"c" id=
"r2"></span>
37 <span class=
"c" id=
"r3"></span>
43 <span class=
"ca"></span>
44 <span class=
"cb"></span>
45 <span class=
"ca cb" id=
"r4"></span>
53 <fieldset class=
"ca"></fieldset>
54 <fieldset class=
"cc cd"></fieldset>
55 <div class=
"ca cb" id=
"r5a"></div>
56 <span class=
"cc cd" id=
"r5b"></span>
64 <span class=
"c"></span>
65 <span class=
"c" id=
"r6"></span>
73 <span class=
"c" id=
"r7"></span>
90 <div class=
"c" id=
"p8">
106 <span id=
"r9"></span>
114 <fieldset></fieldset>
115 <fieldset class=
"ca"></fieldset>
116 <fieldset class=
"cc cd"></fieldset>
117 <div class=
"ca cb" id=
"r10a"></div>
118 <span class=
"cc cd" id=
"r10b"></span>
123 document
.body
.offsetTop
;
126 assert_true(!!window
.internals
, "This test only works with internals exposed present");
127 }, "internals are exposed");
130 assert_equals(getComputedStyle(r1
).backgroundColor
, "rgba(0, 0, 0, 0)", "Background color should initially be transparent");
133 assert_equals(internals
.updateStyleAndReturnAffectedElementCount(), 4, "Subtree style recalc");
134 assert_equals(getComputedStyle(r1
).backgroundColor
, "rgb(0, 128, 0)", "Background color is green after class change");
135 }, "Descendant with compound selector containing id");
138 assert_equals(getComputedStyle(r2
).backgroundColor
, "rgba(0, 0, 0, 0)", "Background color should initially be transparent");
141 assert_equals(internals
.updateStyleAndReturnAffectedElementCount(), 2, "Subtree style recalc");
142 assert_equals(getComputedStyle(r2
).backgroundColor
, "rgb(0, 128, 0)", "Background color is green after class change");
143 }, "Descendant with compound selector containing universal and id");
146 assert_equals(getComputedStyle(r3
).backgroundColor
, "rgba(0, 0, 0, 0)", "Background color should initially be transparent");
149 assert_equals(internals
.updateStyleAndReturnAffectedElementCount(), 3, "Subtree style recalc");
150 assert_equals(getComputedStyle(r3
).backgroundColor
, "rgb(0, 128, 0)", "Background color is green after class change");
151 }, "Descendant with compound selector");
154 assert_equals(getComputedStyle(r4
).backgroundColor
, "rgba(0, 0, 0, 0)", "Background color should initially be transparent");
157 assert_equals(internals
.updateStyleAndReturnAffectedElementCount(), 3, "Subtree style recalc");
158 assert_equals(getComputedStyle(r4
).backgroundColor
, "rgb(0, 128, 0)", "Background color is green after class change");
159 }, "Descendant with compound selector containing universal");
162 assert_equals(getComputedStyle(r5a
).backgroundColor
, "rgba(0, 0, 0, 0)", "Background color a should initially be transparent");
163 assert_equals(getComputedStyle(r5b
).backgroundColor
, "rgba(0, 0, 0, 0)", "Background color b should initially be transparent");
166 assert_equals(internals
.updateStyleAndReturnAffectedElementCount(), 5, "Subtree style recalc");
167 assert_equals(getComputedStyle(r5a
).backgroundColor
, "rgb(0, 128, 0)", "Background color a is green after class change");
168 assert_equals(getComputedStyle(r5b
).backgroundColor
, "rgb(0, 128, 0)", "Background color b is green after class change");
169 }, "Descendant with :-webkit-any containing compound selector");
172 assert_equals(getComputedStyle(r6
).backgroundColor
, "rgba(0, 0, 0, 0)", "Background color should initially be transparent");
175 assert_equals(internals
.updateStyleAndReturnAffectedElementCount(), 6, "Subtree style recalc");
176 assert_equals(getComputedStyle(r6
).backgroundColor
, "rgb(0, 128, 0)", "Background color is green after class change");
177 }, "Sibling with compound descendant containing id");
180 assert_equals(getComputedStyle(r7
).backgroundColor
, "rgba(0, 0, 0, 0)", "Background color should initially be transparent");
183 assert_equals(internals
.updateStyleAndReturnAffectedElementCount(), 1, "Subtree style recalc");
184 // TODO(ericwilligers): Update Blink's implementation of sibling selector invalidation, so the following passes:
185 assert_equals(getComputedStyle(r7
).backgroundColor
, "rgb(0, 128, 0)", "Background color is green after class change");
186 }, "Sibling with compound descendant");
189 assert_equals(getComputedStyle(r8
).backgroundColor
, "rgba(0, 0, 0, 0)", "Background color should initially be transparent");
192 assert_equals(internals
.updateStyleAndReturnAffectedElementCount(), 11, "Subtree style recalc");
193 assert_equals(getComputedStyle(r8
).backgroundColor
, "rgb(0, 128, 0)", "Background color is green after class change");
194 }, "Compound sibling selector containing id");
197 assert_equals(getComputedStyle(r9
).backgroundColor
, "rgba(0, 0, 0, 0)", "Background color should initially be transparent");
200 assert_equals(internals
.updateStyleAndReturnAffectedElementCount(), 9, "Subtree style recalc");
201 assert_equals(getComputedStyle(r9
).backgroundColor
, "rgb(0, 128, 0)", "Background color is green after class change");
202 }, "Compound sibling selector");
205 assert_equals(getComputedStyle(r10a
).backgroundColor
, "rgba(0, 0, 0, 0)", "Background color a should initially be transparent");
206 assert_equals(getComputedStyle(r10b
).backgroundColor
, "rgba(0, 0, 0, 0)", "Background color b should initially be transparent");
208 t10
.className
= "t10";
209 assert_equals(internals
.updateStyleAndReturnAffectedElementCount(), 9, "Subtree style recalc");
210 assert_equals(getComputedStyle(r10a
).backgroundColor
, "rgb(0, 128, 0)", "Background color a is green after class change");
211 assert_equals(getComputedStyle(r10b
).backgroundColor
, "rgb(0, 128, 0)", "Background color b is green after class change");
212 }, "Sibling with descendant :-webkit-any containing compound selector");