Closed Bug 506096 Opened 10 years ago Closed 10 years ago

SVG SMIL: In "to" animation with calcMode="discrete", base value never gets visited

Categories

(Core :: SVG, defect)

defect
Not set

Tracking

()

RESOLVED FIXED

People

(Reporter: dholbert, Assigned: dholbert)

References

()

Details

Attachments

(3 files)

Attached image testcase 1
STEPS TO REPRODUCE:
 1. Turn on the "svg.smil.enabled" pref in about:config
 2. Load testcase

EXPECTED RESULTS:
Rect should start towards the left, inside the dotted box. After 1 sec, it should jump right.  It should continue alternating between the positions.

ACTUAL RESULTS:
Rect starts out shifted to the right, and never moves from this position.

Opera v9.64 shows "expected results".
Current mozilla-central shows "actual results".

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2a1pre) Gecko/20090723 Minefield/3.6a1pre

I've got a simple patch for this; I'll post it shortly.
Attached image reference case 1
Here's a reference case that gives the expected behavior in mozilla-central.

It's the same as the testcase, except for the addition of an explicit "from" attribute to the animation.
Attached patch patch v1Splinter Review
Here's the fix.

Note that our |values| array will have one entry if & only if we're doing a pure "to" animation, as already asserted by this error-check here:
http://mxr.mozilla.org/mozilla-central/source/content/smil/nsSMILAnimationFunction.cpp?mark=374,375#374

When this is the case, we need to make the discrete-mode clause in InterpolateResult use the base value for the first half of our animation, and the "to" value for the second half. (which is what this patch does)

The patch adds 4 reftests to check 4 time points during a discrete-calcMode "to" animation -- t=0, just before half, exactly at half, and after the animation is completed (with fill='freeze').  The first two tests fail in unpatched code, because this bug made us lock onto the "to" value immediately.  They all pass post-patching.
Attachment #390340 - Flags: superreview?(roc)
Attachment #390340 - Flags: review?(roc)
Attachment #390340 - Flags: superreview?(roc)
Attachment #390340 - Flags: superreview+
Attachment #390340 - Flags: review?(roc)
Attachment #390340 - Flags: review+
Landed:
http://hg.mozilla.org/mozilla-central/rev/6d21520aff59

The first landing missed the reftest files; added those here:
http://hg.mozilla.org/mozilla-central/rev/ec99f60c8f80
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.