| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 |
| 3 <html> |
| 4 <head> |
| 5 <style type="text/css" media="screen"> |
| 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 position: absolute; |
| 26 } |
| 27 |
| 28 #firstChild { |
| 29 z-index: 1; |
| 30 } |
| 31 |
| 32 #secondChild { |
| 33 z-index: 2; |
| 34 } |
| 35 |
| 36 #predecessor { |
| 37 left: 20px; |
| 38 top: 20px; |
| 39 z-index: 0; |
| 40 background-color: green; |
| 41 } |
| 42 |
| 43 #ancestor { |
| 44 background-color: blue; |
| 45 } |
| 46 |
| 47 </style> |
| 48 <script type="text/javascript" charset="utf-8"> |
| 49 var debugMode = false; |
| 50 |
| 51 if (window.testRunner) |
| 52 testRunner.dumpAsText(); |
| 53 |
| 54 if (window.internals) |
| 55 window.internals.settings.setAcceleratedCompositingForOverflowScrollEnable
d(true); |
| 56 |
| 57 function write(str) |
| 58 { |
| 59 var pre = document.getElementById('console'); |
| 60 var text = document.createTextNode(str + '\n'); |
| 61 pre.appendChild(text); |
| 62 } |
| 63 |
| 64 function doTest() |
| 65 { |
| 66 var predecessor = document.getElementById('predecessor'); |
| 67 var ancestor = document.getElementById('ancestor'); |
| 68 var container = document.getElementById('container'); |
| 69 var firstChild = document.getElementById('firstChild'); |
| 70 var secondChild = document.getElementById('secondChild'); |
| 71 |
| 72 // Force a style recalc. |
| 73 document.body.offsetTop; |
| 74 |
| 75 if (window.internals) { |
| 76 // Force a layout. |
| 77 window.internals.boundingBox(container); |
| 78 var layerTree = window.internals.layerTreeAsText(document); |
| 79 |
| 80 if (!layerTree) |
| 81 write('FAILED - did not opt into composited scrolling with a positione
d ancestor when it would safe.') |
| 82 else |
| 83 write('Passed - correctly opted into composited scrolling with a posit
ioned ancestor.') |
| 84 |
| 85 if (layerTree && debugMode) |
| 86 write(layerTree); |
| 87 } |
| 88 } // function doTest |
| 89 |
| 90 window.addEventListener('load', doTest, false); |
| 91 </script> |
| 92 </head> |
| 93 |
| 94 <body> |
| 95 <div class="positioned" id="predecessor"></div> |
| 96 <div class="positioned" id="ancestor"> |
| 97 <div class="container" id="container"> |
| 98 <div class="scrolled" id="firstChild"></div> |
| 99 <div class="scrolled" id="secondChild"></div> |
| 100 </div> |
| 101 </div> |
| 102 <pre id="console"></pre> |
| 103 </body> |
| 104 </html> |
| OLD | NEW |