Closed Bug 210001 Opened 21 years ago Closed 21 years ago

[FIX]Changing IMG SRC attribute via Javascript should reset animated GIFs to first frame

Categories

(Core :: Layout: Images, Video, and HTML Frames, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla1.7alpha

People

(Reporter: bugzilla, Assigned: bzbarsky)

References

()

Details

Attachments

(1 file, 1 obsolete file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5a) Gecko/20030612
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5a) Gecko/20030612

when changing the SRC attribute of an image, if it's an Animated GIF the
animation should restart from the first frame.
This was the behavior of the 1.3 release.
Behavior of 1.4 and recent trunk builds (tested until 20030612) has different
behavior (as 1.2 and below)
Note that the page at URL reported above Preloads hot-spot images.

Reproducible: Always

Steps to Reproduce:
1. go to http://www.paipai.net/default1.asp, wait until the page stop loading
2. pass the mouse pointer over the "Home" icon on the navigation bar ("once"
animated gif)
3. pass the mouse over the "Guest Book" icon on the navigation bar ("infinite"
animated gif)

Actual Results:  
The animations of preloaded GIFs start and run in background.
So, if you pass over the "Home" icon after the page has finished loading, there
is no animation at all.
If you pass the mouse pointer over the "Guest Book" icon more that once, you can
notice that the "infinite" animation runs in background.
This is the behavior of Mzilla 1.2 and below.

Expected Results:  
The animation should restart from first frame every time the SRC attribute is
changed (for ex. using using Javascript)
This is the behavior of mozilla 1.3 and MSIE.
Mozilla 1.4 (tested RC1) and build 20030612 have same behavior of 1.2 and below
nice to see this one made it through to 1.4 final, very annoying, and
potentially embarassing if NS7.1 has the same issue.
Actually, I am not at all convinced we even want to "fix" this.... (not to
mention that I fail to see where the "potentially embarrasing" part comes in). 
In builds up through 1.3, if you had an image in two places on a page, they
would animate in sync with each other, but preloaded images were not considered
in this count.  Now they are, for various correctness reasons....

At the same time, see bug 83774 comment 49 -- if we decide we want to address
that issue, it may "fix" this "bug" automatically.
I've read some comment of bug 83774 and now I understand that this behavior is a
design decision: looks like that same images are reperesented by same objects,
so if there are animated images, restarting from the first frame would restart
animation also all other images that have same source (just saing what I've
undersood).
This is an issue for me because I would like to use animated GIFs as it hotspot,
instead of using Flash movies.
Maybe the animation could be restarted when the "observers count" reach zero
(I'm using some term coming from bug 83774 comments). In this case, if the image
is completely hided form the page, because it's not used by any IMG tag, the
animation would restart from first frame when it became again visible (changing
the SRC attribute of an IMG object)
> Maybe the animation could be restarted when the "observers count" reach zero

Right.  That's what used to happen.  With the changes in bug 83774, that count
is never zero (that's what bug 83774 comment 49 is about), since the Image()
object doing the precaching counts as an "observer".
If someone knows a workaround for this bug we can close it setting as wontfix...
Otherwise, there is an hope that it would be fixed?
*** Bug 220992 has been marked as a duplicate of this bug. ***
Blocks: 223868
*** Bug 226440 has been marked as a duplicate of this bug. ***
Attached patch Proposed patch (obsolete) — Splinter Review
Comment on attachment 137095 [details] [diff] [review]
Proposed patch

pav, jst, would you review?  The patch has two main parts:

1)  Move starting of animations out of where it happened in imagelib and into
consumers.  This prevents animations from even starting till someone cares
about them.

2)  Since animations no longer get stopped once no frame shows them, adds code
to nsHTMLImageElement::SetSrc to reset the animation.
Attachment #137095 - Flags: superreview?(jst)
Attachment #137095 - Flags: review?(pavlov)
Taking.  This fixes bug 223868 and all the duplicates of this bug too. 
Incidentally it fixes the fact that the image animation prefs did not apply to
list bullets.
Assignee: jdunn → bz-vacation
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows 2000 → All
Priority: -- → P1
Hardware: PC → All
Summary: Changing IMG SRC attribute via Javascript should reset animated GIFs to first frame → [FIX]Changing IMG SRC attribute via Javascript should reset animated GIFs to first frame
Target Milestone: --- → mozilla1.7alpha
Comment on attachment 137095 [details] [diff] [review]
Proposed patch

sr=jst
Attachment #137095 - Flags: superreview?(jst) → superreview+
tor, is this something you could review, given that pav was ok with the general
idea?  I'm having no luck getting hold of him....
Attachment #137095 - Flags: review?(pavlov) → review+
Attached patch Merged to tipSplinter Review
Attachment #137095 - Attachment is obsolete: true
Checked in for 1.7a.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Product: Core → Core Graveyard
Product: Core Graveyard → Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: