RESOLVED FIXED Bug 144198
Eliminate styleDidChange with StyleDifferenceEqual when updates are actually necessary
https://bugs.webkit.org/show_bug.cgi?id=144198
Summary Eliminate styleDidChange with StyleDifferenceEqual when updates are actually ...
Simon Fraser (smfr)
Reported 2015-04-25 16:13:50 PDT
Eliminate styleDidChange with StyleDifferenceEqual when updates are actually necessary
Attachments
Patch (30.99 KB, patch)
2015-04-25 16:29 PDT, Simon Fraser (smfr)
no flags
For EWS (33.55 KB, patch)
2015-04-27 09:09 PDT, Simon Fraser (smfr)
simon.fraser: review+
Simon Fraser (smfr)
Comment 1 2015-04-25 16:29:54 PDT
Darin Adler
Comment 2 2015-04-25 17:20:37 PDT
Comment on attachment 251654 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=251654&action=review > Source/WebCore/page/animation/CompositeAnimation.cpp:332 > CSSPropertyTransitionsMap::const_iterator end = m_transitions.end(); > for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != end; ++it) { > - if (ImplicitAnimation* anim = it->value.get()) > - anim->animate(this, &renderer, currentStyle, &targetStyle, resultStyle); > + ImplicitAnimation* anim = it->value.get(); > + if (anim && anim->animate(this, &renderer, currentStyle, &targetStyle, resultStyle)) > + animationStateChanged = true; > } Would look really great with a modern for loop: for (auto* animation : m_transitions.values()) { if (animation && animation->animate(this, &renderer, currentStyle, &targetStyle, resultStyle)) animationStateChanged = true; } > Source/WebCore/page/animation/ImplicitAnimation.cpp:91 > + // FIXME: still need this hack? Could you write a slightly longer version of this FIXME that is sentence capitalized and also explains why you think we might not need it? > Source/WebCore/rendering/RenderElement.h:48 > + // hasSideEffects is true when out-of-band state (e.g. animations) requires that styleDidChange processing > + // continues even if the style didn't change. The grammar here is a little strange. You say that hasSideEffects “is true”, but the comment is about this function, not about the callers to this function. Could you word it better? The comment should be information about what th function does or what the caller should do, I think. Or it could be about the caller if you say “Called with”, I guess. I probably wouldn’t have complained if it was worded that way. > Source/WebCore/rendering/RenderElement.h:330 > + bool animationStateChanged; > + setStyle(animation().updateAnimations(*this, WTF::move(style), animationStateChanged), hasSideEffects || animationStateChanged); This is not right. There is no guarantee about ordering of the evaluation of arguments, so it might compute "hasSideEffects || animationStateChanged" before updateAnimations returns. You need to put that in a separate statement to makes sure the ordering is right. > Source/WebCore/style/StyleResolveTree.cpp:205 > + bool animationsChanged; > + newRenderer->setStyleInternal(newRenderer->animation().updateAnimations(*newRenderer, newRenderer->style(), animationsChanged)); Same problem with arguments here.
Antti Koivisto
Comment 3 2015-04-26 15:11:09 PDT
Comment on attachment 251654 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=251654&action=review > Source/WebCore/ChangeLog:17 > + compositing or other work has to happen from styleStyle(). This is achieved by styleStyle? > Source/WebCore/page/animation/CompositeAnimation.h:58 > + Ref<RenderStyle> animate(RenderElement&, RenderStyle* currentStyle, RenderStyle& targetStyle, bool& animationStateChanged); Why does this return the style as return value and the state change boolean as argument... > Source/WebCore/page/animation/ImplicitAnimation.cpp:65 > +bool ImplicitAnimation::animate(CompositeAnimation*, RenderElement*, const RenderStyle*, RenderStyle* targetStyle, RefPtr<RenderStyle>& animatedStyle) ...while this does the opposite? > Source/WebCore/rendering/RenderElement.cpp:397 > +void RenderElement::setStyle(Ref<RenderStyle>&& style, bool hasSideEffects) At minimum this should use an enum. The name is bit vague. What do "side effects" mean here and why do they map to StyleDifferenceRecompositeLayer? How about passing the base StyleDifference as parameter instead? > Source/WebCore/style/StyleResolveTree.cpp:634 > + renderer->setAnimatableStyle(*newStyle, current.styleChangeType() == SyntheticStyleChange); Then this code would read something like auto minimumStyleDifference = current.styleChangeType() == SyntheticStyleChange ? StyleDifferenceRecompositeLayer : StyleDifferenceEqual; renderer->setAnimatableStyle(*newStyle, minimumStyleDifference); I think something would be clearer and more flexible than going via another bool/enum.
Simon Fraser (smfr)
Comment 4 2015-04-27 09:09:02 PDT
Simon Fraser (smfr)
Comment 5 2015-04-27 09:41:42 PDT
Comment on attachment 251746 [details] For EWS Carrying review forward
Simon Fraser (smfr)
Comment 6 2015-04-27 22:01:33 PDT
Simon Fraser (smfr)
Comment 7 2015-04-27 23:54:06 PDT
Note You need to log in before you can comment on or make changes to this bug.