REGRESSION (r138858): GIFs don't start playing when they come out of background tabs
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 Apr 2013 20:17:00 +0000 (20:17 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 Apr 2013 20:17:00 +0000 (20:17 +0000)
commit9f9db2c7235309191f7a14b13e42fe0e613252de
tree300d15cb99700aa56cd34ed173b20858ccffd505
parent1d9dc3e1457da6edea28db76306198e21ddecf5f
REGRESSION (r138858): GIFs don't start playing when they come out of background tabs
https://bugs.webkit.org/show_bug.cgi?id=108864
<rdar://problem/13140489>

Reviewed by Antti Koivisto.

Don't repaint the world when animations resume; instead, FrameView
will cause all animated images to repaint. This line also had no effect for
TiledCoreAnimationDrawingArea, which does not implement setNeedsDisplay.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::resumeActiveDOMObjectsAndAnimations):

* loader/cache/CachedImage.cpp:
(WebCore::CachedImage::resumeAnimatingImagesForLoader): Added.
Iterate through all of the loader's cached resources. If they are bitmap images
which claim to be animatable, notify the image's observers that the animation advanced
by one frame. In reality, the image is still on the same frame, but will now be repainted,
restarting the animation loop.
* loader/cache/CachedImage.h:
* page/FrameView.cpp:
(WebCore::FrameView::setIsInWindow):
When the FrameView is brought into a window, repaint all animated images.
* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::canAnimate): Added.
Return whether or not the image should animate (claims to animate, has not already
finished its animation, and has an ImageObserver) *and* has more than one frame.
* platform/graphics/BitmapImage.h:
(BitmapImage): Add canAnimate.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@148300 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/loader/cache/CachedImage.cpp
Source/WebCore/loader/cache/CachedImage.h
Source/WebCore/page/FrameView.cpp
Source/WebCore/platform/graphics/BitmapImage.cpp
Source/WebCore/platform/graphics/BitmapImage.h
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/WebPage.cpp