| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <style> | 4 <style> |
| 5 .non-layer-viewport-constrained { | 5 .non-layer-viewport-constrained { |
| 6 position: fixed; | 6 position: fixed; |
| 7 } | 7 } |
| 8 | 8 |
| 9 .box { | 9 .box { |
| 10 width: 50px; | 10 width: 50px; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 testFailed("Should have found no main thread scrolling reasons. " + | 70 testFailed("Should have found no main thread scrolling reasons. " + |
| 71 "Instead, they were '" + reasons + "'."); | 71 "Instead, they were '" + reasons + "'."); |
| 72 } else { | 72 } else { |
| 73 debug("This test requires window.internals."); | 73 debug("This test requires window.internals."); |
| 74 description("This test ensures that when the main frame cannot be " + | 74 description("This test ensures that when the main frame cannot be " + |
| 75 "scrolled, we ignore reasons for scrolling on the main " + | 75 "scrolled, we ignore reasons for scrolling on the main " + |
| 76 "thread that only matter when the main frame scrolls"); | 76 "thread that only matter when the main frame scrolls"); |
| 77 } | 77 } |
| 78 } | 78 } |
| 79 | 79 |
| 80 function shouldNotIgnore() { | 80 function checkThatWeHaveNotIgnored() { |
| 81 document.body.style.height = "3000px"; | |
| 82 document.body.offsetTop; | |
| 83 | |
| 84 if (window.internals) { | 81 if (window.internals) { |
| 85 var reasons = internals.mainThreadScrollingReasons(document); | 82 var reasons = internals.mainThreadScrollingReasons(document); |
| 86 if (reasons === '') | 83 if (reasons === '') |
| 87 testFailed("Should have found main thread scrolling reasons, but did
n't."); | 84 testFailed("Should have found main thread scrolling reasons, but did
n't."); |
| 88 else | 85 else |
| 89 testPassed("Found main thread scrolling reasons: " + reasons + "."); | 86 testPassed("Found main thread scrolling reasons: " + reasons + "."); |
| 90 } else { | 87 } else { |
| 91 debug("This test requires window.internals."); | 88 debug("This test requires window.internals."); |
| 92 description("This test ensures that when the main frame cannot be " + | 89 description("This test ensures that when the main frame cannot be " + |
| 93 "scrolled, we ignore reasons for scrolling on the main " + | 90 "scrolled, we ignore reasons for scrolling on the main " + |
| 94 "thread that only matter when the main frame scrolls"); | 91 "thread that only matter when the main frame scrolls"); |
| 95 } | 92 } |
| 96 } | 93 } |
| 97 | 94 |
| 95 function shouldNotIgnore() { |
| 96 document.body.style.height = "3000px"; |
| 97 document.body.offsetTop; |
| 98 |
| 99 checkThatWeHaveNotIgnored(); |
| 100 |
| 101 document.body.style.overflow = "hidden"; |
| 102 document.body.offsetTop; |
| 103 |
| 104 checkThatWeHaveNotIgnored(); |
| 105 } |
| 106 |
| 98 function runTests() { | 107 function runTests() { |
| 99 shouldIgnore(); | 108 shouldIgnore(); |
| 100 shouldNotIgnore(); | 109 shouldNotIgnore(); |
| 101 finishJSTest(); | 110 finishJSTest(); |
| 102 } | 111 } |
| 103 | 112 |
| 104 window.onload = runTests; | 113 window.onload = runTests; |
| 105 </script> | 114 </script> |
| 106 </head> | 115 </head> |
| 107 <body> | 116 <body> |
| 108 <div class="non-layer-viewport-constrained box" id="sibling"></div> | 117 <div class="non-layer-viewport-constrained box" id="sibling"></div> |
| 109 <div class="container" id="parent"> | 118 <div class="container" id="parent"> |
| 110 <div class="box container-element"></div> | 119 <div class="box container-element"></div> |
| 111 <div class="box container-element"></div> | 120 <div class="box container-element"></div> |
| 112 <div class="box container-element"></div> | 121 <div class="box container-element"></div> |
| 113 <div class="box container-element"></div> | 122 <div class="box container-element"></div> |
| 114 <div class="box container-element"></div> | 123 <div class="box container-element"></div> |
| 115 </div> | 124 </div> |
| 116 </body> | 125 </body> |
| 117 </html> | 126 </html> |
| OLD | NEW |