| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <head> | 2 <head> |
| 3 <style id="thestyle"></style> | 3 <style id="thestyle"></style> |
| 4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/js-test.js"></script> |
| 5 </head> | 5 </head> |
| 6 <div><!-- Extra divs so it's clear when we're doing a full document recalc --> | 6 <div><!-- Extra divs so it's clear when we're doing a full document recalc --> |
| 7 <div></div> | 7 <div></div> |
| 8 <div></div> | 8 <div></div> |
| 9 <div></div> | 9 <div></div> |
| 10 <div></div> | 10 <div></div> |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "6"); | 49 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "6"); |
| 50 | 50 |
| 51 // Test innerHTML. | 51 // Test innerHTML. |
| 52 forceRecalc(); | 52 forceRecalc(); |
| 53 sheet.innerHTML = ".bar { color: red; }\n.baz { color: red; }"; | 53 sheet.innerHTML = ".bar { color: red; }\n.baz { color: red; }"; |
| 54 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "6"); | 54 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "6"); |
| 55 | 55 |
| 56 // Test deleteRule | 56 // Test deleteRule |
| 57 forceRecalc(); | 57 forceRecalc(); |
| 58 sheet.sheet.deleteRule(0); // Deletes .bar rule. | 58 sheet.sheet.deleteRule(0); // Deletes .bar rule. |
| 59 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "6"); | 59 // FIXME: Ideally we'd do StyleInvalidationAnalysis here and only recalc 3 b
ar's, 3 baz's + documentElement |
| 60 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "43"); |
| 60 | 61 |
| 61 shouldBe("getComputedStyle(document.querySelector('.foo')).color", '"rgb(0,
0, 0)"'); | 62 shouldBe("getComputedStyle(document.querySelector('.foo')).color", '"rgb(0,
0, 0)"'); |
| 62 shouldBe("getComputedStyle(document.querySelector('.baz')).color", '"rgb(255
, 0, 0)"'); | 63 shouldBe("getComputedStyle(document.querySelector('.baz')).color", '"rgb(255
, 0, 0)"'); |
| 63 shouldBe("getComputedStyle(document.querySelector('.bar')).color", '"rgb(0,
0, 0)"'); | 64 shouldBe("getComputedStyle(document.querySelector('.bar')).color", '"rgb(0,
0, 0)"'); |
| 64 | 65 |
| 65 // Test insertRule | 66 // Test insertRule |
| 66 forceRecalc(); | 67 forceRecalc(); |
| 67 sheet.sheet.insertRule(".foo { color: red; }", 0); | 68 sheet.sheet.insertRule(".foo { color: red; }", 0); |
| 68 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "6"); | 69 // FIXME: Ideally we'd do StyleInvalidationAnalysis here and only recalc 3 f
oo's, 3 baz's + documentElement |
| 70 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "59"); |
| 69 | 71 |
| 70 shouldBe("getComputedStyle(document.querySelector('.foo')).color", '"rgb(255
, 0, 0)"'); | 72 shouldBe("getComputedStyle(document.querySelector('.foo')).color", '"rgb(255
, 0, 0)"'); |
| 71 shouldBe("getComputedStyle(document.querySelector('.baz')).color", '"rgb(255
, 0, 0)"'); | 73 shouldBe("getComputedStyle(document.querySelector('.baz')).color", '"rgb(255
, 0, 0)"'); |
| 72 shouldBe("getComputedStyle(document.querySelector('.bar')).color", '"rgb(0,
0, 0)"'); | 74 shouldBe("getComputedStyle(document.querySelector('.bar')).color", '"rgb(0,
0, 0)"'); |
| 73 | 75 |
| 74 } | 76 } |
| 75 </script> | 77 </script> |
| OLD | NEW |