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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/reftests/svg/pattern-transform-presence-01.svg	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,58 @@
     1.4 +<?xml version="1.0"?>
     1.5 +<svg xmlns="http://www.w3.org/2000/svg"
     1.6 +  xmlns:xlink="http://www.w3.org/1999/xlink"
     1.7 +  onload="addTransform()" viewBox="0 0 300 100" class="reftest-wait">
     1.8 +<!-- Test that the presence/absence of a patternTransform is correctly detected.
     1.9 +
    1.10 +     Details are below but, in summary, the first two squares should contain the
    1.11 +     same pattern (a diagonal checkerbox) whilst the third square should contain
    1.12 +     a different pattern (actually the same pattern but WITHOUT the rotation).
    1.13 +     -->
    1.14 +<script>
    1.15 +function addTransform()
    1.16 +{
    1.17 +  var g = document.getElementById("patternBase");
    1.18 +  var list = g.patternTransform.baseVal;
    1.19 +  var t = document.documentElement.createSVGTransform();
    1.20 +  t.setRotate(45,50,50);
    1.21 +  list.appendItem(t);
    1.22 +  document.documentElement.removeAttribute("class");
    1.23 +}
    1.24 +</script>
    1.25 +<defs>
    1.26 +  <!-- 1. The base pattern that will be referenced by others.
    1.27 +       When the document loads, script will add a patternTransform to this
    1.28 +       pattern. It does this using *only SVG DOM APIs* (i.e. not setAttribute)
    1.29 +       so that we can test that when a transform is not specified by markup but
    1.30 +       is added via the DOM we still correctly detect its presence. -->
    1.31 +  <pattern id="patternBase" width="1" height="1">
    1.32 +    <rect width="50" height="50" fill="blue"/>
    1.33 +    <rect x="50" width="50" height="50" fill="red"/>
    1.34 +    <rect y="50" width="50" height="50" fill="red"/>
    1.35 +    <rect x="50" y="50" width="50" height="50" fill="blue"/>
    1.36 +  </pattern>
    1.37 +  <!-- 2. References the base pattern and should detect the base pattern's
    1.38 +       patternTransform (added by script) and inherit it. (SVG 1.1 F2 13.3,
    1.39 +       xlink:href 'Any attributes which are defined on the referenced element
    1.40 +       which are not defined on this element are inherited by this element.').
    1.41 +       Hence this pattern should look IDENTICAL to patternBase. -->
    1.42 +  <pattern xlink:href="#patternBase" id="patternRefWithoutTransform"/>
    1.43 +  <!-- 3. References the base pattern but patternTransform is defined (although
    1.44 +       empty) and hence the patternTransform should NOT be inherited and this
    1.45 +       pattern should look DIFFERENT to patternBase. -->
    1.46 +  <pattern xlink:href="#patternBase" id="patternRefWithTransform"
    1.47 +    patternTransform=""/>
    1.48 +  <!-- The case of a patternTransform being supplied by animation is covered by
    1.49 +       SMIL reftest anim-pattern-attr-presence-01.svg -->
    1.50 +</defs>
    1.51 +<rect width="100" height="100" stroke="black"
    1.52 +  fill="url(#patternBase)"/>
    1.53 +<g transform="translate(100)">
    1.54 +  <rect width="100" height="100" stroke="black"
    1.55 +    fill="url(#patternRefWithoutTransform)"/>
    1.56 +</g>
    1.57 +<g transform="translate(200)">
    1.58 +  <rect width="100" height="100" stroke="black"
    1.59 +    fill="url(#patternRefWithTransform)"/>
    1.60 +</g>
    1.61 +</svg>

mercurial