Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/css-transforms/3d-scene-with-iframe-001.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html class="reftest-wait">
<meta charset="UTF-8">
<link rel="match" href="3d-scene-with-iframe-001-ref.html">
<meta name="assert" content="The iframe should be covered by the green div.">
<style>
#container {
perspective: 400px;
perspective-origin: 0 0;
}
#scene {
transform-style: preserve-3d;
transform: translate(100px, 100px);
width: 300px;
height: 300px;
}
.transform1, .transform2 {
position: absolute;
transform-style: preserve-3d;
top: 0;
left: 0;
}
.transform1 {
transform: translateZ(200px);
}
.transform1 > div {
background-color: green;
width: 150px;
height: 100px;
transform: translate(-100px, -100px)
}
.transform2 {
transform: translateZ(100px);
}
.transform2 > iframe {
display: block;
transform: translate(-50px, -75px);
}
</style>
<div id="container">
<div id="scene">
<div class="transform1">
<div></div>
</div>
<div class="transform2">
<iframe width="150" height="100"></iframe>
</div>
</div>
</div>
<script>
let iframe = document.getElementsByTagName("iframe")[0];
iframe.addEventListener("load", function() {
let root = iframe.contentDocument.documentElement;
root.style.height = "10000px";
root.style.background = "red";
document.documentElement.classList.remove("reftest-wait");
});
iframe.src = "/resources/blank.html";
</script>