summaryrefslogtreecommitdiffstats
path: root/layout/reftests/svg/smil/restart/reset-6.svg
blob: a0fe33ae2d8c00371394ca38fa4a5b825158c807 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<!--
  SMIL3 5.4.3, "Resetting element state" has:

    Any instance times associated with past Event-values, Repeat-values,
    Accesskey-values or added via DOM method calls are removed from the
    dependent begin and end instance times lists. In effect, all events and DOM
    methods calls in the past are cleared. This does not apply to an instance
    time that defines the begin of the current interval.

  In this test we have the following scenario:

    <set begin="1s" end="2s" dur="1s" ... />

  giving us:

    |...|
    1   2

  Then at t=1.5s we have the following DOM calls

    anim.beginElementAt(1.5);
    anim.endElementAt(2);

  potentially giving us:

    |...|  | |
      ^  
    1   2  3 3.5

  At t=2s we'll go to look for the next interval and construct one from 3s-3.5s.
  We should apply restart behaviour at t=3s meaning we'll reset instance times
  generated by DOM calls in the past however we'll keep the begin instance time
  at 3s since it defines the beginning of the (now) current interval.  Sticking
  to the letter of the spec quoted above however, we'll end up clearing the end
  instance at 3.5s. Yet in this case we should use the active end (t=4s) since
  there's no end attribute specified.
 -->
<svg xmlns="http://www.w3.org/2000/svg"
  xmlns:xlink="http://www.w3.org/1999/xlink"
  class="reftest-wait"
  onload="addInstanceTimes()">
  <script type="text/ecmascript"><![CDATA[
    function addInstanceTimes() {
      var svg = document.documentElement;
      svg.pauseAnimations();
      svg.setCurrentTime(1.5);
      var anim = document.getElementById('anim');
      anim.beginElementAt(1.5);
      anim.endElementAt(2);
      setTimeAndSnapshot(3.7, true);
    }
  ]]></script>
  <script xlink:href="../smil-util.js" type="text/javascript"/>
  <rect width="100" height="100" fill="red">
    <set attributeName="fill" attributeType="CSS"
      to="green" begin="1s" dur="1s" fill="remove" id="anim"/>
  </rect>
</svg>