Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / canvas / canvas-after-destroy-iframe.html
blob1928f4b20f30651ddfabde9aac5dabaa7603905b
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <script>
8 if (window.testRunner) {
9 testRunner.dumpAsText();
10 testRunner.waitUntilDone();
13 var barrier = 2;
14 function frameLoaded()
16 barrier--;
17 if (barrier == 0)
18 runTest();
21 function runTest()
23 debug("check if re-parenting canvas keeps its context.")
24 canvasTest(document.getElementById("frame1"), true);
25 debug("check if detaching canvas loses its context.")
26 canvasTest(document.getElementById("frame2"), false);
28 if (window.testRunner)
29 testRunner.notifyDone();
32 var data;
33 function canvasTest(frame, adoptCanvas)
35 var parent = document.getElementById("parent");
36 var canvas = frame.contentDocument.getElementById('mycanvas');
37 var ctx = canvas.getContext('2d');
39 var imageData;
40 imageData = ctx.getImageData(100, 100, 1, 1);
41 data = imageData.data;
42 shouldBe('data[0]', '255');
43 shouldBe('data[1]', '0');
44 shouldBe('data[2]', '0');
46 if (adoptCanvas)
47 parent.appendChild(canvas);
48 parent.removeChild(frame);
50 imageData = ctx.getImageData(100, 100, 1, 1);
51 data = imageData.data;
52 if (adoptCanvas) {
53 shouldBe('data[0]', '255');
54 } else {
55 // GC causes active DOM stop and canvas loses its context.
56 shouldBe('data[0]', '0');
58 shouldBe('data[1]', '0');
59 shouldBe('data[2]', '0');
61 </script>
62 <div id="parent">
63 <iframe id="frame1" src="resources/canvas-fill-for-iframe.html" onload="frameLoaded()"></iframe>
64 <iframe id="frame2" src="resources/canvas-fill-for-iframe.html" onload="frameLoaded()"></iframe>
65 </div>
66 </body>
67 </html>