Closed Bug 733744 Opened 12 years ago Closed 5 months ago

animateTransform with a very small duration (less than 1 millisecond) no longer animates

Categories

(Core :: SVG, defect)

defect

Tracking

()

RESOLVED FIXED
122 Branch
Tracking Status
firefox122 --- fixed

People

(Reporter: longsonr, Assigned: longsonr)

References

()

Details

(Whiteboard: [see comment 11 for explanation])

Attachments

(3 files)

Apparently this example used to work in Firefox 4.
(In reply to Robert Longson from comment #0)
> Apparently this example used to work in Firefox 4.

Confirmed -- in Firefox 4, the parallelogram snaps to a rounded square after 3 seconds.
This apparently depends on the very small dur="0.0001s" attribute.

If I increase that to 0.1, then the animation succeeds.
Summary: animateTransform no longer animates → animateTransform with a very small duration no longer animates
Last good nightly: 2011-04-19
First bad nightly: 2011-04-20

Pushlog:
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=7d4eb3d3c9de&tochange=45b20f137549
which points to bug 651036
Blocks: 651036
Attached image reference case 1
Here's a reference case, which exactly matches the just-attached testcase except that the animation's duration is marginally longer (0.001s instead of 0.0001s).
(That's all the poking I'm going to do on this for now -- if someone else wants to take this and figure out what's going wrong, please be my guest! :))
This is a known issue with our implementation of frozen to-animation. The way frozen to-animation is defined is really counter-intuitive. See:

  http://www.w3.org/Graphics/SVG/WG/wiki/F2F/Auckland_2011/Animation_improvements#Issue:_Frozen_to-animation_is_broken

To support this properly, you need to set a milestone when the frozen animation ends, and actually sample the animation value then. Currently we set milestones, by we only sample the timing model at these times, not the animation values.

For frozen to-animations we currently just use the last sampled value before the animation got frozen. So if the sample rate is not fast enough, or you do a sync, you'll get the wrong result. Hence this bug.

I'd really like to change this behaviour. It's not just that it's hard to implement, but counter-intuitive.

I proposed this on www-svg:

  http://lists.w3.org/Archives/Public/www-svg/2011Mar/0082.html

But I didn't have the stamina to see it through.

I think we should just align with Opera here as I think it does what authors expect.
I've looked into this and actually what I think is happening is that, since we store times as integers representing milliseconds, dur="0.0001s" is represented as 0 and dur="0.001s" is represented as 1.

Now, SMIL says that the duration must be non-zero. If it is zero it is an error, and if there is an error, we should behave as if the duration was indefinite.

Under the previous discrete to-animation behaviour, where we never visited the underlying value, an indefinite duration would still end up showing the to-value. With the behaviour implemented in bug 651036--where we visit both the underlying value and the to-value--we'll just get stuck on the first value.

I'm not really sure what we ought to do here. It comes down to the precision used for representing times.

I still want to change what we do for frozen to-animation (I have a patch for it) but that's a separate bug.
We could store times as doubles perhaps?
(In reply to Robert Longson from comment #12)
> We could store times as doubles perhaps?

Yeah, I've been trying to avoid that since it's a big change that might introduce bugs (or more likely, test regressions) due to floating-point errors. I'm not sure if this bug warrants the change.

An alternative is to store times as integer number of microseconds which would still give us a range of +/- 292,263 years.
Filed bug 755603 for fixing the frozen to-animation behaviour.
Summary: animateTransform with a very small duration no longer animates → animateTransform with a very small duration (less than 1 millisecond) no longer animates
Whiteboard: [see comment 11 for explanation]
Severity: normal → S3
Assignee: nobody → longsonr
Pushed by longsonr@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/4a4a406091cd
don't round short durations to zero r=birtles
Status: REOPENED → RESOLVED
Closed: 12 years ago5 months ago
Resolution: --- → FIXED
Target Milestone: --- → 122 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: