Bug 106940

Summary: Suspend CSS animations for background tabs
Product: WebKit Reporter: Beth Dakin <bdakin>
Component: CSSAssignee: Beth Dakin <bdakin>
Status: RESOLVED FIXED    
Severity: Normal CC: bdakin, dino, simon.fraser, thorton
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
dino: review+
Patch in Page simon.fraser: review+

Beth Dakin
Reported 2013-01-15 13:19:14 PST
We should suspend CSS animations when a page is in the background. <rdar://problem/12961725>
Attachments
Patch (1.34 KB, patch)
2013-01-15 13:20 PST, Beth Dakin
dino: review+
Patch in Page (1.40 KB, patch)
2013-01-15 15:25 PST, Beth Dakin
simon.fraser: review+
Beth Dakin
Comment 1 2013-01-15 13:20:57 PST
Dean Jackson
Comment 2 2013-01-15 13:46:53 PST
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?
Simon Fraser (smfr)
Comment 3 2013-01-15 13:53:18 PST
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.
Dean Jackson
Comment 4 2013-01-15 13:54:22 PST
Also, we have some bugs with fill mode iirc. But, we'll just have to fix all this :(
Simon Fraser (smfr)
Comment 5 2013-01-15 13:55:18 PST
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.
Beth Dakin
Comment 6 2013-01-15 15:23:10 PST
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().
Beth Dakin
Comment 7 2013-01-15 15:25:16 PST
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.
Simon Fraser (smfr)
Comment 8 2013-01-15 15:29:44 PST
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).
Beth Dakin
Comment 9 2013-01-15 15:45:43 PST
Note You need to log in before you can comment on or make changes to this bug.