Update To 11.40.268.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 window.testIsAsync = true;
10
11 var W = 200;
12 var H = 200;
13 var SVGNS = "http://www.w3.org/2000/svg";
14 var currentColor = 0;
15 var colors = ["red", "green"];
16
17 function resetFill(parentNode) {
18     var rootPattern = document.createElementNS(SVGNS, "pattern");
19     rootPattern.setAttribute("id", "pat");
20     rootPattern.setAttribute("patternUnits", "userSpaceOnUse");
21     rootPattern.setAttribute("width", W);
22     rootPattern.setAttribute("height", H);
23     parentNode.appendChild(rootPattern);
24
25     var rect = document.createElementNS(SVGNS, "rect");
26     rect.setAttribute("width", W);
27     rect.setAttribute("height", H);
28     rect.setAttribute("fill", colors[currentColor++]);
29     rootPattern.appendChild(rect);
30     
31     return rect;
32 }
33
34 function updateFill() {
35     var el = document.getElementById("shape");
36     var defs = document.getElementById("defs");
37
38     while (defs.firstChild)
39         defs.removeChild(defs.firstChild);
40
41     resetFill(defs);
42
43     el.setAttribute("fill", "url(#pat)");
44
45     if(currentColor == 2)
46         finishRepaintTest();
47 }
48
49 function repaintTest() {
50     updateFill();
51     // FIXME: we need a better way of waiting for layout/repainting to happen
52     setTimeout("updateFill()", 1);
53 }
54 </script>
55 <body onload="runRepaintAndPixelTest()">
56 <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%">
57 <defs id="defs"></defs>
58 <rect id="shape" width="200" height="200"></rect>
59 </svg>
60 </body>
61 </html>