OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <style> |
| 5 div { |
| 6 height: 500px; |
| 7 width: 500px; |
| 8 padding: 3px; |
| 9 border-style: solid; |
| 10 border-color: black; |
| 11 border-width: 1px; |
| 12 overflow: scroll; |
| 13 } |
| 14 |
| 15 .filler { |
| 16 position: relative; |
| 17 top: 1000px; |
| 18 } |
| 19 |
| 20 button { |
| 21 display: none; |
| 22 } |
| 23 </style> |
| 24 <script> |
| 25 // This test ensures that when an element's style changes in such a |
| 26 // way that it remains out-of-flow positioned, but its containing |
| 27 // block changes, we correctly update elements' has-unclipped- |
| 28 // descendant property. Since no layers will opt out due to stacking |
| 29 // issues, we can judge whether we're setting this state correctly |
| 30 // by which layers opt-in. |
| 31 if (window.internals) |
| 32 window.internals.settings.setAcceleratedCompositingForOverflowSc
rollEnabled(true); |
| 33 |
| 34 if (window.testRunner) |
| 35 window.testRunner.dumpAsText(); |
| 36 |
| 37 function doTest() |
| 38 { |
| 39 if (!window.internals) { |
| 40 document.getElementById('toggle1').style.display = 'block'; |
| 41 document.getElementById('toggle2').style.display = 'block'; |
| 42 document.body.offsetTop; |
| 43 return; |
| 44 } |
| 45 |
| 46 var result = window.internals.layerTreeAsText(document); |
| 47 var oofp1 = document.getElementById('oofp1'); |
| 48 var oofp2 = document.getElementById('oofp2'); |
| 49 |
| 50 oofp1.style.position = 'fixed'; |
| 51 document.body.offsetTop; |
| 52 result += window.internals.layerTreeAsText(document); |
| 53 |
| 54 oofp2.style.position = 'fixed'; |
| 55 document.body.offsetTop; |
| 56 result += window.internals.layerTreeAsText(document); |
| 57 |
| 58 oofp1.style.position = 'absolute'; |
| 59 document.body.offsetTop; |
| 60 result += window.internals.layerTreeAsText(document); |
| 61 |
| 62 oofp2.style.position = 'absolute'; |
| 63 document.body.offsetTop; |
| 64 result += window.internals.layerTreeAsText(document); |
| 65 |
| 66 document.getElementById('console').innerHTML = result; |
| 67 } |
| 68 |
| 69 window.addEventListener('load', doTest, false); |
| 70 </script> |
| 71 </head> |
| 72 <body> |
| 73 <div> |
| 74 <div style="width: 450px; height: 450px"> |
| 75 <div style="width: 400px; height: 400px"> |
| 76 <div style="width: 350px; height: 350px"> |
| 77 <div style="position: relative; width: 300px; height: 15
0px"> |
| 78 <div id="oofp1" style="position: absolute; backgroun
d-color: red; height: 50px; width: 50px; left: 50px; overflow: hidden"> |
| 79 </div> |
| 80 <div class="filler"></div> |
| 81 </div> |
| 82 <div style="position: relative; width: 300px; height: 15
0px"> |
| 83 <div style="width: 250px; height: 100px"> |
| 84 <div id="oofp2" style="position: absolute; backg
round-color: red; height: 50px; width: 50px; left: 50px; overflow: hidden"></div
> |
| 85 <div class="filler"></div> |
| 86 </div> |
| 87 <div class="filler"></div> |
| 88 </div> |
| 89 <div class="filler"></div> |
| 90 </div> |
| 91 <div class="filler"></div> |
| 92 </div> |
| 93 <div class="filler"></div> |
| 94 </div> |
| 95 <div class="filler"></div> |
| 96 </div> |
| 97 <pre id='console'>This test requires window.internals</pre> |
| 98 |
| 99 <button id='toggle1' onClick="document.getElementById('oofp1').style.pos
ition = document.getElementById('oofp1').style.position === 'fixed' ? 'absolute'
: 'fixed'">toggle 1</button> |
| 100 <button id='toggle2' onClick="document.getElementById('oofp2').style.pos
ition = document.getElementById('oofp2').style.position === 'fixed' ? 'absolute'
: 'fixed'">toggle 2</button> |
| 101 </body> |
| 102 </html> |
OLD | NEW |