Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / svg / custom / pending-resource-after-removal.xhtml
1 <?xml version="1.0" encoding="utf-8"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4 <html xmlns="http://www.w3.org/1999/xhtml">
5 <head>
6 <script src="../../fast/repaint/resources/text-based-repaint.js"></script>
7 <title>The rectangle should be green.</title></head>
8 <script>
9
10 var W = 200;
11 var H = 200;
12 var SVGNS = "http://www.w3.org/2000/svg";
13 var currentColor = 0;
14 var colors = ["red", "green"];
15
16 function resetFill(parentNode) {
17     var rootPattern = document.createElementNS(SVGNS, "pattern");
18     rootPattern.setAttribute("id", "pat");
19     rootPattern.setAttribute("patternUnits", "userSpaceOnUse");
20     rootPattern.setAttribute("width", W);
21     rootPattern.setAttribute("height", H);
22     parentNode.appendChild(rootPattern);
23
24     var rect = document.createElementNS(SVGNS, "rect");
25     rect.setAttribute("width", W);
26     rect.setAttribute("height", H);
27     rect.setAttribute("fill", colors[currentColor++]);
28     rootPattern.appendChild(rect);
29     
30     return rect;
31 }
32
33 function updateFill() {
34     var el = document.getElementById("shape");
35     var defs = document.getElementById("defs");
36
37     while (defs.firstChild)
38         defs.removeChild(defs.firstChild);
39
40     resetFill(defs);
41
42     el.setAttribute("fill", "url(#pat)");
43
44     if(currentColor == 2)
45         if(window.testRunner)
46             testRunner.notifyDone();
47 }
48
49 function repaintTest() {
50     if(window.testRunner)
51         testRunner.waitUntilDone();
52
53     updateFill();
54     setTimeout("updateFill()", 0);
55 }
56 </script>
57 <body onload="runRepaintAndPixelTest()">
58 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%">
59 <defs id="defs"></defs>
60 <rect id="shape" width="200" height="200"></rect>
61 </svg>
62 </body>
63 </html>