| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <style type="text/css"> | |
| .box { | |
| position: relative; | |
| display: inline-block; | |
| margin: 30px; | |
| width: 200px; | |
| height: 200px; | |
| -webkit-transform: translateZ(0); | |
| } | |
| .main { | |
| border: 40px solid gray; | |
| background-color: red; | |
| line-height: 0; | |
| outline: 20px solid transparent; /* Makes compositing layers larger */ | |
| } | |
| .child { | |
| position: absolute; | |
| width: 150px; | |
| height: 150px; | |
| padding: 20px; | |
| -webkit-transform: translateZ(0); | |
| } | |
| .negative { | |
| z-index: -1; | |
| top: 0; | |
| left: 0; | |
| height: 10px; | |
| width: 10px; | |
| } | |
| img { | |
| display: inline-block; | |
| background-color: green; | |
| height: 100px; | |
| width: 100px; | |
| } | |
| @-webkit-keyframes fade { | |
| from { background-color: green; } | |
| to { background-color: orange; } | |
| } | |
| .embiggener { | |
| position: absolute; | |
| height: 10px; | |
| width: 10px; | |
| top: -50px; | |
| left: -50px; | |
| background-color: blue; | |
| } | |
| #layer-tree { | |
| opacity: 0; /* hide from pixel test */ | |
| } | |
| </style> | |
| <script type="text/javascript" charset="utf-8"> | |
| if (window.testRunner) { | |
| testRunner.dumpAsText(true); | |
| testRunner.waitUntilDone(); | |
| } | |
| function repaint() | |
| { | |
| var imagesToRepaint = document.querySelectorAll('.repainted'); | |
| for (var i = 0; i < imagesToRepaint.length; ++i) { | |
| var currImage = imagesToRepaint[i]; | |
| currImage.style.backgroundColor = 'orange'; | |
| } | |
| if (window.testRunner) | |
| testRunner.notifyDone(); | |
| } | |
| window.addEventListener('load', function() { | |
| window.setTimeout(repaint, 0); | |
| }, false); | |
| </script> | |
| </head> | |
| <body> | |
| <!-- Both boxes should look the same. You should see no red. --> | |
| <div class="main box"> | |
| <img><img><img class="repainted"><img> | |
| <div class="negative child"></div> | |
| </div> | |
| <div class="main box" style="overflow: hidden;"> | |
| <img><img><img class="repainted"><img> | |
| <div class="negative child"></div> | |
| </div> | |
| <pre id="layer-tree"></pre> | |
| </body> | |
| </html> |