| 1 |
<?xml version="1.0" standalone="no"?> |
| 2 |
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" |
| 3 |
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> |
| 4 |
|
| 5 |
<!-- |
| 6 |
|
| 7 |
Licensed to the Apache Software Foundation (ASF) under one or more |
| 8 |
contributor license agreements. See the NOTICE file distributed with |
| 9 |
this work for additional information regarding copyright ownership. |
| 10 |
The ASF licenses this file to You under the Apache License, Version 2.0 |
| 11 |
(the "License"); you may not use this file except in compliance with |
| 12 |
the License. You may obtain a copy of the License at |
| 13 |
|
| 14 |
http://www.apache.org/licenses/LICENSE-2.0 |
| 15 |
|
| 16 |
Unless required by applicable law or agreed to in writing, software |
| 17 |
distributed under the License is distributed on an "AS IS" BASIS, |
| 18 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 19 |
See the License for the specific language governing permissions and |
| 20 |
limitations under the License. |
| 21 |
|
| 22 |
--> |
| 23 |
<!-- ====================================================================== --> |
| 24 |
<!-- Test of getting/setting current Scale and Translate. --> |
| 25 |
<!-- --> |
| 26 |
<!-- @author [email protected] --> |
| 27 |
<!-- @version $Id$ --> |
| 28 |
<!-- ====================================================================== --> |
| 29 |
|
| 30 |
<?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?> |
| 31 |
|
| 32 |
<svg id="body" width="450" height="500" viewBox="0 0 450 500" |
| 33 |
onload="init()" |
| 34 |
xmlns="http://www.w3.org/2000/svg" |
| 35 |
xmlns:xlink="http://www.w3.org/1999/xlink"> |
| 36 |
|
| 37 |
<title>Test of CSS with relative URIs</title> |
| 38 |
<text class="title" x="50%" y="50">Test of CSS with relative URIs</text> |
| 39 |
|
| 40 |
|
| 41 |
<script type="text/ecmascript"><![CDATA[ |
| 42 |
var root = document.getRootElement(); |
| 43 |
|
| 44 |
var t0 = document.getElementById('t0'); |
| 45 |
var t1 = document.getElementById('t1'); |
| 46 |
var t2 = document.getElementById('t2'); |
| 47 |
var t3 = document.getElementById('t3'); |
| 48 |
var t4 = document.getElementById('t4'); |
| 49 |
var t5 = document.getElementById('t5'); |
| 50 |
var t6 = document.getElementById('t6'); |
| 51 |
var t7 = document.getElementById('t7'); |
| 52 |
var t8 = document.getElementById('t8'); |
| 53 |
var t9 = document.getElementById('t9'); |
| 54 |
var t10 = document.getElementById('t10'); |
| 55 |
var t11 = document.getElementById('t11'); |
| 56 |
var t12 = document.getElementById('t12'); |
| 57 |
var t13 = document.getElementById('t13'); |
| 58 |
var t14 = document.getElementById('t14'); |
| 59 |
|
| 60 |
var docURL = document.getURL(); |
| 61 |
|
| 62 |
function unifyURL(str) { |
| 63 |
var start = str.indexOf(docURL); |
| 64 |
if (start == -1) return str; |
| 65 |
var before = str.substring(0, start); |
| 66 |
var after = str.substring(start+docURL.length); |
| 67 |
return before + "<doc>" + after; |
| 68 |
} |
| 69 |
|
| 70 |
function init() { |
| 71 |
var view = document.getDefaultView(); |
| 72 |
|
| 73 |
var elem = document.getElementById('xxx'); |
| 74 |
var cssStyle = elem.getStyle(); |
| 75 |
var computedStyle = view.getComputedStyle(elem, ""); |
| 76 |
|
| 77 |
cssStyle.setProperty("fill", "url(#grad)",""); |
| 78 |
var localStr = cssStyle.getPropertyValue("fill"); |
| 79 |
var absStr = computedStyle.getPropertyValue("fill"); |
| 80 |
t1.firstChild.nodeValue = unifyURL(localStr); |
| 81 |
t2.firstChild.nodeValue = unifyURL(absStr); |
| 82 |
|
| 83 |
cssStyle.setProperty("cursor", "url(#cur),crosshair",""); |
| 84 |
localStr = cssStyle.getPropertyValue("cursor"); |
| 85 |
absStr = computedStyle.getPropertyCSSValue("cursor"); |
| 86 |
absStr = absStr.item(0).getCssText(); |
| 87 |
t3.firstChild.nodeValue = unifyURL(localStr); |
| 88 |
t4.firstChild.nodeValue = unifyURL(absStr); |
| 89 |
|
| 90 |
cssStyle.setProperty("clip-path", "url(#clip)",""); |
| 91 |
localStr = cssStyle.getPropertyValue("clip-path"); |
| 92 |
absStr = computedStyle.getPropertyValue("clip-path"); |
| 93 |
t5.firstChild.nodeValue = unifyURL(localStr); |
| 94 |
t6.firstChild.nodeValue = unifyURL(absStr); |
| 95 |
|
| 96 |
cssStyle.setProperty("color-profile", "url(#prof)",""); |
| 97 |
localStr = cssStyle.getPropertyValue("color-profile"); |
| 98 |
absStr = computedStyle.getPropertyValue("color-profile"); |
| 99 |
t7.firstChild.nodeValue = unifyURL(localStr); |
| 100 |
t8.firstChild.nodeValue = unifyURL(absStr); |
| 101 |
|
| 102 |
cssStyle.setProperty("filter", "url(#filt)",""); |
| 103 |
localStr = cssStyle.getPropertyValue("filter"); |
| 104 |
absStr = computedStyle.getPropertyValue("filter"); |
| 105 |
t9.firstChild.nodeValue = unifyURL(localStr); |
| 106 |
t10.firstChild.nodeValue = unifyURL(absStr); |
| 107 |
|
| 108 |
elem = document.getElementById('yyy'); |
| 109 |
var cssStyle = elem.getStyle(); |
| 110 |
computedStyle = view.getComputedStyle(elem, ""); |
| 111 |
|
| 112 |
cssStyle.setProperty("marker-start", "url(#mark)",""); |
| 113 |
localStr = cssStyle.getPropertyValue("marker-start"); |
| 114 |
absStr = computedStyle.getPropertyValue("marker-start"); |
| 115 |
t11.firstChild.nodeValue = unifyURL(localStr); |
| 116 |
t12.firstChild.nodeValue = unifyURL(absStr); |
| 117 |
|
| 118 |
cssStyle.setProperty("mask", "url(#mask)",""); |
| 119 |
localStr = cssStyle.getPropertyValue("mask"); |
| 120 |
absStr = computedStyle.getPropertyValue("mask"); |
| 121 |
t13.firstChild.nodeValue = unifyURL(localStr); |
| 122 |
t14.firstChild.nodeValue = unifyURL(absStr); |
| 123 |
} |
| 124 |
|
| 125 |
function regardStart() { |
| 126 |
inRegard = true; |
| 127 |
} |
| 128 |
]]></script> |
| 129 |
|
| 130 |
<!-- cursor, src, clip-path, color-profile, filter, marker, mask --> |
| 131 |
|
| 132 |
<radialGradient id="grad"> |
| 133 |
<stop offset="0" stop-color="gold" /> |
| 134 |
<stop offset="1" stop-color="crimson" /> |
| 135 |
</radialGradient> |
| 136 |
|
| 137 |
<cursor id="cur" x="16" y="16" |
| 138 |
xlink:href="../../resources/images/hotSpotCenter.png"/> |
| 139 |
|
| 140 |
<clipPath id="clip" clipPathUnits="objectBoundingBox"> |
| 141 |
<circle cx=".25" cy=".5" r=".4"/> |
| 142 |
<circle cx=".75" cy=".5" r=".4"/> |
| 143 |
</clipPath> |
| 144 |
|
| 145 |
<color-profile id="prof" name="changeColorAuto" |
| 146 |
rendering-intent="auto" |
| 147 |
xlink:href="../../resources/icc/changeColor.icm"/> |
| 148 |
|
| 149 |
<filter id="filt" primitiveUnits="objectBoundingBox" |
| 150 |
filterUnits="objectBoundingBox" |
| 151 |
x="0" y="0" width="200%" height="200%"> |
| 152 |
<feOffset x="0%" y="0%" width="50%" height="50%"/> |
| 153 |
<feTile /> |
| 154 |
</filter> |
| 155 |
|
| 156 |
<marker id="mark" markerWidth="48" markerHeight="32" |
| 157 |
viewBox="-10 -3 13 6" orient="auto" refX="0" refY="0" |
| 158 |
markerUnits="strokeWidth"> |
| 159 |
<g stroke="none" fill="gold"> |
| 160 |
<circle r="3" /> |
| 161 |
<rect x="-1" y="0" width="2" height="7" /> |
| 162 |
<path d="M -3 6 l 6 0 l -3 3 z" /> |
| 163 |
</g> |
| 164 |
</marker> |
| 165 |
|
| 166 |
<mask id="mask"> |
| 167 |
<g transform="translate(275, 400)"> |
| 168 |
<circle cx="-25" cy="-10" r="25" fill="#ff0000" /> |
| 169 |
<circle cx="25" cy="-10" r="25" fill="#00ff00" /> |
| 170 |
<circle cx="-25" cy="10" r="25" fill="#0000ff" /> |
| 171 |
<circle cx="25" cy="10" r="25" fill="#ffffff" /> |
| 172 |
</g> |
| 173 |
</mask> |
| 174 |
|
| 175 |
<g transform="translate(30, 75)"> |
| 176 |
<g stroke="black" > |
| 177 |
<rect x="120" y="15" width="210" height="30" fill="white"/> |
| 178 |
<rect x="20" y="45" width="310" height="30" fill="lightgrey"/> |
| 179 |
<rect x="20" y="75" width="310" height="30" fill="white"/> |
| 180 |
<rect x="20" y="105" width="310" height="30" fill="lightgrey"/> |
| 181 |
<rect x="20" y="135" width="310" height="30" fill="white"/> |
| 182 |
<rect x="20" y="165" width="310" height="30" fill="lightgrey"/> |
| 183 |
<rect x="20" y="195" width="310" height="30" fill="white"/> |
| 184 |
<rect x="20" y="225" width="310" height="30" fill="lightgrey"/> |
| 185 |
<line x1="225" y1="15" x2="225" y2="255"/> |
| 186 |
<line x1="120" y1="15" x2="120" y2="255"/> |
| 187 |
</g> |
| 188 |
<g text-anchor="middle"> |
| 189 |
<text x="175" y="35">Style</text> |
| 190 |
<text x="275" y="35">Computed</text> |
| 191 |
|
| 192 |
<text x="75" y="65">fill</text> |
| 193 |
<text id="t1" x="175" y="65"> </text> |
| 194 |
<text id="t2" x="275" y="65"> </text> |
| 195 |
|
| 196 |
<text x="75" y="95">cursor</text> |
| 197 |
<text id="t3" x="175" y="95"> </text> |
| 198 |
<text id="t4" x="275" y="95"> </text> |
| 199 |
|
| 200 |
<text x="75" y="125">clip-path</text> |
| 201 |
<text id="t5" x="175" y="125"> </text> |
| 202 |
<text id="t6" x="275" y="126"> </text> |
| 203 |
|
| 204 |
<text x="75" y="155">color-profile</text> |
| 205 |
<text id="t7" x="175" y="155"> </text> |
| 206 |
<text id="t8" x="275" y="155"> </text> |
| 207 |
|
| 208 |
<text x="75" y="185">filter</text> |
| 209 |
<text id="t9" x="175" y="185"> </text> |
| 210 |
<text id="t10" x="275" y="185"> </text> |
| 211 |
|
| 212 |
<text x="75" y="215">marker</text> |
| 213 |
<text id="t11" x="175" y="215"> </text> |
| 214 |
<text id="t12" x="275" y="215"> </text> |
| 215 |
|
| 216 |
<text x="75" y="245">mask</text> |
| 217 |
<text id="t13" x="175" y="245"> </text> |
| 218 |
<text id="t14" x="275" y="245"> </text> |
| 219 |
</g> |
| 220 |
</g> |
| 221 |
<rect id="xxx" x="75" y="375" width="100" height="50" |
| 222 |
style="fill:blue"/> |
| 223 |
|
| 224 |
<path id="yyy" d="M225 375 h 100 v 50 h -100 z" |
| 225 |
marker-end="url(#mark)" |
| 226 |
style="fill:crimson" stroke="black" stroke-width="1"/> |
| 227 |
|
| 228 |
</svg> |