Closed Bug 155939 Opened 22 years ago Closed 22 years ago

Frames not replaced correctly on animated GIF (offset calculation incorrectly includes border/padding)

Categories

(Core :: Graphics: ImageLib, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.3alpha

People

(Reporter: megabyte, Assigned: paper)

References

()

Details

(Keywords: regression)

Attachments

(1 file, 1 obsolete file)

On http://kontek.net/ the MODPlug animated GIF button leaves some pieces behind
when animating.  Oddly enough, it does not do this when the image is viewed by
itself.  It looks fine on other browsers and on other pages.  I have seen the
same behavior on different machines.  I do not remember seeing it before the
checkin for bug 22607, but have seen it for a while now.
2002070304-trunk
Keywords: regression
exactly which gif are you having problems with?

Is it the one on the very bottom right?  If that's the one, it's not an animated
gif, it's a plugin..
The one second from left.
ah, I see it now :)
Confirming on Build 2002070204.  Little bits of blue get left behind
I think I found the problem:

Example:
data:text/html,<img src="http://www.vg-network.com:8080/pics/gvgaboxbanner.gif"
border="1">

shows the problem.

Note that:
data:text/html,<img src="http://www.vg-network.com:8080/pics/gvgaboxbanner.gif"
border="0">

does NOT exhibit the problem.

However,

data:text/html,<img src="http://www.vg-network.com:8080/pics/gvgaboxbanner.gif"
border="10">

shows an even worse problem.

Basically, the frame replacement offset is calculated using the outer frame
(including the border) when it should only be calculated from the frame of the
image itself.  This is really bad.
Summary: Frames not replaced correctly on animated GIF → Frames not replaced correctly on animated GIF (offset calculation incorrectly includes border)
-> me
Assignee: pavlov → paper
-> Taking

I have a fix, but I don't trust it yet.
It appears nsImageFrame::Paint expects the aDirtyRect to include
borders/padding, whereas imgContainerGIF doesn't know anything about that, so it
just passes  aDirtyRect without a border.  Doesn't effect 1 frame gifs because
imgContainerGIF doesn't send out a dirty notification (a FrameChanged call) for
them. 

If imgContainerGIF is the only one sending FrameChanged calls, then I can simply
add the border to aDirtyRect in FrameChanged before it gets sent to Paint.  If
not, I'll have to look for another alternative.

Also confirming bug present in 1.0.1 and nominating this bug for 1.0.2.  
Regression is almost definitely Bug 85595, or rather the check-in there caused
this bug to show itself. (Before 85585 we always passed the full frame's to
FrameChanged, even if only a partial area was changed)
Status: NEW → ASSIGNED
Keywords: mozilla1.0.2
Bug existed in 1.0.0 as well, and can be confirmed by using the following:
data:text/html, <img src="http://www.vg-network.com:8080/pics/gvgaboxbanner.gif"
border="50" />

Fortunately, people rarely use borders on animated gifs :)
Target Milestone: --- → mozilla1.3alpha
*** Bug 178377 has been marked as a duplicate of this bug. ***
Another testcase, using CSS padding instead of border:
http://bugzilla.mozilla.org/attachment.cgi?id=105197&action=view
Summary: Frames not replaced correctly on animated GIF (offset calculation incorrectly includes border) → Frames not replaced correctly on animated GIF (offset calculation incorrectly includes border/padding)
OS: Windows XP → All
Hardware: PC → All
Haven't had any problems with this patch in the 2+ weeks I've been using it. 
Code comments should explain all. :)
After bz pointed me towards the similar code in OnDataAvailable, I dug around
and found Bug 87550.  Same issue, different spot. 

So I made this patch look like the other. :)
Attachment #105235 - Attachment is obsolete: true
Comment on attachment 105281 [details] [diff] [review]
Adjust rect before Invalidating

r/sr=bzbarsky
Attachment #105281 - Flags: review+
Comment on attachment 105281 [details] [diff] [review]
Adjust rect before Invalidating

Hey, that looks familiar. :)

sr=tor
Attachment #105281 - Flags: superreview+
Comment on attachment 105281 [details] [diff] [review]
Adjust rect before Invalidating

Hey, that looks familiar. :)

sr=tor
Checked in.
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: