OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../../resources/js-test.js"></script> | 2 <script src="../../resources/js-test.js"></script> |
3 <style> | 3 <style> |
4 .a span {} | 4 .a span {} |
5 </style> | 5 </style> |
6 <div id="parent"> | 6 <div id="parent"> |
7 <span style="display:none"></span> | 7 <span style="display:none"></span> |
8 <div style="float:left;"></div> | 8 <div style="float:left;"></div> |
9 <span></span> | 9 <span></span> |
10 </div> | 10 </div> |
11 <script> | 11 <script> |
12 // Force style recalc and layout. | 12 // Force style recalc and layout. |
13 document.body.offsetTop; | 13 document.body.offsetTop; |
14 | 14 |
15 if (window.internals) | 15 if (window.internals) |
16 shouldBe("window.internals.needsLayoutCount()", "0", true); | 16 shouldBe("window.internals.needsLayoutCount()", "0", true); |
17 | 17 |
18 var parent = document.getElementById("parent"); | 18 var parent = document.getElementById("parent"); |
19 | 19 |
20 // Changing the class attribute here will cause a style recalc with a resulting | 20 // Changing the class attribute here will cause a style recalc with a resulting |
21 // reattach, but it should not cause a relayout. | 21 // reattach, but it should not cause a relayout. |
22 parent.className = "a"; | 22 parent.className = "a"; |
23 | 23 |
24 if (window.internals) { | 24 if (window.internals) { |
25 shouldBe("window.internals.updateStyleAndReturnAffectedElementCount()", "4",
true); | 25 shouldBe("window.internals.updateStyleAndReturnAffectedElementCount()", "3",
true); |
26 shouldBe("window.internals.needsLayoutCount()", "0", true); | 26 shouldBe("window.internals.needsLayoutCount()", "0", true); |
27 } | 27 } |
28 </script> | 28 </script> |
OLD | NEW |