Bug 146451 - The animation is running in the background without stop.
Summary: The animation is running in the background without stop.
Status: RESOLVED CONFIGURATION CHANGED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Animations (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-30 02:41 PDT by Mark Wang
Modified: 2023-04-13 01:52 PDT (History)
3 users (show)

See Also:


Attachments
the simple case to reproduce this issue. (1.36 KB, application/octet-stream)
2015-06-30 02:43 PDT, Mark Wang
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Wang 2015-06-30 02:41:35 PDT
This issue happens only if accelerated-compositing is enabled.

The attached simple test case is to load an iframe with 'display:none', which has some animations. Although nothing is displayed when it is loaded, 50% CPU is consumed (depends on different platform).  

If adding a log in ImplicitAnimation::timeToNextService() of ImplicitAnimation.cpp
double ImplicitAnimation::timeToNextService()
{
    printf("[LOG]ImplicitAnimation::timeToNextService(%p)\n", this);
    double t = AnimationBase::timeToNextService();
    ......
}

Lots of logs were outputted in the console, like 
    [LOG]ImplicitAnimation::timeToNextService(0x726e9ec8)
    [LOG]ImplicitAnimation::timeToNextService(0x726e9e70)
    [LOG]ImplicitAnimation::timeToNextService(0x726e9000)
    [LOG]ImplicitAnimation::timeToNextService(0x726e9058)
    [LOG]ImplicitAnimation::timeToNextService(0x726e9ec8)
    [LOG]ImplicitAnimation::timeToNextService(0x726e9e70)
    [LOG]ImplicitAnimation::timeToNextService(0x726e9f78)
    [LOG]ImplicitAnimation::timeToNextService(0x726e9f20)
    [LOG]ImplicitAnimation::timeToNextService(0x726e9058)
    [LOG]ImplicitAnimation::timeToNextService(0x726e9000)

How to reproduce this issue?
1/ unzip simple_case.zip
2/ enable accelerated-compositing
3/ load unzipped tbc.html 

The reason is in GraphicsLayerTextureMapper::addAnimation(). 
This issue is the side-effect of replacing m_animationStartedTimer.startOneShot(0) by notifyChange(AnimationStarted) in GraphicsLayerTextureMapper::addAnimation(). In fact, if the current GraphicsLayerTextureMapper object is not in GraphicsLayer tree, like the iframe in the attached simple case, it's GraphicsLayerTextureMapper::commitLayerChanges() can't be triggered, so AnimationStarted event can't be dispatched into AnimationController to stop the animation timer.
Comment 1 Mark Wang 2015-06-30 02:43:50 PDT
Created attachment 255817 [details]
the simple case to reproduce this issue.
Comment 2 Mark Wang 2015-06-30 18:56:33 PDT
Simon, could you verify if this issuce can be reproduced with recent Safar? Thanks!
Comment 3 Simon Fraser (smfr) 2015-06-30 19:13:55 PDT
No, I don't see any animations running in the iframe in Mac Safari.
Comment 4 Mark Wang 2015-06-30 19:20:26 PDT
There is no any animation displayed on screen when it is running, but it causes CPU to be busy because timer of AnimationController is continually created and destroyed.

The best way is to add a log in ImplicitAnimation::timeToNextService() as my first comment, and then load the attached simple case.
Comment 5 Antoine Quint 2023-04-13 01:52:44 PDT
The code in question has been removed from WebKit.