Adding discard, playbackOrder, and timelineBegin
authorCyril Concolato <cyril.concolato@telecom-paristech.fr>
Fri, 27 Jul 2012 14:38:22 +0200
changeset 207 414e8e45a121
parent 206 ad417bf773f8
child 208 a9c5eb769875
Adding discard, playbackOrder, and timelineBegin
master/definitions.xml
master/struct.html
--- a/master/definitions.xml	Thu Jul 26 07:40:57 2012 +1000
+++ b/master/definitions.xml	Fri Jul 27 14:38:22 2012 +0200
@@ -173,6 +173,17 @@
     interfaces='SVGDescElement'/>
 
   <element
+    name='discard'
+    href='struct.html#DiscardElement'
+    contentmodel='anyof'
+    elementcategories='descriptive'
+    attributecategories='conditional processing, core'
+    interfaces='SVGDiscardElement'>
+    <attribute name='begin' href='struct.html#DiscardElementBeginAttribute' animatable='no'/>
+    <attribute name='href' href='struct.html#DiscardElementHrefAttribute' animatable='no'/>
+  </element>
+
+  <element
       name='ellipse'
       href='shapes.html#EllipseElement'
       contentmodel='anyof'
@@ -930,6 +941,8 @@
     <attribute name='height' href='struct.html#SVGElementHeightAttribute' animatable='yes'/>
     <attribute name='version' href='struct.html#SVGElementVersionAttribute'/>
     <attribute name='baseProfile' href='struct.html#SVGElementBaseProfileAttribute'/>
+    <attribute name='playbackOrder' href='struct.html#SVGElementPlaybackOrderAttribute' animatable='no'/>
+    <attribute name='timelineBegin' href='struct.html#SVGElementTimelineBeginAttribute' animatable='no'/>
   </element>
 
   <element
--- a/master/struct.html	Thu Jul 26 07:40:57 2012 +1000
+++ b/master/struct.html	Fri Jul 27 14:38:22 2012 +0200
@@ -247,6 +247,92 @@
         See <span class="attr"><a href="interact.html#ZoomAndPanAttribute">'zoomAndPan'</a></span>.
       </p>
     </dd>
+    <dt id="SVGElementPlaybackOrderAttribute">
+      <span class="adef">playbackOrder</span> =
+      <span class="attr-value">"forwardOnly" | "all"</span>
+    </dt>
+    <dd>
+      <p>
+        Indicates whether it is possible to seek backwards in the document. In
+        earlier versions of SVG there was no need to put restrictions on the
+        direction of seeking but with the newly introduced facilities for
+        long-running documents (e.g. the <a href="#DiscardElement">
+          <span class="element-name">'discard'</span></a> element) there is
+        sometimes a need to restrict this.
+      </p>
+      <p>
+        If <span class="attr-name">'playbackOrder'</span> is set to
+        <span class="attr-value">'forwardOnly'</span>, the content will probably
+        contain <a href="#DiscardElement"><span class="element-name">'discard'</span></a>
+        elements or scripts that destroy resources, thus seeking back in the
+        document's timeline may result in missing content.
+        If <span class="attr-name">'playbackOrder'</span> is
+        <span class="attr-value">'forwardOnly'</span>, the content should not
+        provide a way, through hyperlinking or script, of seeking backwards in
+        the timeline.  Similarly the UA should disable any controls it may
+        provide in the user interface for seeking backwards. Content with
+        <span class="attr-name">'playbackOrder'</span> =
+        <span class="attr-value">'forwardOnly'</span> that provides a mechanism
+        for seeking backwards in time may result in undefined behavior or a
+        document that is
+        <a href="intro.html#TermInError"><span class="svg-term">in error</span></a>.
+      </p>
+      <dl>
+        <dt><span class="attr-value">'forwardOnly'</span></dt>
+        <dd>This file is intended to be played only in the forward direction, sequentially, therefore
+          seeking backwards should not be allowed.</dd>
+        <dt><span class="attr-value">'all'</span></dt>
+        <dd>Indicates that the document is authored appropriately for seeking in both directions.</dd>
+      </dl>
+      <p>
+        The <a href="intro.html#TermLacunaValue"><span class="svg-term">lacuna value</span></a>
+        is <span class="attr-value">'all'</span>.
+      </p>
+      <p class="anim-target"><a href="animate.html#Animatable">Animatable</a>: no.</p>
+    </dd>
+    <dt id="SVGElementTimelineBeginAttribute">
+      <span class="adef">timelineBegin</span> =
+      <span class="attr-value">"onLoad" | "onStart"</span>
+    </dt>
+    <dd>
+      <p>
+        Controls the initialization of the timeline for the document.
+      </p>
+      <p>
+        The <a href="#SVGElement"><span class="element-name">'svg'</span></a>
+        element controls the <em>document timeline</em>, which is the timeline of
+        the <a href="#SVGElement"><span class="element-name">'svg'</span></a>
+        element's time container. For progressively loaded animations, the author
+        would typically set this attribute to <span class="attr-value">'onStart'</span>,
+        thus allowing the timeline to begin as the document loads, rather than
+        waiting until the complete document is loaded.
+      </p>
+      <dl>
+        <dt><span class="attr-value">'onLoad'</span></dt>
+        <dd>
+          The document's timeline starts the moment the
+          <a href="interact.html#LoadEvent"><code>load</code></a> event for the
+          <a href="intro.html#TermRootmostSVGElement"><span class="svg-term">rootmost 'svg' element</span></a>
+          is triggered.
+        </dd>
+        <dt><span class="attr-value">'onStart'</span></dt>
+        <dd>
+          The document's timeline starts at the moment the
+          <a href="intro.html#TermRootmostSVGElement"><span class="svg-term">rootmost 'svg' element</span></a>'s
+          <em>start-tag</em>
+          (<a href="http://www.w3.org/TR/2006/REC-xml-20060816/#sec-starttags">as defined in XML 1.0</a>
+          ([<a href="refs.html#ref-XML10">XML10</a>], section 3.1),
+          <a href="http://www.w3.org/TR/2004/REC-xml11-20040204/#sec-starttags">or XML 1.1</a>
+          ([<a href="refs.html#ref-XML11">XML11</a>], section 3.1), if the
+          document is an XML 1.1 document) is fully parsed and processed.
+        </dd>
+      </dl>
+      <p>
+        The <a href="intro.html#TermLacunaValue"><span class="svg-term">lacuna value</span></a>
+        is <span class="attr-value">'onLoad'</span>.
+      </p>
+      <p class="anim-target"><a href="animate.html#Animatable">Animatable</a>: no.</p>
+    </dd>
   </dl>
 </div>
 
@@ -393,6 +479,216 @@
 references the linear gradient. Thus, the above document conforms to the
 guideline.</p>
 
+<h2 id="DiscardElement">The <span class='element-name'>'discard'</span> element</h2>
+
+<edit:with element='DiscardElement'>
+
+<div class="annotation">
+ <p>
+   SVG2 Requirement: Have the discard element to declaratively discard elements from the document tree
+ </p>
+ <p>
+   Resolution: SVG 2 will support the discard element
+ </p>
+ <p>
+   <a href="http://www.w3.org/2012/03/29-svg-minutes.html">SVG Working Group Teleconference 29 Mar 2012</a>.
+ </p>
+ <p>
+   Purpose: To conserve memory while displaying long-running documents. 
+ </p>
+ <p>
+   Owner: Cyril
+ </p>
+</div>
+
+<edit:elementsummary name='discard'/>
+
+<p>
+  The <a href="#DiscardElement"><span class="element-name">'discard'</span></a>
+  element allows authors to specify the time at which particular elements are to
+  be discarded, thereby reducing the resources required by an <a href="intro.html#TermSVGUserAgent"><span class="svg-term">SVG user agent</span></a>.
+  This is particularly useful to help SVG viewers conserve memory while
+  displaying long-running documents.  This element will not be processed by
+  static SVG viewers.
+</p>
+<p>
+  The <a href="#DiscardElement"><span class="element-name">'discard'</span></a>
+  element may occur wherever the
+  <a href="animate.html#AnimateElement"><span class="element-name">'animate'</span></a>
+  element may.
+</p>
+
+<div class="adef-list">
+  <p><em>Attribute definitions:</em></p>
+
+  <dl class="definitions">
+    <dt id="DiscardElementHrefAttribute">
+      <span class="adef">href</span> =
+      "<span class="attr-value"><a href="types.html#DataTypeIRI">&lt;iri&gt;</a></span>"
+    </dt>
+    <dd>
+      <p>
+        An <a href="linking.html#IRIReference"><span class="svg-term">IRI reference</span></a>
+        that identifies the <a href="animate.html#TargetElement">target element</a>
+        to discard.  See the definition of
+        <a href="animate.html#HrefAttribute"><span class="attr-name">'href'</span></a>
+        on <a href="intro.html#TermAnimationElement"><span class="svg-term">animation elements</span></a> for details on identifying a target element.
+      </p>
+      <p>
+        Note that if the target element is not part of the
+        <a href="intro.html#TermCurrentSVGDocumentFragment"><span class="svg-term">current SVG document fragment</span></a>
+        then whether the target element will be removed or not is defined by the
+        <a href="intro.html#TermHostLanguage"><span class="svg-term">host language</span></a>.
+      </p>
+      <p>
+        If the <a href="#DiscardElementHrefAttribute"><span class="attr-name">'href'</span></a>
+        attribute is not provided, then the target element will be the immediate
+        parent element of the discard element.
+      </p>
+      <p class="anim-target"><a href="animate.html#Animatable">Animatable</a>: no.</p>
+    </dd>
+
+    <dt id="DiscardElementBeginAttribute">
+      <span class="adef">begin</span> = "<span class="attr-value"><a href="animate.html#BeginValueListSyntax">begin-value-list</a></span>"
+    </dt>
+
+    <dd>
+      <p>
+        Indicates when the target element will be discarded.  See the definition
+        of <a href="animate.html#BeginAttribute"><span class="attr-name">'begin'</span></a>
+        on <a href="intro.html#TermAnimationElement"><span class="svg-term">animation elements</span></a> for details.
+      </p>
+      <p>
+        The <a href="intro.html#TermLacunaValue"><span class="svg-term">lacuna value</span></a>
+        is <span class="attr-value">'0s'</span>.  This indicates that
+        the <a href="animate.html#TargetElement">target element</a> should be
+        discarded immediately once the document begins.
+      </p>
+      <p class="anim-target"><a href="animate.html#Animatable">Animatable</a>: no.</p>
+    </dd>
+  </dl>
+</div>
+
+<p>
+  The <a href="#DiscardElement"><span class="element-name">'discard'</span></a>
+  element has an implicit
+  <a href="http://www.w3.org/TR/2005/REC-SMIL2-20051213/smil-timing.html#Timing-DefiningSimpleDur">simple duration</a>
+  of <span class="attr-value">"indefinite"</span>.  As soon as the element's
+  <a href="http://www.w3.org/TR/2005/REC-SMIL2-20051213/smil-timing.html#Timing-ComputingActiveDur">active duration</a>
+  starts, the <a href="intro.html#TermSVGUserAgent"><span class="svg-term">SVG user agent</span></a>
+  discards the element identified by the
+  <a href="#DiscardElementHrefAttribute"><span class="attr-name">'href'</span></a>
+  attribute ([<a href="refs.html#ref-SMIL21">SMIL21</a>], section 10.4.3).
+  The removal operation acts as if the method
+  <a href="svgudom.html#dom__Node_removeChild"><code>removeChild</code></a> were
+  called on the parent of the target element with the target element as
+  parameter. The <a href="intro.html#TermSVGUserAgent"><span class="svg-term">SVG user agent</span></a>
+  must remove the target node as well as all of its attributes and descendants.
+</p>
+<p>
+  After removal of the <a href="animate.html#TargetElement">target element</a>,
+  the <a href="#DiscardElement"><span class="element-name">'discard'</span></a>
+  element is no longer useful. It must also be discarded following the
+  target element removal. If the
+  <a href="struct.html#DiscardElementHrefAttribute"><span class="attr-name">'xlink:href'</span></a>
+  attribute has an <a href="intro.html#TermInvalidIRIReference"><span class="svg-term">invalid
+    IRI reference</span></a> (the target element did not exist, for example),
+  the <a href="#DiscardElement"><span class="element-name">'discard'</span></a>
+  element itself must still be removed following activation.
+</p>
+<p>
+  <a href="http://www.w3.org/TR/2005/REC-SMIL2-20051213/smil-timing.html#Timing-HyperlinksAndTiming">Seeking backwards</a>
+  in the timeline ([<a href="refs.html#ref-SMIL21">SMIL21</a>], section 10.4.3)
+  must not re-insert the discarded elements. Discarded elements are intended to
+  be completely removed from memory. So, authors are encouraged to set the
+  <a href="#SVGElementPlaybackOrder"><span class="attr-name">'playbackOrder'</span></a>
+  attribute to <span class="attr-value">"forwardOnly"</span> when using the
+  <a href="#DiscardElement"><span class="element-name">'discard'</span></a> element.
+</p>
+<p>
+  The <a href="#DiscardElement"><span class="element-name">'discard'</span></a>
+  element itself can be discarded prior to its activation, in which case it will
+  never trigger the removal of its own target element.
+  <a href="intro.html#TermSVGUserAgent"><span class="svg-term">SVG user agents</span></a>
+  must allow the <a href="#DiscardElement"><span class="element-name">'discard'</span></a>
+  element to be the target of another
+  <a href="#DiscardElement"><span class="element-name">'discard'</span></a>
+  element.
+</p>
+
+<p>
+  The following example demonstrates a simple usage of the
+  <a href="#DiscardElement"><span class="element-name">'discard'</span></a>
+  element. The list below describes relevant behavior in the document timeline
+  of this example:
+</p>
+
+<dl>
+  <dt>At time = 0:</dt>
+  <dd>When the document timeline starts, the blue ellipse starts to move down the page.</dd>
+  <dt>At time = 1 second:</dt>
+  <dd>The red rectangle starts moving up the page.</dd>
+  <dt>At time = 2 seconds:</dt>
+  <dd>
+    The <a href="animate.html#AnimateTransformElement"><span class="element-name">'animateTransform'</span></a>
+    on the <a href="shapes.html#EllipseElement"><span class="element-name">'ellipse'</span></a>
+    ends. The <a href="shapes.html#EllipseElement"><span class="element-name">'ellipse'</span></a>
+    and its children are also discarded, as it is the
+    <a href="animate.html#TargetElement">target element</a> of a
+    <a href="#DiscardElement"><span class="element-name">'discard'</span></a>
+    with <span class="attr-value">begin="2"</span>. The green
+    <a href="shapes.html#PolygonElement"><span class="element-name">'polygon'</span></a>
+    starts to move across the page.
+  </dd>
+  <dt>At time = 3 seconds:</dt>
+  <dd>
+    The animation on the red rectangle ends. The rectangle and its children are
+    discarded as it is the target of a
+    <a href="#DiscardElement"><span class="element-name">'discard'</span></a>
+    element with <span class="attr-value">begin="3"</span>.
+  </dd>
+  <dt>At time = 4 seconds:</dt>
+  <dd>
+    The animation on the green triangle ends. The green
+    <a href="shapes.html#PolygonElement"><span class="element-name">'polygon'</span></a>
+    and its children are discarded as it is the target of a
+    <a href="#DiscardElement"><span class="element-name">'discard'</span></a>
+    element with <span class="attr-value">begin="4".</span>
+  </dd>
+</dl>
+
+<div class="example"><div class="exampleheader"><strong>Example:</strong> <a href="examples/discard01.svg">discard01.svg</a></div><div class="examplesource"><pre>&lt;?xml version="1.0"?&gt;
+&lt;svg xmlns="http://www.w3.org/2000/svg" version="1.2" baseProfile="tiny" 
+     width="352" height="240" playbackOrder="forwardOnly"&gt;
+    
+  &lt;ellipse cx="98.5" cy="17.5" rx="20.5" ry="17.5" fill="blue" stroke="black" 
+           transform="translate(9 252) translate(3 -296)"&gt;
+    &lt;animateTransform attributeName="transform" begin="0s" dur="2s" fill="remove"
+                      calcMode="linear" type="translate" additive="sum"
+                      from="0 0" to="-18 305"/&gt;
+    &lt;discard begin="2s"/&gt;
+  &lt;/ellipse&gt;
+  
+  &lt;rect x="182" y="-39" width="39" height="30" fill="red" stroke="black"
+        transform="translate(30 301)"&gt;
+    &lt;animateTransform attributeName="transform" begin="1s" dur="2s" fill="remove"
+                      calcMode="linear" type="translate" additive="sum"
+                      from="0 0" to="-26 -304"/&gt;
+    &lt;discard begin="3s"/&gt;
+  &lt;/rect&gt;
+  
+  &lt;polygon points="-66,83.5814 -43,123.419 -89,123.419" fill="green" stroke="black" 
+           transform="matrix(1 0 0 1.1798 0 -18.6096)"&gt;
+    &lt;animateTransform attributeName="transform" begin="2s" dur="2s"
+                      fill="remove" calcMode="linear" type="translate" additive="sum"
+                      from="0 0" to="460 63.5699"/&gt;
+    &lt;discard begin="4s"/&gt;
+  &lt;/polygon&gt;
+&lt;/svg&gt;
+</pre></div></div>
+
+</edit:with>
+
 <h2 id="DescriptionAndTitleElements">The <span class='element-name'>'desc'</span>
 and <span class='element-name'>'title'</span> elements</h2>