summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/images/extra-image-in-image-document.html
blob: d59668dcd8eee9f112e2d6347eefc95235396324 (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
<body onload="test()">
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=38752">bug 38752</a>:
Images cannot be dynamically added to image documents.</p>
<p id=result>Onload was not called, which is not good. But is the square below green?</p>
<iframe src="resources/test-load.jpg" width=100 height=100 frameborder=0></iframe>
<script>
if (window.testRunner) {
    testRunner.waitUntilDone();
    testRunner.dumpAsText();
}

function loaded()
{
    if (frames[0].document.getElementById("green").naturalWidth == 16)
        document.getElementById("result").innerHTML = "PASS";
    if (window.testRunner)
        testRunner.notifyDone();
}

function test()
{
    var d = frames[0].document;
    var script = d.createElement("SCRIPT");
    script.src = "data:text/plain," + 
        "var bg = document.createElement('DIV');" +
        "bg.style.width = '100px';" + 
        "bg.style.height = '100px';" + 
        "bg.style.position = 'absolute';" + 
        "bg.style.top = 0;" + 
        "bg.style.left = 0;" + 
        "bg.style.background = 'red no-repeat';" + 
        "bg.style.overflow = 'visible';" + 
        "bg.style.zIndex = '1000000';" + 
        "document.body.appendChild(bg);" +

        "var img = document.createElement('IMG');" +
        "img.id = 'green';" +
        "img.src = 'green.jpg';" +
        "img.style.width = '100px';" +
        "img.style.height = '100px';" +
        "img.style.position = 'absolute';" +
        "img.style.top = 0;" +
        "img.style.left = 0;" +
        "img.style.zIndex = '2000000';" +
        "img.onload = function() { top.loaded() };" + 
        "document.body.appendChild(img);"
    d.body.appendChild(script);
}

</script>
</body>