Bug 579828 - SVG SMIL: Trim, don't prune invalid active intervals; r=dholbert; a=roc

This commit is contained in:
Brian Birtles 2010-10-20 08:55:09 +09:00
Родитель bb42df2537
Коммит e770102bd4
8 изменённых файлов: 60 добавлений и 15 удалений

Просмотреть файл

@ -174,9 +174,10 @@ protected:
//
// Instance times are only shared in a few cases, namely:
// a) early ends,
// b) zero-duration intervals, and
// b) zero-duration intervals,
// c) momentarily whilst establishing new intervals and updating the current
// interval
// interval, and
// d) trimmed intervals
// Hence the limited range of a PRUint16 should be more than adequate.
PRUint16 mFixedEndpointRefCnt;

Просмотреть файл

@ -1859,20 +1859,24 @@ nsSMILTimedElement::UpdateCurrentInterval(PRBool aForceChangeNotice)
if (changed || aForceChangeNotice) {
NotifyChangedInterval();
}
}
}
// There's a chance our next milestone has now changed, so update the time
// container
RegisterMilestone();
} else {
if (mElementState == STATE_ACTIVE && mClient) {
// Only apply a fill if it was already being applied before the (now
// deleted) interval was created
PRBool applyFill = HasPlayed() && mFillMode == FILL_FREEZE;
mClient->Inactivate(applyFill);
}
if (mElementState == STATE_ACTIVE || mElementState == STATE_WAITING) {
} else { // GetNextInterval failed: Current interval is no longer valid
if (mElementState == STATE_ACTIVE) {
// The interval is active so we can't just delete it, instead trim it so
// that begin==end.
if (!mCurrentInterval->End()->SameTimeAndBase(*mCurrentInterval->Begin()))
{
mCurrentInterval->SetEnd(*mCurrentInterval->Begin());
NotifyChangedInterval();
}
// The transition to the postactive state will take place on the next
// sample (along with firing end events, clearing intervals etc.)
RegisterMilestone();
} else if (mElementState == STATE_WAITING) {
mElementState = STATE_POSTACTIVE;
ResetCurrentInterval();
}

Просмотреть файл

@ -0,0 +1,15 @@
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
class="reftest-wait"
onload="
document.documentElement.pauseAnimations();
document.documentElement.setCurrentTime(1);
document.getElementById('a').setAttribute('end', '0s');
delayedSnapshot(2)">
<script xlink:href="event-util.js" type="text/javascript"/>
<rect width="100" height="100" fill="red">
<set attributeName="x" to="0" begin="0.5s" dur="10s" id="a"/>
<set attributeName="fill" attributeType="CSS"
to="green" begin="a.endEvent" dur="4s"/>
</rect>
</svg>

После

Ширина:  |  Высота:  |  Размер: 612 B

Просмотреть файл

@ -12,6 +12,7 @@
== event-end-1.svg green-box-ref.svg
== event-end-2.svg green-box-ref.svg
== event-end-open-1.svg green-box-ref.svg
== event-end-trimmed-1.svg green-box-ref.svg
== event-preventDefault-1.svg green-box-ref.svg
== event-seek-1.svg green-box-ref.svg
== event-target-default-1.svg green-box-ref.svg

Просмотреть файл

@ -8,7 +8,6 @@
setTimeAndSnapshot(2, false)">
<script xlink:href="../smil-util.js" type="text/javascript"/>
<!--
A simple case of a deleting interval.
Originally we have an interval from -1.5s to 0.5s. We'll ignore 'a's begin
time of t=0s because we are restart="whenNotActive".
At time t=0.1s, 'a' will create a new interval from 1.0 to 1.1s and we'll

До

Ширина:  |  Высота:  |  Размер: 1.2 KiB

После

Ширина:  |  Высота:  |  Размер: 1.1 KiB

Просмотреть файл

@ -8,11 +8,11 @@
setTimeAndSnapshot(2, false)">
<script xlink:href="../smil-util.js" type="text/javascript"/>
<!--
A simple case of a deleting interval.
Originally the third animation's interval is from 1s->3s, but then by
script we add another begin time to 'a' at 0.5, and since 'a' can't
restart, this is the only begin time it will ever generate. Therefore, all
the ends are before the begin, and there's no valid interval.
the ends for animation 'b' are before the begin, and there's no valid
interval.
-->
<rect width="100" height="100" fill="green">
<animate attributeName="y" attributeType="XML" from="0" to="0" id="a"

До

Ширина:  |  Высота:  |  Размер: 1.1 KiB

После

Ширина:  |  Высота:  |  Размер: 1.1 KiB

Просмотреть файл

@ -52,6 +52,9 @@
== deleted-interval-simple-4.svg green-box-ref.svg
== deleted-interval-simple-5.svg green-box-ref.svg
# Trimmed intervals
== trimmed-interval-1.svg green-box-ref.svg
# Cyclic dependencies
== cycle-ok-1.svg green-box-ref.svg
== cycle-ok-2.svg green-box-ref.svg

Просмотреть файл

@ -0,0 +1,22 @@
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
class="reftest-wait"
onload="
document.documentElement.pauseAnimations();
document.documentElement.setCurrentTime(1);
document.getElementById('a').setAttribute('end', '0s');
setTimeAndSnapshot(2, false)">
<script xlink:href="../smil-util.js" type="text/javascript"/>
<!--
The timebase interval is updated such that it would be deleted but because
it is active, it is trimmed instead. Test that the dependent interval is
notified accordingly.
-->
<rect width="100" height="100" fill="red">
<animate attributeName="y" attributeType="XML" from="0" to="0" id="a"
begin="0.5s" dur="10s"/>
<animate attributeName="fill" attributeType="CSS"
values="purple; green; orange" keyTimes="0; 0.75; 1"
begin="a.end" dur="2s"/>
</rect>
</svg>

После

Ширина:  |  Высота:  |  Размер: 906 B