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>
12 var SVGNS = "http://www.w3.org/2000/svg";
14 var colors = ["red", "green"];
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);
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);
33 function updateFill() {
34 var el = document.getElementById("shape");
35 var defs = document.getElementById("defs");
37 while (defs.firstChild)
38 defs.removeChild(defs.firstChild);
42 el.setAttribute("fill", "url(#pat)");
46 testRunner.notifyDone();
49 function repaintTest() {
51 testRunner.waitUntilDone();
54 setTimeout("updateFill()", 0);
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>