2009-07-30 Simon Fraser <simon.fraser@apple.com>

        Reviewed by Dan Bernstein.

        Animation with a timing function property in a keyframe eats CPU
        https://bugs.webkit.org/show_bug.cgi?id=27856
        <rdar://problem/7104476> Animation demo uses lots of CPU

        Don't include animation-timing-function in the list of properties to
        animate in a keyframe animation, because this property is not animated;
        instead, it describes the timing function to apply to this keyframe.

        This prevents the animation code from thinking that there's a property
        that it has to software-animate, and thus firing the animation timer frequently.

        Not testable because there is no visible impact.

        * css/CSSStyleSelector.cpp:
        (WebCore::CSSStyleSelector::keyframeStylesForAnimation): Don't add
        CSSPropertyWebkitAnimationTimingFunction to the list of properties to animate.

        * page/animation/KeyframeAnimation.cpp
        (WebCore::KeyframeAnimation::getKeyframeAnimationInterval): Add a comment

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@46603 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f735deef
2009-07-30 Simon Fraser <simon.fraser@apple.com>
Reviewed by Dan Bernstein.
Animation with a timing function property in a keyframe eats CPU
https://bugs.webkit.org/show_bug.cgi?id=27856
<rdar://problem/7104476> Animation demo uses lots of CPU
Don't include animation-timing-function in the list of properties to
animate in a keyframe animation, because this property is not animated;
instead, it describes the timing function to apply to this keyframe.
This prevents the animation code from thinking that there's a property
that it has to software-animate, and thus firing the animation timer frequently.
Not testable because there is no visible impact.
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::keyframeStylesForAnimation): Don't add
CSSPropertyWebkitAnimationTimingFunction to the list of properties to animate.
* page/animation/KeyframeAnimation.cpp
(WebCore::KeyframeAnimation::getKeyframeAnimationInterval): Add a comment
2009-07-30 Mike Fenton <mike.fenton@torchmobile.com>
Reviewed by Adam Treat.
......
......@@ -1318,8 +1318,13 @@ void CSSStyleSelector::keyframeStylesForAnimation(Element* e, const RenderStyle*
// Add all the animating properties to the list
CSSMutableStyleDeclaration::const_iterator end = kf->style()->end();
for (CSSMutableStyleDeclaration::const_iterator it = kf->style()->begin(); it != end; ++it)
list.addProperty((*it).id());
for (CSSMutableStyleDeclaration::const_iterator it = kf->style()->begin(); it != end; ++it) {
int property = (*it).id();
// Timing-function within keyframes is special, because it is not animated; it just
// describes the timing function between this keyframe and the next.
if (property != CSSPropertyWebkitAnimationTimingFunction)
list.addProperty((*it).id());
}
// Add this keyframe style to all the indicated key times
Vector<float> keys;
......
......@@ -93,8 +93,10 @@ void KeyframeAnimation::getKeyframeAnimationInterval(const RenderStyle*& fromSty
return;
const TimingFunction* timingFunction = 0;
if (fromStyle->animations() && fromStyle->animations()->size() > 0)
if (fromStyle->animations() && fromStyle->animations()->size() > 0) {
// We get the timing function from the first animation, because we've synthesized a RenderStyle for each keyframe.
timingFunction = &(fromStyle->animations()->animation(0)->timingFunction());
}
prog = progress(scale, offset, timingFunction);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment