<!DOCTYPE html>
<html>
<head>
<style>
.container {
height: 460px;
width: 120px;
overflow: hidden;
position: relative;
left: 50px;
z-index: 0;
border: 1px solid black;
background-color: white;
}
.box {
position: relative;
width: 100px;
height: 100px;
margin: 10px;
background-color: blue;
}
.force-layer {
transform: translateZ(1px);
}
.yellow {
background-color: yellow;
}
.gray {
background-color: gray;
}
.animating1 {
animation: translate1 2s linear infinite alternate;
}
.animating2 {
animation: translate2 2s linear infinite alternate;
}
@keyframes translate1 {
from { transform: translate(0px, -110px); }
to { transform: translate(0px, 590px); }
}
@keyframes translate2 {
from { transform: translate(0px, -220px); }
to { transform: translate(0px, 110px); }
}
</style>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
function queueBoxForAnimation(elementId, animationClass, callback) {
var box = document.getElementById(elementId);
if (callback)
box.addEventListener('animationstart', callback, false);
box.classList.add(animationClass);
}
function runTest()
{
queueBoxForAnimation("to-animate1", "animating1");
queueBoxForAnimation("to-animate2", "animating2", animationStarted);
}
function animationStarted()
{
if (window.testRunner) {
var layersElement = document.getElementById('layers');
layersElement.style.display = "none";
var layerText = internals.layerTreeAsText(document);
layerText = layerText.replace(/\[.*,.*,.*,.*\]/g, '[...]');
layersElement.innerText = layerText;
layersElement.style.display = "block";
testRunner.notifyDone();
}
}
window.addEventListener('load', runTest, false);
</script>
</head>
<body>
There are two animations going at the same time. The second animation is inside a clipping
container (white background with black border). The first animation should display behind the clipping container.
For both animations, the following should be true:
1. Yellow box should display in front of the blue box.
2. Gray boxes should display behind the blue box.
-->
<div class="box gray"></div>
<div id="to-animate1" class="box"></div>
<div class="container">
<div class="box gray force-layer"></div>
<div class="box gray"></div>
<div id="to-animate2" class="box"></div>
<div class="box yellow"></div>
</div>
<div class="box yellow"></div>
<pre id="layers">Layer tree goes here in DRT</pre>
</body>
</html>