Bug 216374 - [Repaint] RenderLayerModelObject::styleWillChange may issue redundant repaint
Summary: [Repaint] RenderLayerModelObject::styleWillChange may issue redundant repaint
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: zalan
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-09-10 12:19 PDT by zalan
Modified: 2020-09-10 17:32 PDT (History)
11 users (show)

See Also:


Attachments
Patch (9.55 KB, patch)
2020-09-10 12:26 PDT, zalan
no flags Details | Formatted Diff | Diff
Patch (9.53 KB, patch)
2020-09-10 14:51 PDT, zalan
no flags Details | Formatted Diff | Diff
Patch (9.66 KB, patch)
2020-09-10 15:10 PDT, zalan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description zalan 2020-09-10 12:19:36 PDT
by calling layer()->repaintIncludingDescendants()
Comment 1 Radar WebKit Bug Importer 2020-09-10 12:20:05 PDT
<rdar://problem/68657490>
Comment 2 zalan 2020-09-10 12:26:40 PDT
Created attachment 408467 [details]
Patch
Comment 3 zalan 2020-09-10 12:27:15 PDT
EWS testing first.
Comment 4 Simon Fraser (smfr) 2020-09-10 12:57:03 PDT
Comment on attachment 408467 [details]
Patch

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

> Source/WebCore/rendering/RenderElement.cpp:389
> +    enum RepaintCoverage { None, RendererOnly, RendererAndDescendantsRenderersWithLayers };

RepaintCoverage is a bit ambiguous; it's not clear if it's "repaints done" or "repaints that need to be done". Maybe call it RequiredRepaint?

> Source/WebCore/rendering/RenderElement.cpp:400
> +                // When a layout hint happens, we do a repaint of the layer, since the layer could end up being destroyed.

"layout hint" seems like old terminology.

> Source/WebCore/rendering/RenderElement.cpp:401
> +                auto layerMayGetDestroyed = oldStyle.position() != newStyle.position() || oldStyle.usedZIndex() != newStyle.usedZIndex() || oldStyle.clip() != newStyle.clip() || oldStyle.hasClip() != newStyle.hasClip()

We can clearly do a better job of testing which style changes will result in the layer actually being destroyed.
Comment 5 zalan 2020-09-10 14:17:48 PDT
(In reply to Simon Fraser (smfr) from comment #4)
> Comment on attachment 408467 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=408467&action=review
> 
> > Source/WebCore/rendering/RenderElement.cpp:389
> > +    enum RepaintCoverage { None, RendererOnly, RendererAndDescendantsRenderersWithLayers };
> 
> RepaintCoverage is a bit ambiguous; it's not clear if it's "repaints done"
> or "repaints that need to be done". Maybe call it RequiredRepaint?
Yeah, that sounds better.

> 
> > Source/WebCore/rendering/RenderElement.cpp:400
> > +                // When a layout hint happens, we do a repaint of the layer, since the layer could end up being destroyed.
> 
> "layout hint" seems like old terminology.
Will remove.

> 
> > Source/WebCore/rendering/RenderElement.cpp:401
> > +                auto layerMayGetDestroyed = oldStyle.position() != newStyle.position() || oldStyle.usedZIndex() != newStyle.usedZIndex() || oldStyle.clip() != newStyle.clip() || oldStyle.hasClip() != newStyle.hasClip()
> 
> We can clearly do a better job of testing which style changes will result in
> the layer actually being destroyed.
I am sure we can. I don't think it should be part of this patch though.
Comment 6 zalan 2020-09-10 14:51:24 PDT
Created attachment 408479 [details]
Patch
Comment 7 Simon Fraser (smfr) 2020-09-10 14:57:53 PDT
Comment on attachment 408479 [details]
Patch

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

> Source/WebCore/rendering/RenderElement.cpp:401
> +                auto layerMayGetDestroyed = oldStyle.position() != newStyle.position() || oldStyle.usedZIndex() != newStyle.usedZIndex() || oldStyle.clip() != newStyle.clip() || oldStyle.hasClip() != newStyle.hasClip()
> +                    || oldStyle.hasAutoUsedZIndex() != newStyle.hasAutoUsedZIndex() || oldStyle.opacity() != newStyle.opacity() || oldStyle.transform() != newStyle.transform() || oldStyle.filter() != newStyle.filter();

I prefer the more wrapped version but ¯\_(ツ)_/¯
Comment 8 zalan 2020-09-10 15:10:45 PDT
Created attachment 408482 [details]
Patch
Comment 9 EWS 2020-09-10 17:32:50 PDT
Committed r266901: <https://trac.webkit.org/changeset/266901>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 408482 [details].