Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / svg / carto.net / window.svg
blob86baa10a1c0de8a7b4e1a6e8a23ff176b8122ef5
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
3 <!ATTLIST svg
4 xmlns:attrib CDATA #IMPLIED
5 xmlns:batik CDATA #IMPLIED
7 <!ATTLIST text
8 attrib:buttonText CDATA #IMPLIED
11 <?AdobeSVGViewer save="snapshot"?>
12 <svg width="100%" height="100%" viewBox="0 0 1024 700" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:attrib="http://www.carto.net/attrib" xmlns:batik="http://xml.apache.org/batik/ext" onload="runRepaintAndPixelTest()">
13 <script type="text/ecmascript" xlink:href="../../fast/repaint/resources/text-based-repaint.js"></script>
14 <script type="text/ecmascript" xlink:href="resources/helper_functions.js"/>
15 <script type="text/ecmascript" xlink:href="resources/mapApp.js"/>
16 <script type="text/ecmascript" xlink:href="resources/timer.js"/>
17 <script type="text/ecmascript" xlink:href="resources/window.js"/>
18 <script type="text/ecmascript"><![CDATA[
19 // WebKit modification: do not terminate before all create functions
20 // have been called. This call, the notifyDone() below, and all calls
21 // to createCalled() were added to prevent a race in which the test may
22 // terminate before the final window decoration is added.
23 // See <https://bugs.webkit.org/show_bug.cgi?id=21531>.
24 window.testIsAsync = true;
26 var numberOfWindows = 7;
27 var createCalls = 0;
29 function createCalled() {
30 if (++createCalls == numberOfWindows && window.testRunner)
31 finishRepaintTest();
34 //global variables for map application and navigation
35 var myMapApp = new mapApp(false,undefined);
36 function repaintTest() {
37 //start a new window array in myMapApp
38 myMapApp.Windows = new Array();
39 //first a few styles
40 var winPlaceholderStyles = {"fill":"none","stroke":"dimgray","stroke-width":1.5};
41 var windowStyles = {"fill":"aliceblue","stroke":"dimgray","stroke-width":1};
42 var titlebarStyles = {"fill":"gainsboro","stroke":"dimgray","stroke-width":1};
43 var statusbarStyles = {"fill":"aliceblue","stroke":"dimgray","stroke-width":1};
44 var titletextStyles = {"font-family":"Arial,Helvetica","font-size":14,"fill":"dimgray"};
45 var statustextStyles = {"font-family":"Arial,Helvetica","font-size":10,"fill":"dimgray"};
46 var buttonStyles = {"fill":"none","stroke":"dimgray","stroke-width":1};
47 var titlebarHeight = 17;
48 var statusbarHeight = 13;
49 //create new window instance and add it to the Windows array with the windowId as a key
50 myMapApp.Windows["navWindow"] = new Window("navWindow","Windows",220,200,800,85,true,0,80,1024,700,true,winPlaceholderStyles,windowStyles,3,false,true,"Navigation Window","Statusbar",true,true,true,titlebarStyles,titlebarHeight,statusbarStyles,statusbarHeight,titletextStyles,statustextStyles,buttonStyles,buttonTextChange);
51 myMapApp.Windows["bigWindow"] = new Window("bigWindow","Windows",700,500,50,150,true,0,80,1024,700,false,winPlaceholderStyles,windowStyles,3,true,true,"Big Window","This is a big movable window",true,true,true,titlebarStyles,titlebarHeight,statusbarStyles,statusbarHeight,titletextStyles,statustextStyles,buttonStyles,buttonTextChange);
52 myMapApp.Windows["nestedWindow"] = new Window("nestedWindow","windowMainGroupbigWindow",400,300,50,50,true,0,17,700,487,false,winPlaceholderStyles,windowStyles,3,true,true,"Nested middlesize Window","This window contains other windows",true,true,true,titlebarStyles,titlebarHeight,statusbarStyles,statusbarHeight,titletextStyles,statustextStyles,buttonStyles,buttonTextChange);
53 myMapApp.Windows["smallWindow"] = new Window("smallWindow","windowMainGroupbigWindow",200,180,350,300,true,0,17,700,487,true,winPlaceholderStyles,windowStyles,3,true,true,"Small Window","Callback function is active",true,true,true,titlebarStyles,titlebarHeight,statusbarStyles,statusbarHeight,titletextStyles,statustextStyles,buttonStyles,windowEvents);
54 myMapApp.Windows["colourPickerWindow"] = new Window("colourPickerWindow","windowMainGroupnestedWindow",220,180,0,17,true,0,17,400,287,true,winPlaceholderStyles,windowStyles,3,true,true,"Colour Picker","Changing a colour changes background",true,true,true,titlebarStyles,titlebarHeight,statusbarStyles,statusbarHeight,titletextStyles,statustextStyles,buttonStyles,buttonTextChange);
55 myMapApp.Windows["statusWindow"] = new Window("statusWindow","windowMainGroupnestedWindow",180,80,220,207,false,0,17,400,287,true,winPlaceholderStyles,windowStyles,3,true,false,"Status Window","This window is non-moveable",false,true,true,titlebarStyles,titlebarHeight,statusbarStyles,statusbarHeight,titletextStyles,statustextStyles,buttonStyles,createCalled);
56 myMapApp.Windows["minimalWindow"] = new Window("minimalWindow","windowMainGroupbigWindow",150,60,1,426,false,0,0,700,500,true,winPlaceholderStyles,windowStyles,3,false,false,"","",false,false,false,titlebarStyles,titlebarHeight,statusbarStyles,statusbarHeight,titletextStyles,statustextStyles,buttonStyles,createCalled);
57 myMapApp.Windows["navWindow"].appendContent("textNavWindow",true);
58 myMapApp.Windows["statusWindow"].appendContent("textStatusWindow",true);
59 myMapApp.Windows["smallWindow"].appendContent("textSmallWindow",true);
60 myMapApp.Windows["minimalWindow"].appendContent("textMinimalWindow",true);
63 function windowEvents(id,evtType) {
64 if (evtType == "removed") {
65 alert("window with id " + id + " was removed");
67 if (evtType == "closed") {
68 buttonTextChange(id,evtType);
69 alert("window with id " + id + " was closed");
71 if (evtType == "opened") {
72 buttonTextChange(id,evtType);
73 alert("window with id " + id + " was opened");
75 if (evtType == "minimized") {
76 alert("window with id " + id + " was minimized");
78 if (evtType == "maximized") {
79 alert("window with id " + id + " was maximized");
81 if (evtType == "movedTo") {
82 alert("window with id " + id + " was moved to a new position");
84 if (evtType == "moved") {
85 statusChange("window with id " + id + " was moved to "+Math.round(myMapApp.Windows[id].transX) + ", " + Math.round(myMapApp.Windows[id].transY));
87 if (evtType == "moveStart") {
88 statusChange("window with id " + id + " just started movement");
90 if (evtType == "moveEnd") {
91 statusChange("window with id " + id + " just stopped movement");
93 if (evtType == "created") {
94 createCalled();
97 function openCloseWindow(id) {
98 if (myMapApp.Windows[id].closed) {
99 myMapApp.Windows[id].open(true);
101 else {
102 myMapApp.Windows[id].close(true);
105 function buttonTextChange(id,status) {
106 if (status == "closed" || status == "opened") {
107 var buttonText = document.getElementById("buttonText"+id);
108 butText = buttonText.getAttributeNS(attribNS,"buttonText");
109 if (myMapApp.Windows[id].closed) {
110 buttonText.firstChild.nodeValue = "Open " + butText;
112 else {
113 buttonText.firstChild.nodeValue = "Close " + butText;
116 if (id == "navWindow") {
117 if (status == "created" || status == "resized") {
118 addOrUpdateWindowDecoration(id);
121 if (status == "created") {
122 createCalled();
125 function resizeNavWindow() {
126 var width = 220 + Math.round(Math.random() * 100);
127 var height = 220 + Math.round(Math.random() * 100);
128 myMapApp.Windows["navWindow"].resize(width,height,true);
130 function addOrUpdateWindowDecoration(id) {
131 var myWindow = myMapApp.Windows[id];
132 var group = document.createElementNS(svgNS,"g");
133 var rect1 = document.createElementNS(svgNS,"rect");
134 rect1.setAttributeNS(null,"x",-15);
135 rect1.setAttributeNS(null,"y",-15);
136 rect1.setAttributeNS(null,"width",20);
137 rect1.setAttributeNS(null,"height",(myWindow.height+2));
138 rect1.setAttributeNS(null,"fill","lightsteelblue");
139 rect1.setAttributeNS(null,"stroke","none");
140 group.appendChild(rect1);
141 var rect2 = document.createElementNS(svgNS,"rect");
142 rect2.setAttributeNS(null,"x",-15);
143 rect2.setAttributeNS(null,"y",-15);
144 rect2.setAttributeNS(null,"width",(myWindow.width + 16));
145 rect2.setAttributeNS(null,"height",20);
146 rect2.setAttributeNS(null,"fill","lightsteelblue");
147 rect2.setAttributeNS(null,"stroke","none");
148 rect2.setAttributeNS(null,"id","decoGroupMinimized"+myWindow.id);
149 group.appendChild(rect2);
150 var text = document.createElementNS(svgNS,"text");
151 text.setAttributeNS(null,"x",0);
152 text.setAttributeNS(null,"y",myWindow.height-20);
153 text.setAttributeNS(null,"font-family","Arial,Helvetica");
154 text.setAttributeNS(null,"font-size",12);
155 text.setAttributeNS(null,"fill","dimgray");
156 text.setAttributeNS(null,"transform","rotate(-90,0,"+(myWindow.height-20)+")");
157 text.setAttributeNS(null,"pointer-events","none");
158 var textNode = document.createTextNode(myWindow.titleText);
159 text.appendChild(textNode);
160 group.appendChild(text);
161 //move buttons
162 var x = -5;
163 var curY = -5;
164 if (myWindow.closeButton) {
165 myWindow.closeButtonInstance.setAttributeNS(null,"x",x);
166 myWindow.closeButtonInstance.setAttributeNS(null,"y",curY);
167 curY += 20;
169 if (myWindow.maximizeButton) {
170 myWindow.maximizeButtonInstance.setAttributeNS(null,"x",x);
171 myWindow.maximizeButtonInstance.setAttributeNS(null,"y",curY);
172 curY += 20;
174 if (myWindow.minimizeButton) {
175 myWindow.minimizeButtonInstance.setAttributeNS(null,"x",x);
176 myWindow.minimizeButtonInstance.setAttributeNS(null,"y",curY);
178 myWindow.addWindowDecoration(group,true,"top");
180 ]]></script>
181 <defs>
182 <!-- this symbol is used for the primitive button widgets -->
183 <symbol id="buttonRect" overflow="visible">
184 <rect x="-70" y="-10" width="140" height="20" fill="gainsboro" stroke="dimgray" stroke-width="1" />
185 </symbol>
186 </defs>
187 <rect id="background" fill="lightgray" stroke="none" x="-5000" y="-5000" width="15000" height="15000" />
188 <rect id="titlerect" fill="white" stroke="none" x="-5000" y="0" width="15000" height="80" />
189 <!-- rects for indicating boundaries -->
190 <rect fill="white" stroke="none" x="-5000" y="-5000" width="5000" height="15000" />
191 <rect fill="white" stroke="none" x="1024" y="-5000" width="5000" height="15000" />
192 <rect fill="white" stroke="none" x="-5000" y="700" width="15000" height="5000" />
193 <text id="titleText" font-family="Arial,Helvetica" fill="dimgray" font-size="20px" x="10" y="30">Demonstration of the Window object</text>
194 <text id="statusText" font-family="Arial,Helvetica" fill="dimgray" font-size="14px" x="10" y="50">Statustext</text>
195 <text id="textNavWindow" x="10" y="25" font-family="Arial,Helvetica" fill="dimgray" font-size="14px" pointer-events="none" display="none">This window should<tspan x="10" dy="16">contain navigation tools</tspan><tspan x="10" dy="22">Click on button</tspan><tspan x="10" dy="16">'Resize Navigation Window' for a</tspan><tspan x="10" dy="16">random resize of this Window</tspan><tspan x="10" dy="22">Note that this window also</tspan><tspan x="10" dy="16">features a window decoration</tspan></text>
196 <text id="textStatusWindow" x="10" y="40" font-family="Arial,Helvetica" fill="dimgray" font-size="14px" pointer-events="none" display="none">This is a none-moveable<tspan x="10" dy="16">none-closeable status</tspan><tspan x="10" dy="16">window</tspan></text>
197 <text id="textSmallWindow" x="10" y="40" font-family="Arial,Helvetica" fill="dimgray" font-size="14px" pointer-events="none" display="none">This window has a callback<tspan x="10" dy="16">function indicating mouse</tspan><tspan x="10" dy="16">movements in the statusbar</tspan><tspan x="10" dy="16">and alerting window</tspan><tspan x="10" dy="16">events</tspan></text>
198 <text id="textMinimalWindow" x="5" y="16" font-family="Arial,Helvetica" fill="dimgray" font-size="12px" pointer-events="none" display="none">This is a minimal window<tspan x="5" dy="16">without title and status bar.</tspan><tspan x="5" dy="16">it is also not moveable</tspan></text>
199 <!-- primitive buttons for opening and closing windows -->
200 <use x="480" y="20" xlink:href="#buttonRect" onclick="openCloseWindow('navWindow')"/>
201 <text id="buttonTextnavWindow" font-family="Arial,Helvetica" fill="dimgray" text-anchor="middle" font-size="11px" attrib:buttonText="Navigation Window" x="480" y="25" pointer-events="none">Close Navigation Window</text>
202 <use x="630" y="20" xlink:href="#buttonRect" onclick="openCloseWindow('bigWindow')"/>
203 <text id="buttonTextbigWindow" font-family="Arial,Helvetica" fill="dimgray" text-anchor="middle" font-size="11px" attrib:buttonText="Big Window" x="630" y="25" pointer-events="none">Close Big Window</text>
204 <use x="780" y="20" xlink:href="#buttonRect" onclick="openCloseWindow('nestedWindow')"/>
205 <text id="buttonTextnestedWindow" font-family="Arial,Helvetica" fill="dimgray" text-anchor="middle" font-size="11px" attrib:buttonText="Middlesize Window" x="780" y="25" pointer-events="none">Close Middlesize Window</text>
206 <use x="930" y="20" xlink:href="#buttonRect" onclick="openCloseWindow('colourPickerWindow')"/>
207 <text id="buttonTextcolourPickerWindow" font-family="Arial,Helvetica" fill="dimgray" text-anchor="middle" font-size="11px" attrib:buttonText="Colour Picker" x="930" y="25" pointer-events="none">Close Colour Picker</text>
208 <use x="930" y="50" xlink:href="#buttonRect" onclick="openCloseWindow('smallWindow')"/>
209 <text id="buttonTextsmallWindow" font-family="Arial,Helvetica" fill="dimgray" text-anchor="middle" font-size="11px" attrib:buttonText="Small Window" x="930" y="55" pointer-events="none">Close Small Window</text>
210 <use x="480" y="50" xlink:href="#buttonRect" onclick="resizeNavWindow()"/>
211 <text id="buttonTextResizeNavWindow" font-family="Arial,Helvetica" fill="dimgray" text-anchor="middle" font-size="11px" attrib:buttonText="Resize Navigation Window" x="480" y="55" pointer-events="none">Resize Navigation Window</text>
212 </svg>