blob: f3e7f6d657ae157b511197a22f8c542bb307e6a6 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<style type="text/css" media="screen">
body {
position: relative;
}
#parent {
position: relative;
width: 300px;
height: 250px;
padding: 20px;
border: 1px solid black;
transform: translate(0px, 0px);
}
#child {
position: relative;
left: 10px;
width: 250px;
height: 220px;
background-color: blue;
transform: translate(0px, 0px);
}
#grandchild {
position: relative;
top: 10px;
left: 10px;
width: 200px;
height: 200px;
background-color: yellow;
transform: rotate(30deg);
}
#greatgrandchild {
position: relative;
left: 100px;
width: 250px;
height: 100px;
background-color: green;
}
</style>
<script src="../../resources/run-after-layout-and-paint.js"></script>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
var text = "";
function showTree(which)
{
if (!window.testRunner || !window.internals)
return;
text += "\n" + which + " dump layer tree:\n";
text += internals.layerTreeAsText(document);
testRunner.setCustomTextOutput(text);
}
function doTest()
{
showTree("First");
// Put child in compositing mode
runAfterLayoutAndPaint(function() {
document.getElementById("greatgrandchild").style.webkitTransform = "perspective(400) translate3D(-30px, 30px, 100px) rotateY(60deg)";
showTree("Second");
// Take it back out of compositing mode
runAfterLayoutAndPaint(function() {
document.getElementById("greatgrandchild").style.webkitTransform = "";
showTree("Third");
if (window.testRunner)
testRunner.notifyDone();
});
});
}
window.addEventListener('load', doTest, false);
</script>
</head>
<body>
<!-- Normally we skip making a compositing layer on a parent, even if its children are composited -->
<!-- But if the parent has a 2D transform it should get a compositing layer -->
<!-- Here we test that the entire hierarchy gets layers when some elements are transformed and others arent -->
<!-- Should see a box containing a blue box containing a rotated yellow box containing a green box in perspective -->
<div id="parent">
This content is in the parent
<div id="child">
<div id="grandchild">
<div id="greatgrandchild">
Box should switch between perspective and flat
</div>
</div>
</div>
</div>
</body>
</html>