Closed Bug 1295506 Opened 4 years ago Closed 4 years ago

Don't yield hidden frames in the PNG decoder

Categories

(Core :: ImageLib, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla51
Tracking Status
firefox51 --- fixed

People

(Reporter: seth, Assigned: seth)

References

Details

Attachments

(1 file)

Animated PNGs have a compatibility feature for browsers that don't support APNG: the first frame can be "hidden". APNG-compatible browsers will ignore that frame, while pre-APNG browsers will display it. This allows you to display something different to users of pre-APNG browsers. (For example, "To see this animation, use a browser that supports APNG".)

The problem? Currently the PNG decoder yields after every frame, *including the hidden frame*. This causes problems in bug 1293472, because we add an assert there that says that we don't yield during a single-frame decode. That's normally true, but because we yield after a hidden frame but don't consider the decode *done* until we decode the first real frame, we trip the assert. So let's fix it.
Here's the patch. It's pretty straightforward: if the previous frame was hidden,
we don't yield; we just allocate the next frame (just as we would've done when
we came back from the yield) and keep on decoding.
Attachment #8781433 - Flags: review?(edwin)
Thanks for the review!
Pushed by seth.bugzilla@blackhail.net:
https://hg.mozilla.org/integration/mozilla-inbound/rev/9c25eb4d65d3
Don't yield hidden frames in the PNG decoder. r=edwin
https://hg.mozilla.org/mozilla-central/rev/9c25eb4d65d3
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
You need to log in before you can comment on or make changes to this bug.