Bug 485157: SMIL event timing, part 1 refactor added end time handling, r=dholbert, sr=roc, a=roc
@ -104,7 +104,7 @@ nsSMILInstanceTime::nsSMILInstanceTime(const nsSMILTimeValue& aTime,
|
||||
|
||||
nsSMILInstanceTime::~nsSMILInstanceTime()
|
||||
{
|
||||
NS_ABORT_IF_FALSE(!mBaseInterval && !mCreator,
|
||||
NS_ABORT_IF_FALSE(!mBaseInterval,
|
||||
"Destroying instance time without first calling Unlink()");
|
||||
NS_ABORT_IF_FALSE(mFixedEndpointRefCnt == 0,
|
||||
"Destroying instance time that is still used as the fixed endpoint of an "
|
||||
|
@ -140,8 +140,9 @@ protected:
|
||||
enum {
|
||||
// Indicates that this instance time was generated by an event or a DOM
|
||||
// call. Such instance times require special handling when (i) the owning
|
||||
// element is reset, and (ii) when a backwards seek is performed and the
|
||||
// timing model is reconstructed.
|
||||
// element is reset, (ii) when they are to be added as a new end instance
|
||||
// times (as per SMIL's event sensitivity contraints), and (iii) when
|
||||
// a backwards seek is performed and the timing model is reconstructed.
|
||||
kDynamic = 1,
|
||||
|
||||
// Indicates that this instance time is referred to by an
|
||||
|
@ -343,6 +343,19 @@ nsSMILTimedElement::AddInstanceTime(nsSMILInstanceTime* aInstanceTime,
|
||||
{
|
||||
NS_ABORT_IF_FALSE(aInstanceTime, "Attempting to add null instance time");
|
||||
|
||||
// Event-sensitivity: If an element is not active (but the parent time
|
||||
// container is), then events are only handled for begin specifications.
|
||||
if (mElementState != STATE_ACTIVE && !aIsBegin &&
|
||||
aInstanceTime->IsDynamic())
|
||||
{
|
||||
// No need to call Unlink here--dynamic instance times shouldn't be linked
|
||||
// to anything that's going to miss them
|
||||
NS_ABORT_IF_FALSE(!aInstanceTime->GetBaseInterval(),
|
||||
"Dynamic instance time has a base interval--we probably need to unlink"
|
||||
" it if we're not going to use it");
|
||||
return;
|
||||
}
|
||||
|
||||
aInstanceTime->SetSerial(++mInstanceSerialIndex);
|
||||
InstanceTimeList& instanceList = aIsBegin ? mBeginInstances : mEndInstances;
|
||||
nsRefPtr<nsSMILInstanceTime>* inserted =
|
||||
|
@ -3,6 +3,6 @@
|
||||
== reset-2.svg green-box-ref.svg
|
||||
== reset-3.svg green-box-ref.svg
|
||||
== reset-4.svg green-box-ref.svg
|
||||
== reset-5.svg green-box-ref.svg
|
||||
# reset-5.svg is no longer valid and has been removed
|
||||
== reset-6.svg green-box-ref.svg
|
||||
== reset-7.svg green-box-ref.svg
|
||||
|
@ -7,8 +7,9 @@
|
||||
|..| |..|
|
||||
1 2 3 4
|
||||
|
||||
But at t=2.5s we add an end instance at t=3.5s. This should be cleared when we
|
||||
restart at t=3s and hence the animation should still be playing after t=3.5s.
|
||||
But at t=2.5s we add a begin instance at t=3.9s. This should be cleared when
|
||||
we restart at t=3s and hence the animation should no longer be playing at
|
||||
t=4s.
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
@ -20,13 +21,13 @@
|
||||
svg.pauseAnimations();
|
||||
svg.setCurrentTime(2.5);
|
||||
var anim = document.getElementById('anim');
|
||||
anim.endElementAt(1);
|
||||
setTimeAndSnapshot(3.7, true);
|
||||
anim.beginElementAt(1.4);
|
||||
setTimeAndSnapshot(4.0, true);
|
||||
}
|
||||
]]></script>
|
||||
<script xlink:href="../smil-util.js" type="text/javascript"/>
|
||||
<rect width="100" height="100" fill="red">
|
||||
<rect width="100" height="100" fill="green">
|
||||
<set attributeName="fill" attributeType="CSS"
|
||||
to="green" begin="1s; 3s" end="2s; 4s" dur="1s" fill="remove" id="anim"/>
|
||||
to="red" begin="1s; 3s" dur="1s" fill="remove" id="anim"/>
|
||||
</rect>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
@ -13,9 +13,9 @@
|
||||
|..|
|
||||
1 2
|
||||
|
||||
But at t=0.5s we add an end instance at t=1.5s. This should NOT be cleared
|
||||
when we start at t=1s and hence the animation should NOT still be playing
|
||||
after t=1.5s.
|
||||
But at t=0.5s we add a begin instance at t=1.5s. This should NOT be cleared
|
||||
when we start at t=1s and hence the animation should STILL be playing
|
||||
at t=2.0s.
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
@ -27,13 +27,13 @@
|
||||
svg.pauseAnimations();
|
||||
svg.setCurrentTime(0.5);
|
||||
var anim = document.getElementById('anim');
|
||||
anim.endElementAt(1);
|
||||
setTimeAndSnapshot(1.5, true);
|
||||
anim.beginElementAt(1);
|
||||
setTimeAndSnapshot(2.0, true);
|
||||
}
|
||||
]]></script>
|
||||
<script xlink:href="../smil-util.js" type="text/javascript"/>
|
||||
<rect width="100" height="100" fill="green">
|
||||
<rect width="100" height="100" fill="red">
|
||||
<set attributeName="fill" attributeType="CSS"
|
||||
to="red" begin="1s" end="2s" dur="1s" fill="remove" id="anim"/>
|
||||
to="green" begin="1s" dur="1s" fill="remove" id="anim"/>
|
||||
</rect>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
@ -13,15 +13,15 @@
|
||||
function addInstanceTimes() {
|
||||
var svg = document.documentElement;
|
||||
svg.pauseAnimations();
|
||||
svg.setCurrentTime(0.5);
|
||||
svg.setCurrentTime(1.0);
|
||||
var anim = document.getElementById('anim');
|
||||
anim.endElementAt(1);
|
||||
anim.endElementAt(0.5);
|
||||
setTimeAndSnapshot(1.5, true);
|
||||
}
|
||||
]]></script>
|
||||
<script xlink:href="../smil-util.js" type="text/javascript"/>
|
||||
<rect width="100" height="100" fill="green">
|
||||
<set attributeName="fill" attributeType="CSS"
|
||||
to="red" begin="1s" end="2s" dur="1s" fill="remove" id="anim"/>
|
||||
to="red" begin="1s" dur="1s" fill="remove" id="anim"/>
|
||||
</rect>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
@ -1,26 +0,0 @@
|
||||
<!--
|
||||
A variation on reset-4.svg. If the added end instance is before the current
|
||||
interval we should not delete it but just ignore it and use the active
|
||||
duration to calculate the end of the interval. This is consistent with the
|
||||
operation of the SMIL pseudocode for getNextInterval when we have end events.
|
||||
-->
|
||||
<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(0.5);
|
||||
var anim = document.getElementById('anim');
|
||||
anim.endElementAt(0);
|
||||
setTimeAndSnapshot(1.5, 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" end="2s" dur="1s" fill="remove" id="anim"/>
|
||||
</rect>
|
||||
</svg>
|
Before Width: | Height: | Size: 1020 B |
@ -27,7 +27,7 @@
|
||||
^
|
||||
1 2 3 3.5
|
||||
|
||||
At t=2s we'll go to look for the next interval and construct one from 3s-4s.
|
||||
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
|
||||
@ -46,7 +46,7 @@
|
||||
svg.setCurrentTime(1.5);
|
||||
var anim = document.getElementById('anim');
|
||||
anim.beginElementAt(1.5);
|
||||
anim.endElementAt(2.5);
|
||||
anim.endElementAt(2);
|
||||
setTimeAndSnapshot(3.7, true);
|
||||
}
|
||||
]]></script>
|
||||
|