Bug 1919788 - LSNG: Always acquire a directory lock for PreparedDatastoreOp; r=dom...
[gecko.git] / layout / reftests / svg / pattern-transform-presence-01.svg
blob2ddfaed065f9dd07a5901269e516101251c94098
1 <?xml version="1.0"?>
2 <svg xmlns="http://www.w3.org/2000/svg"
3 xmlns:xlink="http://www.w3.org/1999/xlink"
4 onload="addTransform()" viewBox="0 0 300 100" class="reftest-wait">
5 <!-- Test that the presence/absence of a patternTransform is correctly detected.
7 Details are below but, in summary, the first two squares should contain the
8 same pattern (a diagonal checkerbox) whilst the third square should contain
9 a different pattern (actually the same pattern but WITHOUT the rotation).
10 -->
11 <script>
12 function addTransform()
14 var g = document.getElementById("patternBase");
15 var list = g.patternTransform.baseVal;
16 var t = document.documentElement.createSVGTransform();
17 t.setRotate(45,50,50);
18 list.appendItem(t);
19 document.documentElement.removeAttribute("class");
21 </script>
22 <defs>
23 <!-- 1. The base pattern that will be referenced by others.
24 When the document loads, script will add a patternTransform to this
25 pattern. It does this using *only SVG DOM APIs* (i.e. not setAttribute)
26 so that we can test that when a transform is not specified by markup but
27 is added via the DOM we still correctly detect its presence. -->
28 <pattern id="patternBase" width="1" height="1">
29 <rect width="50" height="50" fill="blue"/>
30 <rect x="50" width="50" height="50" fill="red"/>
31 <rect y="50" width="50" height="50" fill="red"/>
32 <rect x="50" y="50" width="50" height="50" fill="blue"/>
33 </pattern>
34 <!-- 2. References the base pattern and should detect the base pattern's
35 patternTransform (added by script) and inherit it. (SVG 1.1 F2 13.3,
36 xlink:href 'Any attributes which are defined on the referenced element
37 which are not defined on this element are inherited by this element.').
38 Hence this pattern should look IDENTICAL to patternBase. -->
39 <pattern xlink:href="#patternBase" id="patternRefWithoutTransform"/>
40 <!-- There's no way to differentiate an explicitly specified (but empty)
41 transform from no transform, so this should look IDENTICAL to patternBase -->
42 <pattern xlink:href="#patternBase" id="patternRefWithTransform"
43 patternTransform=""/>
44 <!-- The case of a patternTransform being supplied by animation is covered by
45 SMIL reftest anim-pattern-attr-presence-01.svg -->
46 </defs>
47 <rect width="100" height="100" stroke="black"
48 fill="url(#patternBase)"/>
49 <g transform="translate(100)">
50 <rect width="100" height="100" stroke="black"
51 fill="url(#patternRefWithoutTransform)"/>
52 </g>
53 <g transform="translate(200)">
54 <rect width="100" height="100" stroke="black"
55 fill="url(#patternRefWithTransform)"/>
56 </g>
57 </svg>