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">
6 <script src="../../fast/repaint/resources/text-based-repaint.js"></script>
7 <title>The rectangle should be green.</title></head>
9 window.testIsAsync = true;
13 var SVGNS = "http://www.w3.org/2000/svg";
15 var colors = ["red", "green"];
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);
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);
34 function updateFill() {
35 var el = document.getElementById("shape");
36 var defs = document.getElementById("defs");
38 while (defs.firstChild)
39 defs.removeChild(defs.firstChild);
43 el.setAttribute("fill", "url(#pat)");
49 function repaintTest() {
51 // FIXME: we need a better way of waiting for layout/repainting to happen
52 setTimeout("updateFill()", 1);
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>