We should suspend CSS animations when a page is in the background. <rdar://problem/12961725>
Created attachment 182838 [details] Patch
Comment on attachment 182838 [details] Patch I'm surprised that this is all it takes. I wonder if it should be a setting so ports could toggle it?
Comment on attachment 182838 [details] Patch IIRC these suspend/resume calls don't work very well; if JS runs and starts an animation while animations are "suspended" it will actually run.
Also, we have some bugs with fill mode iirc. But, we'll just have to fix all this :(
We also have Frame::suspendActiveDOMObjectsAndAnimations (added in r109548). Should we be using that instead? FocusController doesn't seem like the right place to do this.
Actually, I think I found a place that I prefer for this code to live. I think it should be grouped with Kiran's DOM timer throttling (see http://trac.webkit.org/changeset/130720 ) which is in Page::setVisibilityState(). As far as I can tell, Page::setVisibilityState() and FocusController::setContainingWindowIsVisible() are pretty much equivalent, but it would be nice to have all of this throttling/suspending in the same place. I am going to post a new patch that moves this code to Page::setVisibilityState().
Created attachment 182855 [details] Patch in Page We might want to re-name HIDDEN_PAGE_DOM_TIMER_THROTTLING to HIDDEN_PAGE_THROTTLING if we go with this.
Comment on attachment 182855 [details] Patch in Page I like this better but I don't think it should be inside #if ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING).
http://trac.webkit.org/changeset/139800