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="../../fast/js/resources/js-test-pre.js"></script> |
| 53 <script> |
| 54 if (window.testRunner) { |
| 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 // (Barely) modified version of shouldBeUndefined from js-test-pre.js. |
| 63 function isUndefined(value) |
| 64 { |
| 65 var exception; |
| 66 var _av; |
| 67 try { |
| 68 _av = eval(value); |
| 69 } catch (e) { |
| 70 exception = e; |
| 71 } |
| 72 |
| 73 if (exception) |
| 74 return false; |
| 75 |
| 76 if (typeof _av == "undefined") |
| 77 return true; |
| 78 |
| 79 return false; |
| 80 } |
| 81 |
| 82 function runTest() { |
| 83 if (window.internals) { |
| 84 var reasons = internals.mainThreadScrollingReasons(document); |
| 85 if (isUndefined(reasons)) |
| 86 testPassed("Main thread scrolling reasons were undefined."); |
| 87 else |
| 88 testFailed("Main thread scrolling reasons should have been undefined.
" + |
| 89 "Instead, they were '" + 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 window.onload = runTest; |
| 99 </script> |
| 100 <script src="../../fast/js/resources/js-test-pre.js"></script> |
| 101 </head> |
| 102 <body> |
| 103 <div class="non-layer-viewport-constrained box" id="sibling"></div> |
| 104 <div class="container" id="parent"> |
| 105 <div class="box container-element"></div> |
| 106 <div class="box container-element"></div> |
| 107 <div class="box container-element"></div> |
| 108 <div class="box container-element"></div> |
| 109 <div class="box container-element"></div> |
| 110 </div> |
| 111 </body> |
| 112 </html> |
OLD | NEW |