| 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 /* Make all divs relayout boundaries. */ | 4 /* Make all divs relayout boundaries. */ |
| 5 div { | 5 div { |
| 6 width: 100px; | 6 width: 100px; |
| 7 height: 100px; | 7 height: 100px; |
| 8 overflow: hidden; | 8 overflow: hidden; |
| 9 } | 9 } |
| 10 </style> | 10 </style> |
| 11 <div id="relayout-common-ancestor"><div><div></div></div><div><div></div></div><
/div> | 11 <div id="relayout-common-ancestor"><div><div></div></div><div><div></div></div><
/div> |
| 12 <script> | 12 <script> |
| 13 function dirtyLayout() | 13 function dirtyLayout() |
| 14 { | 14 { |
| 15 var container = document.getElementById('relayout-common-ancestor'); | 15 var container = document.getElementById('relayout-common-ancestor'); |
| 16 for (var i = 0; i < container.childNodes.length; ++i) { | 16 for (var i = 0; i < container.childNodes.length; ++i) { |
| 17 var child = container.childNodes[i].firstChild; | 17 var child = container.childNodes[i].firstChild; |
| 18 child.style.width = "99px"; | 18 child.style.width = "99px"; |
| 19 // Force a style recalc that doesn't force a layout so that the | 19 // Force a style recalc that doesn't force a layout so that the |
| 20 // needsLayout count is incremented. | 20 // needsLayout count is incremented. |
| 21 getComputedStyle(child).color; | 21 getComputedStyle(child).color; |
| 22 } | 22 } |
| 23 } | 23 } |
| 24 | 24 |
| 25 if (window.internals) | |
| 26 shouldBe("window.internals.needsLayoutCount()", "2"); | |
| 27 | |
| 28 document.documentElement.offsetTop; | 25 document.documentElement.offsetTop; |
| 29 | 26 |
| 30 // Pass quiet=true here so that the added nodes from the shouldBe don't | 27 // Pass quiet=true here so that the added nodes from the shouldBe don't |
| 31 // mess up the needsLayoutCount on line 45. | 28 // mess up the needsLayoutCount on line 45. |
| 32 if (window.internals) | 29 if (window.internals) |
| 33 shouldBe("window.internals.needsLayoutCount()", "0", true); | 30 shouldBe("window.internals.needsLayoutCount()", "0", true); |
| 34 | 31 |
| 35 dirtyLayout(); | 32 dirtyLayout(); |
| 36 | 33 |
| 37 // FIXME: In theory we can restrict the layoutRoot in FrameView to the common | 34 // FIXME: In theory we can restrict the layoutRoot in FrameView to the common |
| 38 // ancestor container and this should only be 5 instead of 8. | 35 // ancestor container and this should only be 5 instead of 8. |
| 39 if (window.internals) | 36 if (window.internals) |
| 40 shouldBe("window.internals.needsLayoutCount()", "8"); | 37 shouldBe("window.internals.needsLayoutCount()", "8"); |
| 41 | 38 |
| 42 document.documentElement.offsetTop; | 39 document.documentElement.offsetTop; |
| 43 | 40 |
| 44 if (window.internals) | 41 if (window.internals) |
| 45 shouldBe("window.internals.needsLayoutCount()", "0"); | 42 shouldBe("window.internals.needsLayoutCount()", "0"); |
| 46 </script> | 43 </script> |
| OLD | NEW |