OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <style> |
| 3 /* Body is large enough to scroll but not enough to restore the scroll |
| 4 position without clamping. */ |
| 5 body { |
| 6 height: 2000px; |
| 7 width: 2000px; |
| 8 } |
| 9 </style> |
| 10 |
| 11 <div id='console'></div> |
| 12 |
| 13 <script src="../../resources/js-test.js"></script> |
| 14 <script> |
| 15 jsTestIsAsync = true |
| 16 setPrintTestResultsLazily(); |
| 17 description('Test ensures that frame scroll position is not prematurely ' + |
| 18 'clamped and restored before load event fires.'); |
| 19 |
| 20 // Forcing layout causes the frame to attempt to restore scroll position if |
| 21 // possible even before page loading is complete. |
| 22 forceLayout(); |
| 23 debug('Scroll position should not be clamped and restored while frame is loading
'); |
| 24 shouldBe('document.scrollingElement.scrollLeft', '0'); |
| 25 shouldBe('document.scrollingElement.scrollTop', '0'); |
| 26 |
| 27 onload = function() { |
| 28 if (window.name == 'verification') { |
| 29 shouldBe('document.scrollingElement.scrollLeft', '5000'); |
| 30 shouldBe('document.scrollingElement.scrollTop', '5001'); |
| 31 |
| 32 window.name = ""; |
| 33 setTimeout(function(){ window.scrollTo(0, 0); }, 0); |
| 34 finishJSTest(); |
| 35 } else { |
| 36 window.scrollTo(5000, 5001); |
| 37 shouldBe('document.scrollingElement.scrollLeft', '5000'); |
| 38 shouldBe('document.scrollingElement.scrollTop', '5001'); |
| 39 setTimeout(function(){ |
| 40 window.name = "verification"; |
| 41 window.location = "data:text/html,<script>history.back();</scr" + "i
pt>"; |
| 42 }, 0); |
| 43 } |
| 44 } |
| 45 |
| 46 function forceLayout () { |
| 47 document.body.scrollTop; |
| 48 } |
| 49 </script> |
| 50 |
| 51 <style> |
| 52 body { |
| 53 height: 9999px; |
| 54 width: 9999px; |
| 55 } |
| 56 </style> |
OLD | NEW |