[Webkit-unassigned] [Bug 163542] Rename setNeedsStyleRecalc to invalidateStyle

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Oct 17 11:35:41 PDT 2016


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

Darin Adler <darin at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #291818|review?                     |review+
              Flags|                            |

--- Comment #4 from Darin Adler <darin at apple.com> ---
Comment on attachment 291818
  --> https://bugs.webkit.org/attachment.cgi?id=291818
patch

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

> Source/WebCore/dom/Element.h:549
> +    void invalidateStyle();
> +    WEBCORE_EXPORT void invalidateStyleAndLayers();
> +    void invalidateStyleForSubtree();
> +    void invalidateRenderers();

There’s no question that these names are clearer than the old way.

However, I am not clear on when I should call each one of these. Is there something simple we could write in a comment to make it clear how to choose from among these four? In particular, when would I not have to invalidate layers? When I invalidate a subtree is there some reason I don’t need to worry about layers?

> Source/WebCore/dom/Node.cpp:803
> +    bool markAncestors = styleInvalidationScope() == Style::InvalidationScope::None || scope == Style::InvalidationScope::Renderers;

I don’t understand why this check is correct. I think this needs a  “why” comment.

> Source/WebCore/dom/Node.h:322
> +    void clearNeedsStyleRecalc() { clearStyleInvalidation(); }

This function seems to have a peculiar name now that it’s not paired with a setNeedsStyleRecalc function. Do we really need to keep it?

> Source/WebCore/dom/ShadowRoot.cpp:121
> +    // If this was ever used dynamically child styles would need to be invalidated here.

Needs a comma after the word "dynamically". But also, what exactly does "used dynamically" mean? Can we say that in a more straightforward way?

> Source/WebCore/dom/Text.cpp:224
> +    if (styleInvalidationScope() == Style::InvalidationScope::Renderers)

Even though this is the highest one, I think that >= makes more logical sense to me here.

> Source/WebCore/style/StyleInvalidationScope.h:36
> +enum class InvalidationScope {
> +    None,
> +    Element,
> +    Subtree,
> +    Renderers
> +};

The word "scope" makes sense when telling something to invalidate. But not as much sense when it’s indicating how much is invalid. It’s also unclear to me that when renderers are "invalidated" that also means the entire subtree is invalidated. Maybe all this is more obvious to someone working in this area, but I am not so sure.

> Source/WebCore/style/StyleInvalidationScope.h:41
> +enum class InvalidationMode {
> +    Normal,
> +    RecompositeLayers
> +};

Maybe this looks better at the call site when setting this mode. But at sites where we use this, it seems that a boolean shouldRecompositeLayers() or something like that would be easier to read.

> Source/WebCore/style/StyleTreeResolver.cpp:203
> +    bool shouldReconstructRenderTree = element.styleInvalidationScope() == InvalidationScope::Renderers || parent().change == Detach;

Same thought about >= here.

> Source/WebCore/style/StyleTreeResolver.cpp:236
> +    if (update.change != Detach && (parent().change == Force || element.styleInvalidationScope() == InvalidationScope::Subtree))

Why is "==" right here? What about the Renderers case?

> Source/WebCore/style/StyleTreeResolver.cpp:365
> +            if (text.styleInvalidationScope() == InvalidationScope::Renderers && parent.change != Detach)

Same thought about >= here.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20161017/6147bce1/attachment.html>


More information about the webkit-unassigned mailing list