<html>
    <head>
      <base href="https://bugs.webkit.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:sam@webkit.org" title="Sam Weinig <sam@webkit.org>"> <span class="fn">Sam Weinig</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Computing animated style should not require renderers"
   href="https://bugs.webkit.org/show_bug.cgi?id=171926">bug 171926</a>
          <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">CC</td>
           <td>
                
           </td>
           <td>sam@webkit.org
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Attachment #320766 Flags</td>
           <td>review?
           </td>
           <td>review+
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Computing animated style should not require renderers"
   href="https://bugs.webkit.org/show_bug.cgi?id=171926#c26">Comment # 26</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Computing animated style should not require renderers"
   href="https://bugs.webkit.org/show_bug.cgi?id=171926">bug 171926</a>
              from <span class="vcard"><a class="email" href="mailto:sam@webkit.org" title="Sam Weinig <sam@webkit.org>"> <span class="fn">Sam Weinig</span></a>
</span></b>
        <pre>Comment on <span class=""><a href="attachment.cgi?id=320766&action=diff" name="attach_320766" title="patch">attachment 320766</a> <a href="attachment.cgi?id=320766&action=edit" title="patch">[details]</a></span>
patch

View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=320766&action=review">https://bugs.webkit.org/attachment.cgi?id=320766&action=review</a>

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

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.

<span class="quote">> 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);</span >

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.

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

Would this be clearer as:

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

I dunno.

<span class="quote">> Source/WebCore/style/StyleTreeResolver.cpp:266
> +    return ElementUpdate { WTFMove(newStyle), change, recompositeLayer };</span >

I think you can remove the ElementUpdate identifier here.  It should be implicit.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>