Bug 755603 - Remove broken frozen to-animation behavior; r=dholbert

This commit is contained in:
Brian Birtles committed 2012-05-21 08:48:38 +09:00
1 parent 30500a358a
commit f2727d181c
4 files changed
+42 -45

No files matched your search

+8 -20
View File
@@ -215,7 +215,6 @@ nsSMILAnimationFunction::Activate(nsSMILTime aBeginTime)
mBeginTime = aBeginTime;
mIsActive = true;
mIsFrozen = false;
mFrozenValue = nsSMILValue();
mHasChanged = true;
}
@@ -224,7 +223,6 @@ nsSMILAnimationFunction::Inactivate(bool aIsFrozen)
{
mIsActive = false;
mIsFrozen = aIsFrozen;
mFrozenValue = nsSMILValue();
mHasChanged = true;
}
@@ -286,11 +284,6 @@ nsSMILAnimationFunction::ComposeResult(const nsISMILAttr& aSMILAttr,
result.Add(last, mRepeatIteration);
}
} else if (!mFrozenValue.IsNull() && !mHasChanged) {
// Frozen to animation
result = mFrozenValue;
} else {
// Interpolation
@@ -299,10 +292,6 @@ nsSMILAnimationFunction::ComposeResult(const nsISMILAttr& aSMILAttr,
if (NS_FAILED(AccumulateResult(values, result)))
return;
if (IsToAnimation() && mIsFrozen) {
mFrozenValue = result;
}
}
// If additive animation isn't required or isn't supported, set the value.
@@ -359,12 +348,11 @@ nsSMILAnimationFunction::WillReplace() const
{
/*
* In IsAdditive() we don't consider to-animation to be additive as it is
* a special case that is dealt with differently in the compositing method but
* here we return false for to animation as it builds on the underlying value
* unless its a frozen to animation.
* a special case that is dealt with differently in the compositing method.
* Here, however, we return FALSE for to-animation (i.e. it will NOT replace
* the underlying value) as it builds on the underlying value.
*/
return !mErrorFlags && (!(IsAdditive() || IsToAnimation()) ||
(IsToAnimation() && mIsFrozen && !mHasChanged));
return !mErrorFlags && !(IsAdditive() || IsToAnimation());
}
bool
@@ -374,7 +362,8 @@ nsSMILAnimationFunction::HasChanged() const
}
bool
nsSMILAnimationFunction::UpdateCachedTarget(const nsSMILTargetIdentifier& aNewTarget)
nsSMILAnimationFunction::UpdateCachedTarget(
const nsSMILTargetIdentifier& aNewTarget)
{
if (!mLastTarget.Equals(aNewTarget)) {
mLastTarget = aNewTarget;
@@ -514,8 +503,7 @@ nsresult
nsSMILAnimationFunction::AccumulateResult(const nsSMILValueArray& aValues,
nsSMILValue& aResult)
{
if (!IsToAnimation() && GetAccumulate() && mRepeatIteration)
{
if (!IsToAnimation() && GetAccumulate() && mRepeatIteration) {
const nsSMILValue& lastValue = aValues[aValues.Length() - 1];
// If the target attribute type doesn't support addition, Add will
@@ -819,7 +807,7 @@ nsSMILAnimationFunction::GetValues(const nsISMILAttr& aSMILAttr,
preventCachingOfSandwich);
parseOk &= ParseAttr(nsGkAtoms::by, aSMILAttr, by,
preventCachingOfSandwich);
if (preventCachingOfSandwich) {
mValueNeedsReparsingEverySample = true;
}
-25
View File
@@ -453,31 +453,6 @@ protected:
// associated with them.
PRUint16 mErrorFlags;
// This is for the very specific case where we have a 'to' animation that is
// frozen part way through the simple duration and there are other active
// lower-priority animations targetting the same attribute. In this case
// SMILANIM 3.3.6 says:
//
// The value for F(t) when a to-animation is frozen (at the end of the
// simple duration) is just the to value. If a to-animation is frozen
// anywhere within the simple duration (e.g., using a repeatCount of "2.5"),
// the value for F(t) when the animation is frozen is the value computed for
// the end of the active duration. Even if other, lower priority animations
// are active while a to-animation is frozen, the value for F(t) does not
// change.
//
// To implement this properly we'd need to force a resample of all the lower
// priority animations at the active end of this animation--something which
// would introduce unwanted coupling between the timing and animation model.
// Instead we just save the value calculated when this animation is frozen (in
// which case this animation will be sampled at the active end and the lower
// priority animations should be sampled at a time pretty close to this,
// provided we have a reasonable frame rate and we aren't seeking).
//
// @see
// http://www.w3.org/TR/2001/REC-smil-animation-20010904/#FromToByAndAdditive
nsSMILValue mFrozenValue;
// Allows us to check whether an animation function has changed target from
// sample to sample (because if neither target nor animated value have
// changed, we don't have to do anything).
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
class="reftest-wait"
onload="setTimeAndSnapshot(50, true)">
<script xlink:href="smil-util.js" type="text/javascript"/>
<!-- Covered up red area, if we succeed -->
<rect width="100%" height="100%" fill="red"/>
<rect width="100%" height="100%" fill="lime">
<!-- At time t=50s, this will give a base value of 50% -->
<animate attributeName="width" from="0%" to="100%"
dur="100s"/>
<!-- From time t=1s onwards this should apply 50% of its effect to the base
value (since it is frozen at repeatCount=0.5).
So, if the base value is 50%, and the to-value is 150%, it will produce
100%. -->
<animate attributeName="width" to="150%" fill="freeze"
dur="2s" repeatCount="0.5"/>
<!-- The above will check that the resulting width is *at least* 100%. But
if it's, say, 120%, we won't see any failure.
Therefore, we perform the reverse operation on the height to ensure we
don't apply a value that's too large. -->
<!-- At time t=50s, this will give a base value of 150% -->
<animate attributeName="height" from="200%" to="100%"
dur="100s"/>
<!-- From time t=1s onwards this should apply 50% of its effect to the
value.
So, if the base value is 150%, and the to-value is 50%, it will produce
100%. -->
<animate attributeName="height" to="50%" fill="freeze"
dur="2s" repeatCount="0.5"/>
</rect>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

+1
View File
@@ -234,6 +234,7 @@ fails == anim-pattern-attr-presence-02.svg anim-pattern-attr-presence-02-ref.svg
== freeze-applied-late-2.svg anim-standard-ref.svg
== freeze-applied-late-3.svg anim-standard-ref.svg
== freeze-applied-late-4.svg anim-standard-ref.svg
== frozen-to-anim-1.svg lime.svg
== inactivate-with-active-unchanged-1.svg anim-standard-ref.svg
== inactivate-with-active-unchanged-2.svg anim-standard-ref.svg