summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-transforms/3d-scene-with-iframe-001.html
blob: 075e4ad1bc0984996f81789ff90b719142ca6e09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!DOCTYPE html>
<html class="reftest-wait">
<meta charset="UTF-8">
<link rel="author" title="L. David Baron" href="https://dbaron.org/">
<link rel="author" title="Google" href="http://www.google.com/">
<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1264783">
<link rel="help" href="https://www.w3.org/TR/css-transforms-2/#3d-rendering-contexts">
<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>