layout/reftests/svg/smil/anim-pattern-attr-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 <svg xmlns="http://www.w3.org/2000/svg"
michael@0 2 xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 200 600">
michael@0 3 <!-- Bug 544809 - nsSVGPatternFrame::GetPatternWithAttr and callers should
michael@0 4 take account of SMIL animation.
michael@0 5
michael@0 6 Test animating pattern attributes doesn't rely on the presence of
michael@0 7 attributes in the DOM, but also correctly detects attributes set by
michael@0 8 animation.
michael@0 9
michael@0 10 The format of each test is that we have a base pattern named (attName)Ref
michael@0 11 which does NOT specify the attribute under test, but instead sets the
michael@0 12 attribute to a non-default value using animation.
michael@0 13
michael@0 14 Then we have a referencing pattern named (attName) that refers to the
michael@0 15 base pattern and also does NOT specify the attribute under test.
michael@0 16
michael@0 17 When we go to look up the attribute under test we begin at (attName),
michael@0 18 notice the attribute isn't specified (either in the DOM or by animation),
michael@0 19 then go to (attName)Ref and detect that the attribute is specified there
michael@0 20 by animation and use that value.
michael@0 21
michael@0 22 To the right of each test we also include a rect that directly references
michael@0 23 (attName)Ref. The two rectangles should be identical but prior to fixing
michael@0 24 this bug they were not.
michael@0 25 -->
michael@0 26 <!-- 1. patternUnits: defaults to objectBoundingBox -->
michael@0 27 <defs>
michael@0 28 <pattern xlink:href="#patternUnitsRef" id="patternUnits"/>
michael@0 29 <pattern id="patternUnitsRef" width="80" height="80">
michael@0 30 <set attributeName="patternUnits" to="userSpaceOnUse"/>
michael@0 31 <rect width="50" height="50" fill="blue"/>
michael@0 32 <rect x="50" width="50" height="50" fill="red"/>
michael@0 33 <rect y="50" width="50" height="50" fill="red"/>
michael@0 34 <rect x="50" y="50" width="50" height="50" fill="blue"/>
michael@0 35 </pattern>
michael@0 36 </defs>
michael@0 37 <rect width="100" height="100" stroke="black" fill="url(#patternUnits)"/>
michael@0 38 <g transform="translate(100)">
michael@0 39 <rect width="100" height="100" stroke="black" fill="url(#patternUnitsRef)"/>
michael@0 40 </g>
michael@0 41 <!-- 2. patternContentUnits: defaults to userSpaceOnUse -->
michael@0 42 <defs>
michael@0 43 <pattern xlink:href="#patternContentUnitsRef" id="patternContentUnits"/>
michael@0 44 <pattern id="patternContentUnitsRef" width="1" height="1">
michael@0 45 <set attributeName="patternContentUnits" to="objectBoundingBox"/>
michael@0 46 <rect width="0.5" height="0.5" fill="blue"/>
michael@0 47 <rect x="0.5" width="0.5" height="0.5" fill="red"/>
michael@0 48 <rect y="0.5" width="0.5" height="0.5" fill="red"/>
michael@0 49 <rect x="0.5" y="0.5" width="0.5" height="0.5" fill="blue"/>
michael@0 50 </pattern>
michael@0 51 </defs>
michael@0 52 <g transform="translate(0 100)">
michael@0 53 <rect width="100" height="100" stroke="black"
michael@0 54 fill="url(#patternContentUnits)"/>
michael@0 55 <g transform="translate(100)">
michael@0 56 <rect width="100" height="100" stroke="black"
michael@0 57 fill="url(#patternContentUnitsRef)"/>
michael@0 58 </g>
michael@0 59 </g>
michael@0 60 <!-- 3. patternTransform: defaults to identity -->
michael@0 61 <defs>
michael@0 62 <pattern xlink:href="#patternTransformRef" id="patternTransform"/>
michael@0 63 <pattern id="patternTransformRef" width="1" height="1">
michael@0 64 <animateTransform attributeName="patternTransform" type="rotate"
michael@0 65 values="45 50 50" fill="freeze"/>
michael@0 66 <rect width="50" height="50" fill="blue"/>
michael@0 67 <rect x="50" width="50" height="50" fill="red"/>
michael@0 68 <rect y="50" width="50" height="50" fill="red"/>
michael@0 69 <rect x="50" y="50" width="50" height="50" fill="blue"/>
michael@0 70 </pattern>
michael@0 71 </defs>
michael@0 72 <g transform="translate(0 200)">
michael@0 73 <rect width="100" height="100" stroke="black"
michael@0 74 fill="url(#patternTransform)"/>
michael@0 75 <g transform="translate(100)">
michael@0 76 <rect width="100" height="100" stroke="black"
michael@0 77 fill="url(#patternTransformRef)"/>
michael@0 78 </g>
michael@0 79 </g>
michael@0 80 <!-- 4. preserveAspectRatio: defaults to xMidYMid meet -->
michael@0 81 <defs>
michael@0 82 <pattern xlink:href="#parRef" id="par"/>
michael@0 83 <pattern id="parRef" width="1" height="1" viewBox="0.1 0.1 0.6 0.85">
michael@0 84 <set attributeName="preserveAspectRatio" to="none"/>
michael@0 85 <rect width="50" height="50" fill="blue"/>
michael@0 86 <rect x="50" width="50" height="50" fill="red"/>
michael@0 87 <rect y="50" width="50" height="50" fill="red"/>
michael@0 88 <rect x="50" y="50" width="50" height="50" fill="blue"/>
michael@0 89 </pattern>
michael@0 90 </defs>
michael@0 91 <g transform="translate(0 300)">
michael@0 92 <rect width="100" height="100" stroke="black" fill="url(#par)"/>
michael@0 93 <g transform="translate(100)">
michael@0 94 <rect width="100" height="100" stroke="black" fill="url(#parRef)"/>
michael@0 95 </g>
michael@0 96 </g>
michael@0 97 <!-- 5. viewBox -->
michael@0 98 <defs>
michael@0 99 <pattern xlink:href="#viewBoxRef" id="viewBox"/>
michael@0 100 <pattern id="viewBoxRef" width="1" height="1"
michael@0 101 preserveAspectRatio="none">
michael@0 102 <set attributeName="viewBox" to="0.1 0.1 0.6 0.85"/>
michael@0 103 <rect width="50" height="50" fill="blue"/>
michael@0 104 <rect x="50" width="50" height="50" fill="red"/>
michael@0 105 <rect y="50" width="50" height="50" fill="red"/>
michael@0 106 <rect x="50" y="50" width="50" height="50" fill="blue"/>
michael@0 107 </pattern>
michael@0 108 </defs>
michael@0 109 <g transform="translate(0 400)">
michael@0 110 <rect width="100" height="100" stroke="black" fill="url(#viewBox)"/>
michael@0 111 <g transform="translate(100)">
michael@0 112 <rect width="100" height="100" stroke="black" fill="url(#viewBoxRef)"/>
michael@0 113 </g>
michael@0 114 </g>
michael@0 115 <!-- 6. xlink:href
michael@0 116 This attribute is not affected by bug 544809, i.e. it doesn't use
michael@0 117 nsSVGPatternFrame::GetPatternWithAttr, but we test it here for completeness
michael@0 118 -->
michael@0 119 <defs>
michael@0 120 <pattern id="xlink">
michael@0 121 <set attributeName="xlink:href" to="#xlinkRef"/>
michael@0 122 </pattern>
michael@0 123 <pattern id="xlinkRef" width="1" height="1">
michael@0 124 <rect width="50" height="50" fill="blue"/>
michael@0 125 <rect x="50" width="50" height="50" fill="red"/>
michael@0 126 <rect y="50" width="50" height="50" fill="red"/>
michael@0 127 <rect x="50" y="50" width="50" height="50" fill="blue"/>
michael@0 128 </pattern>
michael@0 129 </defs>
michael@0 130 <g transform="translate(0 500)">
michael@0 131 <rect width="100" height="100" stroke="black" fill="url(#xlink)"/>
michael@0 132 <g transform="translate(100)">
michael@0 133 <rect width="100" height="100" stroke="black" fill="url(#xlinkRef)"/>
michael@0 134 </g>
michael@0 135 </g>
michael@0 136 <!-- If adding more tests here, be sure to update the viewBox on the root svg
michael@0 137 element -->
michael@0 138 </svg>

mercurial