Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / svg / W3C-SVG-1.1 / extend-namespace-01-f.svg
blob14e110f11d6f7706785f5b494c3c4bc23acd61c6
1 <?xml version="1.0" encoding="utf-8" standalone="no"?>
2 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3 <!--======================================================================-->
4 <!--= Copyright 2000 World Wide Web Consortium, (Massachusetts =-->
5 <!--= Institute of Technology, Institut National de Recherche en =-->
6 <!--= Informatique et en Automatique, Keio University). All Rights =-->
7 <!--= Reserved. See http://www.w3.org/Consortium/Legal/. =-->
8 <!--======================================================================-->
9 <!-- ===================================================================== -->
10 <!-- -->
11 <!-- extend-multiNS-BE-01.svg -->
12 <!-- renamed for 1.1 suite to extend-namespace-01-f -->
13 <!-- -->
14 <!-- Test the use of multiple namespaces. -->
15 <!-- Revised for 1.1: Chris Lilley, 15 Mar 2002 -->
16 <!-- -->
17 <!-- Author : Jon Ferraiolo 06-Aug-2000 -->
18 <!-- Revised for 1.1 : Chris Lilley 14-Mar-2002 -->
19 <!--======================================================================-->
20 <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="svg-root" width="480" height="360" viewBox="0 0 480 360" onload="onLoad(evt)">
21 <SVGTestCase xmlns="http://www.w3.org/2000/02/svg/testsuite/description/">
22 <OperatorScript>
23 <Paragraph>Test mixing a business data namespace with elements in SVG namespace.
24 </Paragraph>
25 <Paragraph>The test case uses a different namespace to hold fake sales data.
26 Using ECMAScript to make calls to the DOM, the test case extracts
27 the sales data and then makes calls to the SVG DOM to build up
28 a 'path' element and a 'text' element for each individual pie slice.
29 </Paragraph>
30 <Paragraph>The result should show four pie slices.
31 The first pie slice should be exploded, with a pink fill and a blue border.
32 The other pie slices should have various levels of gray fill and black borders.
33 The name of each region should appear in black towards the center of
34 the pie slice.
35 </Paragraph>
36 </OperatorScript>
37 </SVGTestCase>
38 <title id="test-title">extend-namespace-01-f</title>
39 <desc id="test-desc">
40 Test the use of multiple namespaces.
41 </desc>
42 <!--======================================================================-->
43 <!--Content of Test Case follows... =====================-->
44 <!--======================================================================-->
45 <g id="test-body-content">
46 <g xmlns:bd="http://example.org/ExampleBusinessData">
47 <defs>
48 <script type="text/ecmascript"><![CDATA[
49 var svg_ns = "http://www.w3.org/2000/svg";
50 var bd_ns = "http://example.org/ExampleBusinessData";
51 function onLoad(evt){
52 // Get Document
53 var svgElement = evt.target;
54 var doc = svgElement.ownerDocument;
56 var resultsElement = doc.getElementById('results');
57 var gElement = doc.getElementById('PieParent');
59 // Count the number of regions.
60 RegionNodeList = doc.getElementsByTagNameNS(bd_ns, "Region");
61 regionCount = RegionNodeList.length;
63 // Get the region data.
64 RegionNameNodeList = doc.getElementsByTagNameNS(bd_ns, "RegionName");
65 RegionResultNodeList = doc.getElementsByTagNameNS(bd_ns, "RegionResult");
67 // Get the sum of the values of the regions.
68 var total = 0;
69 for (regionIndex = 0; regionIndex < regionCount; regionIndex++)
70 total = total + Number(RegionResultNodeList.item(regionIndex).firstChild.nodeValue);
72 // Build a pie chart.
73 var startAngle = 0;
74 for (regionIndex = 0; regionIndex < regionCount; regionIndex++) {
75 regionName = RegionNameNodeList.item(regionIndex).firstChild.nodeValue;
76 regionResult = Number(RegionResultNodeList.item(regionIndex).firstChild.nodeValue);
78 // Build the pie slice.
79 textElement = doc.createElementNS(svg_ns, "text");
80 textNode = doc.createTextNode(regionName);
81 textElement.appendChild(textNode);
82 pathElement = doc.createElementNS(svg_ns, "path");
84 endAngle = startAngle - regionResult * Math.PI * 2 / total;
85 dAttribute = "M240,170 L";
86 gray = Math.round(Number(255 * (regionIndex+2)) / (regionCount+2));
87 midAngle = (startAngle + endAngle) / 2;
88 textElement.setAttributeNS(null, "x", Math.round(240+65*Math.cos(midAngle)));
89 textElement.setAttributeNS(null, "y", Math.round(170+65*Math.sin(midAngle)));
91 dAttribute = dAttribute + Math.round(240+100*Math.cos(startAngle));
92 dAttribute = dAttribute + ',';
93 dAttribute = dAttribute + Math.round(170+100*Math.sin(startAngle));
94 dAttribute = dAttribute + ' A100,100 0 0,0 ';
95 dAttribute = dAttribute + Math.round(240+100*Math.cos(endAngle));
96 dAttribute = dAttribute + ',';
97 dAttribute = dAttribute + Math.round(170+100*Math.sin(endAngle));
98 dAttribute = dAttribute + 'z';
99 pathElement.setAttributeNS(null, "d", dAttribute);
100 pathElement.setAttributeNS(null, "fill", "rgb("+gray+","+gray+","+gray+")");
101 pathElement.setAttributeNS(null, "stroke", "black");
102 pathElement.setAttributeNS(null, "stroke-width", "2");
104 // Temporary, for CSS styling.
105 pathElement.setAttributeNS(null, "fill", "rgb("+gray+","+gray+","+gray+")");
106 pathElement.setAttributeNS(null, "stroke", "black");
107 pathElement.setAttributeNS(null, "stroke-width", "2");
109 if (regionIndex == 0) {
110 var firstSliceOffset = 30;
111 var transformValue = "translate(" +
112 Math.round(firstSliceOffset * Math.cos(midAngle)) +
113 "," +
114 Math.round(firstSliceOffset * Math.sin(midAngle)) +
115 ")";
116 pathElement.setAttributeNS(null, "transform", transformValue);
117 textElement.setAttributeNS(null, "transform", transformValue);
118 pathElement.setAttributeNS(null, "fill", "#FF6666");
119 pathElement.setAttributeNS(null, "stroke", "#0000FF");
120 pathElement.setAttributeNS(null, "stroke-width", "3");
122 // Temporary, for CSS styling.
123 pathElement.setAttributeNS(null, "fill", "#FF8888");
124 pathElement.setAttributeNS(null, "stroke", "#0000FF");
125 pathElement.setAttributeNS(null, "stroke-width", "3");
128 gElement.appendChild(pathElement);
129 gElement.appendChild(textElement);
130 startAngle = endAngle;
133 ]]></script>
134 </defs>
135 <bd:Results id="results">
136 <bd:Region>
137 <bd:RegionName>East</bd:RegionName>
138 <bd:RegionResult>3</bd:RegionResult>
139 </bd:Region>
140 <bd:Region>
141 <bd:RegionName>North</bd:RegionName>
142 <bd:RegionResult>4</bd:RegionResult>
143 </bd:Region>
144 <bd:Region>
145 <bd:RegionName>West</bd:RegionName>
146 <bd:RegionResult>5</bd:RegionResult>
147 </bd:Region>
148 <bd:Region>
149 <bd:RegionName>Central</bd:RegionName>
150 <bd:RegionResult>3.2</bd:RegionResult>
151 </bd:Region>
152 <bd:Region>
153 <bd:RegionName>South</bd:RegionName>
154 <bd:RegionResult>6</bd:RegionResult>
155 </bd:Region>
156 </bd:Results>
157 <text font-family="Arial" font-size="16" text-anchor="middle" x="240" y="30">
158 Pie chart built from data in a different namespace.
159 </text>
160 </g>
161 <g id="PieParent" font-family="Arial" text-anchor="middle" font-size="14">
162 <desc>Pie chart is built within this 'g' element</desc>
163 </g>
164 </g>
165 <text id="revision" x="10" y="340" font-size="40" stroke="none" fill="black">$Revision: 1.3 $</text>
166 <rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000000"/>
167 </svg>