Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / images / extra-image-in-image-document.html
blobd59668dcd8eee9f112e2d6347eefc95235396324
1 <body onload="test()">
2 <p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=38752">bug 38752</a>:
3 Images cannot be dynamically added to image documents.</p>
4 <p id=result>Onload was not called, which is not good. But is the square below green?</p>
5 <iframe src="resources/test-load.jpg" width=100 height=100 frameborder=0></iframe>
6 <script>
7 if (window.testRunner) {
8 testRunner.waitUntilDone();
9 testRunner.dumpAsText();
12 function loaded()
14 if (frames[0].document.getElementById("green").naturalWidth == 16)
15 document.getElementById("result").innerHTML = "PASS";
16 if (window.testRunner)
17 testRunner.notifyDone();
20 function test()
22 var d = frames[0].document;
23 var script = d.createElement("SCRIPT");
24 script.src = "data:text/plain," +
25 "var bg = document.createElement('DIV');" +
26 "bg.style.width = '100px';" +
27 "bg.style.height = '100px';" +
28 "bg.style.position = 'absolute';" +
29 "bg.style.top = 0;" +
30 "bg.style.left = 0;" +
31 "bg.style.background = 'red no-repeat';" +
32 "bg.style.overflow = 'visible';" +
33 "bg.style.zIndex = '1000000';" +
34 "document.body.appendChild(bg);" +
36 "var img = document.createElement('IMG');" +
37 "img.id = 'green';" +
38 "img.src = 'green.jpg';" +
39 "img.style.width = '100px';" +
40 "img.style.height = '100px';" +
41 "img.style.position = 'absolute';" +
42 "img.style.top = 0;" +
43 "img.style.left = 0;" +
44 "img.style.zIndex = '2000000';" +
45 "img.onload = function() { top.loaded() };" +
46 "document.body.appendChild(img);"
47 d.body.appendChild(script);
50 </script>
51 </body>