OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 |
| 3 <html> |
| 4 <head> |
| 5 <style> |
| 6 .container { |
| 7 width: 200px; |
| 8 height: 200px; |
| 9 overflow: scroll; |
| 10 margin: 20px; |
| 11 border: 1px solid black; |
| 12 } |
| 13 |
| 14 .scrolled { |
| 15 width: 180px; |
| 16 height: 90px; |
| 17 margin: 10px; |
| 18 background-color: gray; |
| 19 position: relative; |
| 20 } |
| 21 |
| 22 .positioned { |
| 23 width: 120px; |
| 24 height: 240px; |
| 25 background-color: green; |
| 26 position: absolute; |
| 27 } |
| 28 |
| 29 #descendant { |
| 30 left: 90px; |
| 31 top: 20px; |
| 32 background-color: blue; |
| 33 z-index: -20; |
| 34 } |
| 35 </style> |
| 36 <script> |
| 37 var debugMode = false; |
| 38 |
| 39 if (window.testRunner) |
| 40 testRunner.dumpAsText(); |
| 41 |
| 42 if (window.internals) |
| 43 window.internals.settings.setAcceleratedCompositingForOverflowScrollEnable
d(true); |
| 44 |
| 45 function write(str) |
| 46 { |
| 47 var pre = document.getElementById('console'); |
| 48 var text = document.createTextNode(str + '\n'); |
| 49 pre.appendChild(text); |
| 50 } |
| 51 |
| 52 var iteration = 0; |
| 53 function printResult(expectedResult) |
| 54 { |
| 55 // Force a style recalc. |
| 56 document.body.offsetTop; |
| 57 |
| 58 if (window.internals) { |
| 59 var layerTree = window.internals.layerTreeAsText(document); |
| 60 |
| 61 if (!layerTree == !expectedResult) |
| 62 write('Iteration ' + iteration.toString() + ': Passed') |
| 63 else |
| 64 write('Iteration ' + iteration.toString() + ': FAILED') |
| 65 |
| 66 if (layerTree) { |
| 67 write('Iteration ' + iteration.toString() + ', layer tree'); |
| 68 if (debugMode) |
| 69 write(layerTree); |
| 70 } else |
| 71 write('Iteration ' + iteration.toString() + ', no layer tree'); |
| 72 } |
| 73 iteration++; |
| 74 } |
| 75 |
| 76 function doTest() |
| 77 { |
| 78 var descendant = document.getElementById('descendant'); |
| 79 |
| 80 // Check that we don't promote if we have an out of flow descendant. |
| 81 // We need to hide the predecessor and successor so they don't interfere |
| 82 // with this experiment. |
| 83 for (i = 0; i < 3; ++i) { |
| 84 if (i == 0) { |
| 85 descendant.style.visibility = 'hidden'; |
| 86 descendant.style.display = ''; |
| 87 } else if (i == 1) { |
| 88 descendant.style.visibility = ''; |
| 89 descendant.style.display = ''; |
| 90 } else { |
| 91 descendant.style.visibility = ''; |
| 92 descendant.style.display = 'none'; |
| 93 } |
| 94 |
| 95 // If the out of flow positioned descendant is visible, we cannot opt |
| 96 // into composited scrolling. |
| 97 printResult(i != 1); |
| 98 } // for i |
| 99 |
| 100 } // function doTest |
| 101 |
| 102 window.addEventListener('load', doTest, false); |
| 103 </script> |
| 104 </head> |
| 105 |
| 106 <body> |
| 107 <div class="container" id="container"> |
| 108 <div class="scrolled" id="firstChild"></div> |
| 109 <div class="scrolled" id="secondChild"></div> |
| 110 <div class="positioned" id="descendant"></div> |
| 111 </div> |
| 112 <pre id="console"></pre> |
| 113 </body> |
| 114 </html> |
| 115 |
OLD | NEW |