OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../../../resources/testharness.js"></script> | 2 <script src="../../../resources/testharness.js"></script> |
3 <script src="../../../resources/testharnessreport.js"></script> | 3 <script src="../../../resources/testharnessreport.js"></script> |
4 <style> | 4 <style> |
5 #t1 + div + div + #r1, | 5 #t1 + div + div + #r1, |
6 #t2 + div + div + #r2, | 6 #t2 + div + div + #r2, |
7 #t3 + div + div + #r3 { background-color: rgb(0, 128, 0); } | 7 #t3 + div + div + #r3 { background-color: rgb(0, 128, 0); } |
8 </style> | 8 </style> |
9 <div> | 9 <div> |
10 <div id="t1"></div> | 10 <div id="t1"></div> |
(...skipping 22 matching lines...) Expand all Loading... |
33 test(function() { | 33 test(function() { |
34 assert_true(!!window.internals, "This test only works with internals exposed
present"); | 34 assert_true(!!window.internals, "This test only works with internals exposed
present"); |
35 }, "internals are exposed"); | 35 }, "internals are exposed"); |
36 | 36 |
37 test(function() { | 37 test(function() { |
38 var i1 = document.getElementById('i1'); | 38 var i1 = document.getElementById('i1'); |
39 var r1 = document.getElementById('r1'); | 39 var r1 = document.getElementById('r1'); |
40 assert_equals(getComputedStyle(r1).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); | 40 assert_equals(getComputedStyle(r1).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); |
41 | 41 |
42 i1.parentNode.insertBefore(document.createElement('div'), i1); | 42 i1.parentNode.insertBefore(document.createElement('div'), i1); |
43 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 4, "Subt
ree style recalc"); | 43 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 2, "Inse
rted div plus #r1 recalculated"); |
44 assert_equals(getComputedStyle(r1).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); | 44 assert_equals(getComputedStyle(r1).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); |
45 }, "Insert between siblings"); | 45 }, "Insert between siblings"); |
46 | 46 |
47 test(function() { | 47 test(function() { |
48 var i2 = document.getElementById('i2'); | 48 var i2 = document.getElementById('i2'); |
49 var r2 = document.getElementById('r2'); | 49 var r2 = document.getElementById('r2'); |
50 assert_equals(getComputedStyle(r2).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); | 50 assert_equals(getComputedStyle(r2).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); |
51 | 51 |
52 var t2 = document.createElement('div'); | 52 var t2 = document.createElement('div'); |
53 t2.id = 't2'; | 53 t2.id = 't2'; |
54 i2.parentNode.insertBefore(t2, i2); | 54 i2.parentNode.insertBefore(t2, i2); |
55 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 4, "Subt
ree style recalc"); | 55 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 2, "Inse
rted div plus #r2 recalculated"); |
56 assert_equals(getComputedStyle(r2).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); | 56 assert_equals(getComputedStyle(r2).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); |
57 }, "Insert before siblings"); | 57 }, "Insert before siblings"); |
58 | 58 |
59 test(function() { | 59 test(function() { |
60 var d3 = document.getElementById('d3'); | 60 var d3 = document.getElementById('d3'); |
61 var r3 = document.getElementById('r3'); | 61 var r3 = document.getElementById('r3'); |
62 | 62 |
63 d3.parentNode.removeChild(d3); | 63 d3.parentNode.removeChild(d3); |
64 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 3, "Subt
ree style recalc"); | 64 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1, "#r3
recalculated"); |
65 assert_equals(getComputedStyle(r3).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); | 65 assert_equals(getComputedStyle(r3).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); |
66 }, "Remove between siblings"); | 66 }, "Remove between siblings"); |
67 | 67 |
68 </script> | 68 </script> |
OLD | NEW |