OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 | 2 |
3 <html> | 3 <html> |
4 <head> | 4 <head> |
5 <style> | 5 <style> |
6 .fixed { | 6 .fixed { |
7 position: fixed; | 7 position: fixed; |
8 width: 50px; | 8 z-index: 1; |
9 height: 50px; | |
10 } | 9 } |
11 | 10 |
12 .absolute { | 11 .absolute { |
13 position: absolute; | 12 position: absolute; |
14 top: 40px; | 13 } |
15 left: 40px; | 14 |
| 15 .unscrollable { |
| 16 overflow-x: hidden; |
| 17 overflow-y: hidden; |
| 18 } |
| 19 |
| 20 .box { |
| 21 top: 100px; |
| 22 left: 10px; |
| 23 width: 100px; |
16 height: 100px; | 24 height: 100px; |
17 width: 100px; | 25 } |
18 background-color: gray; | 26 |
| 27 .red { |
| 28 background-color: red; |
| 29 } |
| 30 |
| 31 .lime { |
| 32 background-color: lime; |
| 33 } |
| 34 |
| 35 .composited { |
| 36 -webkit-transform: translatez(0); |
19 } | 37 } |
20 </style> | 38 </style> |
21 | 39 |
22 <script type="text/javascript"> | 40 <script type="text/javascript"> |
23 if (window.internals) | 41 if (window.internals) |
24 window.internals.settings.setAcceleratedCompositingForFixedPositionEnabled
(true); | 42 window.internals.settings.setAcceleratedCompositingForFixedPositionEnabled
(true); |
25 | 43 |
26 if (window.testRunner) { | 44 if (window.testRunner) { |
27 testRunner.dumpAsText(); | 45 testRunner.dumpAsText(); |
28 | 46 |
29 window.addEventListener("load", function() { | 47 window.addEventListener("load", function() { |
30 document.getElementById("layertree").innerText = window.internals.layerT
reeAsText(document); | 48 document.getElementById("layertree").innerText = window.internals.layerT
reeAsText(document); |
31 }, false); | 49 }, false); |
32 } | 50 } |
33 </script> | 51 </script> |
34 </head> | 52 </head> |
35 | 53 |
36 <body> | 54 <body class="unscrollable"> |
37 <div style="height: 1000px"> | 55 <div style="height: 4000px"> |
38 <p>There should be no layers.</p> | 56 <p>There should be no layers, because the body is unscrollable and there is |
| 57 no need to composite the fixed-position layer.</p> |
39 <pre id="layertree"></pre> | 58 <pre id="layertree"></pre> |
40 </div> | 59 </div> |
41 | 60 |
42 <!-- This should not be composited --> | 61 <!-- This should not be composited --> |
43 <div class="fixed" style="top: 10px; left: 10px"></div> | 62 <div class="fixed lime box"></div> |
44 <!-- And this should not be promoted into a layer --> | |
45 <div class="absolute"></div> | |
46 </body> | 63 </body> |
47 </html> | 64 </html> |
48 | 65 |
OLD | NEW |