OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE HTML> |
| 2 <script src="../../../resources/js-test.js"></script> |
| 3 <style> |
| 4 |
| 5 ::-webkit-scrollbar { |
| 6 display: none; |
| 7 } |
| 8 body { |
| 9 margin: 0px; |
| 10 height: 1000px; |
| 11 width: 1000px; |
| 12 } |
| 13 #parent { |
| 14 background-color: #FF7F7F; |
| 15 height: 600px; |
| 16 width: 600px; |
| 17 overflow: scroll; |
| 18 } |
| 19 #content1 { |
| 20 height: 700px; |
| 21 width: 700px; |
| 22 } |
| 23 #child { |
| 24 background-color: #84BE6A; |
| 25 height: 500px; |
| 26 width: 500px; |
| 27 overflow: scroll; |
| 28 } |
| 29 #content2 { |
| 30 height: 600px; |
| 31 width: 600px; |
| 32 } |
| 33 </style> |
| 34 |
| 35 <div id="parent"> |
| 36 <div id="content1"> |
| 37 <div id="child"> |
| 38 <div id="content2"> |
| 39 </div> |
| 40 </div> |
| 41 </div> |
| 42 </div> |
| 43 |
| 44 <script> |
| 45 |
| 46 window.jsTestIsAsync = true; |
| 47 |
| 48 var parent = document.getElementById('parent'); |
| 49 var child = document.getElementById('child'); |
| 50 |
| 51 function runTest() { |
| 52 if (!window.chrome || !chrome.gpuBenchmarking) { |
| 53 debug("This test requires window.chrome and chrome.gpuBenchmarking."); |
| 54 finishJSTest(); |
| 55 } |
| 56 var rect = child.getBoundingClientRect(); |
| 57 chrome.gpuBenchmarking.smoothScrollBy(150, scrollValueCheck, |
| 58 (rect.left + rect.right) / 2, |
| 59 (rect.top + rect.bottom) / 2, |
| 60 2, "down", 4000); |
| 61 } |
| 62 |
| 63 function scrollValueCheck() { |
| 64 debug("The child div scrolls till the end."); |
| 65 shouldBecomeEqual("child.scrollTop", "100", |
| 66 function () { |
| 67 shouldBeZero("parent.scrollTop"); |
| 68 finishJSTest(); |
| 69 }); |
| 70 } |
| 71 |
| 72 window.onload = runTest(); |
| 73 |
| 74 </script> |
OLD | NEW |