[webkit-reviews] review granted: [Bug 171926] Computing animated style should not require renderers : [Attachment 320766] patch
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu Sep 14 09:02:54 PDT 2017
Sam Weinig <sam at webkit.org> has granted Antti Koivisto <koivisto at iki.fi>'s
request for review:
Bug 171926: Computing animated style should not require renderers
https://bugs.webkit.org/show_bug.cgi?id=171926
Attachment 320766: patch
https://bugs.webkit.org/attachment.cgi?id=320766&action=review
--- 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.
More information about the webkit-reviews
mailing list