| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 if (window.internals) { | 54 if (window.internals) { |
| 55 // Our fixed position element must not be composited; this is a trigger for | 55 // Our fixed position element must not be composited; this is a trigger for |
| 56 // forcing main thread compositing. | 56 // forcing main thread compositing. |
| 57 window.internals.settings.setForceCompositingMode(true); | 57 window.internals.settings.setForceCompositingMode(true); |
| 58 window.internals.settings.setAcceleratedCompositingForFixedPositionEnabled(f
alse); | 58 window.internals.settings.setAcceleratedCompositingForFixedPositionEnabled(f
alse); |
| 59 window.internals.settings.setAcceleratedCompositingForOverflowScrollEnabled(
true); | 59 window.internals.settings.setAcceleratedCompositingForOverflowScrollEnabled(
true); |
| 60 } | 60 } |
| 61 | 61 |
| 62 window.jsTestIsAsync = true; | 62 window.jsTestIsAsync = true; |
| 63 | 63 |
| 64 function shouldIgnore() { | 64 function checkThatWeHaveIgnored() { |
| 65 if (window.internals) { | 65 if (window.internals) { |
| 66 var reasons = internals.mainThreadScrollingReasons(document); | 66 var reasons = internals.mainThreadScrollingReasons(document); |
| 67 if (reasons === '') | 67 if (reasons === '') |
| 68 testPassed("No main thread scrolling reasons."); | 68 testPassed("No main thread scrolling reasons."); |
| 69 else | 69 else |
| 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 shouldIgnore() { |
| 81 document.body.style.height = "3000px"; | 81 checkThatWeHaveIgnored(); |
| 82 |
| 83 document.body.style.overflow = "hidden"; |
| 82 document.body.offsetTop; | 84 document.body.offsetTop; |
| 83 | 85 |
| 86 checkThatWeHaveIgnored(); |
| 87 } |
| 88 |
| 89 function checkThatWeHaveNotIgnored() { |
| 84 if (window.internals) { | 90 if (window.internals) { |
| 85 var reasons = internals.mainThreadScrollingReasons(document); | 91 var reasons = internals.mainThreadScrollingReasons(document); |
| 86 if (reasons === '') | 92 if (reasons === '') |
| 87 testFailed("Should have found main thread scrolling reasons, but did
n't."); | 93 testFailed("Should have found main thread scrolling reasons, but did
n't."); |
| 88 else | 94 else |
| 89 testPassed("Found main thread scrolling reasons: " + reasons + "."); | 95 testPassed("Found main thread scrolling reasons: " + reasons + "."); |
| 90 } else { | 96 } else { |
| 91 debug("This test requires window.internals."); | 97 debug("This test requires window.internals."); |
| 92 description("This test ensures that when the main frame cannot be " + | 98 description("This test ensures that when the main frame cannot be " + |
| 93 "scrolled, we ignore reasons for scrolling on the main " + | 99 "scrolled, we ignore reasons for scrolling on the main " + |
| 94 "thread that only matter when the main frame scrolls"); | 100 "thread that only matter when the main frame scrolls"); |
| 95 } | 101 } |
| 96 } | 102 } |
| 97 | 103 |
| 104 function shouldNotIgnore() { |
| 105 document.body.style.overflow = ""; |
| 106 document.body.style.height = "3000px"; |
| 107 document.body.offsetTop; |
| 108 |
| 109 checkThatWeHaveNotIgnored(); |
| 110 } |
| 111 |
| 98 function runTests() { | 112 function runTests() { |
| 99 shouldIgnore(); | 113 shouldIgnore(); |
| 100 shouldNotIgnore(); | 114 shouldNotIgnore(); |
| 101 finishJSTest(); | 115 finishJSTest(); |
| 102 } | 116 } |
| 103 | 117 |
| 104 window.onload = runTests; | 118 window.onload = runTests; |
| 105 </script> | 119 </script> |
| 106 </head> | 120 </head> |
| 107 <body> | 121 <body> |
| 108 <div class="non-layer-viewport-constrained box" id="sibling"></div> | 122 <div class="non-layer-viewport-constrained box" id="sibling"></div> |
| 109 <div class="container" id="parent"> | 123 <div class="container" id="parent"> |
| 110 <div class="box container-element"></div> | 124 <div class="box container-element"></div> |
| 111 <div class="box container-element"></div> | 125 <div class="box container-element"></div> |
| 112 <div class="box container-element"></div> | 126 <div class="box container-element"></div> |
| 113 <div class="box container-element"></div> | 127 <div class="box container-element"></div> |
| 114 <div class="box container-element"></div> | 128 <div class="box container-element"></div> |
| 115 </div> | 129 </div> |
| 116 </body> | 130 </body> |
| 117 </html> | 131 </html> |
| OLD | NEW |