Bug 107609

Summary: REGRESSION(r139800): animations with start delay may not animate if page becomes hidden
Product: WebKit Reporter: dstockwell
Component: New BugsAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: bdakin, dino, jamesr, simon.fraser, syoichi
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 107521    

Description dstockwell 2013-01-22 18:05:38 PST
http://trac.webkit.org/changeset/139800

It's not clear from the Changelog which of these changes are intentional:

Animation events do not fire while page is hidden.
Animations may not animate if page becomes hidden then visible again during animation-delay.
Animations do not make progress while page is hidden.
Comment 1 James Robinson 2013-01-22 18:09:05 PST
My guess would be all 3 are intentional.
Comment 2 Simon Fraser (smfr) 2013-01-22 18:18:35 PST
Animation suspend/resume are totally broken; they just stop existing animations, they don't prevent new ones. Not deliberate, just broken.
Comment 3 dstockwell 2013-01-22 18:40:16 PST
(In reply to comment #2)
> Animation suspend/resume are totally broken; they just stop existing animations, they don't prevent new ones. Not deliberate, just broken.

Can we roll it out, or is work happening on suspend/resume?

If the goal was to reduce CPU usage I think we could still achieve that without suspending by only servicing animations at event points when the page is hidden.
Comment 4 Beth Dakin 2013-01-22 20:36:18 PST
First we should agree on desired behavior. 

(In reply to comment #0)
> http://trac.webkit.org/changeset/139800
> 
> It's not clear from the Changelog which of these changes are intentional:
> 
> Animation events do not fire while page is hidden.

I tend to think this is correct behavior, but I am open to a discussion.

> Animations may not animate if page becomes hidden then visible again during animation-delay.

Definitely a bug.

> Animations do not make progress while page is hidden.

Personally I like this behavior as well, but I do think it's open to discussion. 

And Simon pointed out that suspend does not prevent new animations, which is also definitely a bug.
Comment 5 dstockwell 2013-01-22 22:04:04 PST
(In reply to comment #4)
> > Animation events do not fire while page is hidden.
> 
> I tend to think this is correct behavior, but I am open to a discussion.
> 
> > Animations do not make progress while page is hidden.
> 
> Personally I like this behavior as well, but I do think it's open to discussion. 

I think these are effectively the same issue. I am concerned that this change diverges from IE and Firefox. I think there are many use cases where animations  align with real time and will be impacted/ made more difficult.

eg. http://www.paulrhayes.com/experiments/clock/#clock
Comment 6 Beth Dakin 2013-01-22 22:11:08 PST
(In reply to comment #5)
> (In reply to comment #4)
> > > Animation events do not fire while page is hidden.
> > 
> > I tend to think this is correct behavior, but I am open to a discussion.
> > 
> > > Animations do not make progress while page is hidden.
> > 
> > Personally I like this behavior as well, but I do think it's open to discussion. 
> 
> I think these are effectively the same issue. I am concerned that this change diverges from IE and Firefox. I think there are many use cases where animations  align with real time and will be impacted/ made more difficult.
> 
> eg. http://www.paulrhayes.com/experiments/clock/#clock

Hmm! Thank you for that example; it is a compelling demo for the alternate behavior. Thinking this over…
Comment 7 dstockwell 2013-01-30 17:12:39 PST
(In reply to comment #6)
> Hmm! Thank you for that example; it is a compelling demo for the alternate behavior. Thinking this over…

Any thoughts?

I have a patch (https://bugs.webkit.org/attachment.cgi?id=185628) on https://bugs.webkit.org/show_bug.cgi?id=107521 that implements the idea above (only service animations at events for hidden pages) which you could experiment with.