Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / fast / css / invalidation / empty-pseudo-sibling.html
1 <!DOCTYPE html>
2 <script src="../../../resources/js-test.js"></script>
3 <style>
4 :empty + div { background-color: green }
5 </style>
6 <div id="empty"></div>
7 <div id="emptySibling">
8     <div></div>
9     <div></div>
10     <div></div>
11     <div></div>
12 </div>
13 <div id="notEmpty"><div id="child"></div></div>
14 <div id="notEmptySibling">
15     <div></div>
16     <div></div>
17     <div></div>
18     <div></div>
19 </div>
20 <script>
21 description("Use descendant invalidation set for :empty pseudo class - sibling invalidation.")
22
23 var transparent = "rgba(0, 0, 0, 0)";
24 var green = "rgb(0, 128, 0)";
25
26 shouldBe("getComputedStyle(emptySibling, '').backgroundColor", "green");
27
28 empty.offsetTop; // force recalc
29 empty.appendChild(document.createElement("div"));
30
31 if (window.internals)
32     shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "7");
33
34 shouldBe("getComputedStyle(emptySibling, '').backgroundColor", "transparent");
35
36 shouldBe("getComputedStyle(notEmptySibling, '').backgroundColor", "transparent");
37
38 notEmpty.offsetTop; // force recalc
39 notEmpty.removeChild(child);
40
41 if (window.internals)
42     shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "6");
43
44 shouldBe("getComputedStyle(notEmptySibling, '').backgroundColor", "green");
45 </script>