layout/reftests/svg/pattern-transform-presence-01.svg

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

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

mercurial