[Webkit-unassigned] [Bug 171926] Computing animated style should not require renderers

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Sep 14 09:02:54 PDT 2017


https://bugs.webkit.org/show_bug.cgi?id=171926

Sam Weinig <sam at webkit.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sam at webkit.org
 Attachment #320766|review?                     |review+
              Flags|                            |

--- Comment #26 from Sam Weinig <sam at webkit.org> ---
Comment on attachment 320766
  --> https://bugs.webkit.org/attachment.cgi?id=320766
patch

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

> Source/WebCore/page/animation/CompositeAnimation.h:57
> +    std::unique_ptr<RenderStyle> animate(Element&, const RenderStyle* currentStyle, const RenderStyle& targetStyle, bool& animationStateChanged);

Perhaps this could use a comment explaining what meaning of the style it returns is (is it still fair to call it the 'blended style'?  Better yet, as I note below, return a struct with a RenderStyle and animationStateChanged bit might make it more clear.

> Source/WebCore/style/StyleTreeResolver.cpp:251
> +    std::unique_ptr<RenderStyle> animatedStyle;
>  
> -    auto makeUpdate = [&] (std::unique_ptr<RenderStyle> style, Change change) {
> -        if (validity >= Validity::SubtreeInvalid)
> -            change = std::max(change, validity == Validity::SubtreeAndRenderersInvalid ? Detach : Force);
> -        if (parentChange >= Force)
> -            change = std::max(change, parentChange);
> -        return ElementUpdate { WTFMove(style), change, recompositeLayer };
> -    };
> +    auto& animationController = element.document().frame()->animation();
>  
> -    auto* renderer = element.renderer();
> +    animatedStyle = animationController.updateAnimations(element, *newStyle, oldStyle, recompositeLayer);

There doesn't seem to be a good reason to declare std::unique_ptr<RenderStyle> animatedStyle; up front. Could be done right when calling animationController.updateAnimations and use auto.

It also seems a bit unclear that recompositeLayer can change here.  I think this would be a bit more straightforward to read if updateAnimations returned a struct with animatedStyle and the animationStateChanged bit.

> Source/WebCore/style/StyleTreeResolver.cpp:258
> +    auto change = Detach;
> +    if (oldStyle)
> +        change = determineChange(*oldStyle, *newStyle);

Would this be clearer as:

auto change = oldStyle ? determineChange(*oldStyle, *newStyle) : Detach;

I dunno.

> Source/WebCore/style/StyleTreeResolver.cpp:266
> +    return ElementUpdate { WTFMove(newStyle), change, recompositeLayer };

I think you can remove the ElementUpdate identifier here.  It should be implicit.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20170914/9c8e7279/attachment-0001.html>


More information about the webkit-unassigned mailing list