WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED INVALID
63314
Can only render first frame of animated gifs to canvas if image is hidden
https://bugs.webkit.org/show_bug.cgi?id=63314
Summary
Can only render first frame of animated gifs to canvas if image is hidden
bobby
Reported
2011-06-23 23:40:43 PDT
When an animated gif is being rendered by an <img>, grabbing its pixels with a drawImage() is possible. But, as soon as that gif becomes invisible by any means other than simply moving it off the screen with, say, a negative "left" position, drawImage only grabs the first frame of the gif. Can we not have the <img> tag continue to update when it's not displayed for the sake of using them in animations? WebGL textures would be super fun. Test 1:
http://robothaus.org/bugs/gifs/gif-hidden-test.html
- canvas will update properly for 2 seconds, and then <img> will become invisible and canvas will stop updating, even though drawImage is still being called. Test 2:
http://cjcliffe.github.com/CubicVR.js/cubicvr/tests/gifs/gifs.html
- WebGL texture fun with gif simply moved to 'left: -600px'. I'm using chromium 12.0.742.100 (0).
Attachments
Add attachment
proposed patch, testcase, etc.
Peter Kasting
Comment 1
2011-06-24 13:46:26 PDT
We purposefully don't animate invisible GIFs for CPU load reasons -- for example, on some long forum pages with hundreds of animated GIFs, drawing offscreen GIFs can easily bring the browser to its knees. I don't know the drawing pipeline well enough to say whether there's some specific change we could put in place to support just this particular case. Mark might know more.
bobby
Comment 2
2011-06-24 13:49:18 PDT
That doesn't really seem to be the case here. It renders fine when gifs are off-screen, just not when they have their visibility tampered with. Which is more broken? :/
Matthew Delaney
Comment 3
2011-06-24 13:54:02 PDT
What's meant by invisible here? I'd imagine that we'd treat a gif far down a forum page (out of view) the same as one that is hanging off the left side of the page (out of view). @Bobby, is there any benefit from having visibility set rather than having it positioned off the screen? Not sure I understand what the issue is here if you can do it equally fine with left: -something
bobby
Comment 4
2011-06-24 13:59:59 PDT
@Matt: just seems kind of silly to have to do that. If scrollbars are present on the screen, you can just scroll over and see the gif, right?
Matthew Delaney
Comment 5
2011-06-24 14:02:37 PDT
(In reply to
comment #4
)
> @Matt: just seems kind of silly to have to do that. If scrollbars are present on the screen, you can just scroll over and see the gif, right?
Yea, I suppose setting the opacity to 0 or something would be the first thing I'd try, though it'll still be laid out somewhere on the page, so you'd have to deal with that. Alternatively you could hide it behind the canvas that you're drawing into. Or in the left: -something case, you could just have overflow:hidden for its container to avoid scrolling.
Mark Rowe (bdash)
Comment 6
2011-06-24 14:06:52 PDT
If it’s positioned offscreen to the left or top then you’ll never be able to scroll to reveal it, even if the page is scrollable.
bobby
Comment 7
2011-06-25 06:34:50 PDT
Ok, that's good enough, I suppose. Just seemed awkward while I was getting it to work, but, hey, this is the fun side of the internet :). Thanks guys.
Brent Fulgham
Comment 8
2022-07-18 14:03:06 PDT
The relevant test sites no longer exist. We can't take further action on this bug report.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug