OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE HTML> |
| 2 <html> |
| 3 <script src="../js/resources/js-test-pre.js"></script> |
| 4 <head> |
| 5 <style> |
| 6 html, body { |
| 7 margin: 0; |
| 8 padding: 0; |
| 9 } |
| 10 #measure { |
| 11 margin: 10px; |
| 12 padding: 10px; |
| 13 } |
| 14 #fixedsize { |
| 15 width: 100px; |
| 16 height: 100px; |
| 17 } |
| 18 </style> |
| 19 <script> |
| 20 description('Test that partial layout works for offset{width, height, left,
top} methods.'); |
| 21 if (window.testRunner) |
| 22 testRunner.dumpAsText(); |
| 23 if (window.internals) |
| 24 window.internals.setUsesOverlayScrollbars(true); |
| 25 |
| 26 function checkSize() { |
| 27 var measure = document.getElementById('measure'); |
| 28 |
| 29 // Record partial layout values for offset*. |
| 30 var measureWidth = measure.offsetWidth; |
| 31 var measureHeight = measure.offsetHeight; |
| 32 var measureTop = measure.offsetTop; |
| 33 var measureLeft = measure.offsetLeft; |
| 34 |
| 35 // Invalidate measure and force a full layout. |
| 36 var child = measure.firstChild; |
| 37 measure.removeChild(child); |
| 38 document.body.clientHeight; |
| 39 measure.appendChild(child); |
| 40 var forceLayout = document.body.clientHeight; |
| 41 |
| 42 var childOffsetTop = child.offsetTop; |
| 43 |
| 44 shouldBe(measureWidth, "document.body.offsetWidth - 20"); |
| 45 shouldBe(measureHeight, "measure.offsetHeight"); |
| 46 shouldBe(measureTop, childOffsetTop - 10); |
| 47 shouldBe(measureLeft, "measure.offsetLeft"); |
| 48 finishJSTest(); |
| 49 } |
| 50 </script> |
| 51 </head> |
| 52 <body onload="checkSize()"> |
| 53 <div id="measure"><div id="fixedsize"></div></div> |
| 54 <script src="../js/resources/js-test-post.js"></script> |
| 55 </body> |
| 56 </html> |
OLD | NEW |