Bug 49073

Summary: Move resumeAnimations/suspendAnimations from Frame to AnimationController.
Product: WebKit Reporter: Chris Marrin <cmarrin>
Component: Layout and RenderingAssignee: Chris Marrin <cmarrin>
Status: RESOLVED FIXED    
Severity: Normal CC: simon.fraser
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   
Attachments:
Description Flags
Patch
none
Patch
none
Patch simon.fraser: review+

Description Chris Marrin 2010-11-05 09:55:15 PDT
Darin doesn't want to increase the API of Frame, so these should be moved to AnimationController.
Comment 1 Chris Marrin 2010-11-05 11:22:45 PDT
Created attachment 73088 [details]
Patch
Comment 2 Darin Adler 2010-11-05 12:36:49 PDT
Comment on attachment 73088 [details]
Patch

I think it would be cleaner to rename the existing function resumeAnimationsForThisFrameOnly or something like that, and have a new function with the loop in it, instead of using a magic value of 0 to mean "loop through subframes".
Comment 3 Simon Fraser (smfr) 2010-11-05 12:44:33 PDT
Comment on attachment 73088 [details]
Patch

Right, Chris is going to add new methods to AnimationController.
Comment 4 Chris Marrin 2010-11-05 13:02:37 PDT
Created attachment 73103 [details]
Patch
Comment 5 Simon Fraser (smfr) 2010-11-05 13:13:10 PDT
Comment on attachment 73103 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=73103&action=review

> WebCore/page/animation/AnimationController.cpp:241
>      setBeginAnimationUpdateTime(cBeginAnimationUpdateTimeNotSet);
>      
>      RenderObjectAnimationMap::const_iterator animationsEnd = m_compositeAnimations.end();
>      for (RenderObjectAnimationMap::const_iterator it = m_compositeAnimations.begin(); it != animationsEnd; ++it) {
>          RenderObject* renderer = it->first;
> +        if (renderer->document() == m_frame->document()) {
> +            CompositeAnimation* compAnim = it->second.get();
> +            compAnim->suspendAnimations();
> +        }
> +    }

Too much copied code here. This should just do
suspendAnimationsForDocument(m_frame->document());

> WebCore/page/animation/AnimationController.cpp:261
> +    setBeginAnimationUpdateTime(cBeginAnimationUpdateTimeNotSet);
> +    
> +    RenderObjectAnimationMap::const_iterator animationsEnd = m_compositeAnimations.end();
> +    for (RenderObjectAnimationMap::const_iterator it = m_compositeAnimations.begin(); it != animationsEnd; ++it) {
> +        RenderObject* renderer = it->first;
> +        if (renderer->document() == m_frame->document()) {
> +            CompositeAnimation* compAnim = it->second.get();
> +            compAnim->resumeAnimations();
> +        }
> +    }

Same, just call resumeAnimationsForDocument(m_frame->document());

> WebCore/page/animation/AnimationController.cpp:311
> +    /*
> +    bool traverseSubframes = false;
> +    if (!document) {
> +        document = m_frame->document();
> +        traverseSubframes = true;
> +    }
> +    */
> +

Remove!
Comment 6 Chris Marrin 2010-11-05 13:37:23 PDT
Created attachment 73110 [details]
Patch
Comment 7 Simon Fraser (smfr) 2010-11-05 13:57:27 PDT
Comment on attachment 73110 [details]
Patch

So much nicer!
Comment 8 Chris Marrin 2010-11-05 14:45:59 PDT
Committed r71451: <http://trac.webkit.org/changeset/71451>