OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <style> |
| 5 .non-layer-viewport-constrained { |
| 6 position: fixed; |
| 7 } |
| 8 |
| 9 .box { |
| 10 width: 50px; |
| 11 height: 50px; |
| 12 } |
| 13 |
| 14 .container { |
| 15 overflow: scroll; |
| 16 border: 1px solid black; |
| 17 } |
| 18 |
| 19 .container-element { |
| 20 position: relative; |
| 21 background-color: blue; |
| 22 margin: 10px; |
| 23 } |
| 24 |
| 25 #sibling { |
| 26 top: 220px; |
| 27 left: 10px; |
| 28 background-color: green; |
| 29 } |
| 30 |
| 31 #parent { |
| 32 position: absolute; |
| 33 left: 10px; |
| 34 top: 10px; |
| 35 width: 200px; |
| 36 height: 200px; |
| 37 } |
| 38 |
| 39 #description { |
| 40 position: absolute; |
| 41 top: 300px; |
| 42 left: 10px; |
| 43 } |
| 44 |
| 45 #console { |
| 46 position: absolute; |
| 47 top: 290px; |
| 48 left: 10px; |
| 49 } |
| 50 |
| 51 </style> |
| 52 <script src="../../resources/js-test.js"></script> |
| 53 <script> |
| 54 if (window.internals) { |
| 55 // Our fixed position element must not be composited; this is a trigger for |
| 56 // forcing main thread compositing. |
| 57 window.internals.settings.setForceCompositingMode(true); |
| 58 window.internals.settings.setAcceleratedCompositingForFixedPositionEnabled(f
alse); |
| 59 window.internals.settings.setAcceleratedCompositingForOverflowScrollEnabled(
true); |
| 60 } |
| 61 |
| 62 window.jsTestIsAsync = true; |
| 63 |
| 64 function shouldIgnore() { |
| 65 if (window.internals) { |
| 66 var reasons = internals.mainThreadScrollingReasons(document); |
| 67 if (reasons === '') |
| 68 testPassed("No main thread scrolling reasons."); |
| 69 else |
| 70 testFailed("Should have found no main thread scrolling reasons. " + |
| 71 "Instead, they were '" + reasons + "'."); |
| 72 } else { |
| 73 debug("This test requires window.internals."); |
| 74 description("This test ensures that when the main frame cannot be " + |
| 75 "scrolled, we ignore reasons for scrolling on the main " + |
| 76 "thread that only matter when the main frame scrolls"); |
| 77 } |
| 78 } |
| 79 |
| 80 function shouldNotIgnore() { |
| 81 document.body.style.height = "3000px"; |
| 82 document.body.offsetTop; |
| 83 |
| 84 if (window.internals) { |
| 85 var reasons = internals.mainThreadScrollingReasons(document); |
| 86 if (reasons === '') |
| 87 testFailed("Should have found main thread scrolling reasons, but did
n't."); |
| 88 else |
| 89 testPassed("Found main thread scrolling reasons: " + reasons + "."); |
| 90 } else { |
| 91 debug("This test requires window.internals."); |
| 92 description("This test ensures that when the main frame cannot be " + |
| 93 "scrolled, we ignore reasons for scrolling on the main " + |
| 94 "thread that only matter when the main frame scrolls"); |
| 95 } |
| 96 } |
| 97 |
| 98 function runTests() { |
| 99 shouldIgnore(); |
| 100 shouldNotIgnore(); |
| 101 finishJSTest(); |
| 102 } |
| 103 |
| 104 window.onload = runTests; |
| 105 </script> |
| 106 </head> |
| 107 <body> |
| 108 <div class="non-layer-viewport-constrained box" id="sibling"></div> |
| 109 <div class="container" id="parent"> |
| 110 <div class="box container-element"></div> |
| 111 <div class="box container-element"></div> |
| 112 <div class="box container-element"></div> |
| 113 <div class="box container-element"></div> |
| 114 <div class="box container-element"></div> |
| 115 </div> |
| 116 </body> |
| 117 </html> |
OLD | NEW |