Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9dcbb22277532b1b42cc6180b32ccacec07a68c1
      
https://github.com/WebKit/WebKit/commit/9dcbb22277532b1b42cc6180b32ccacec07a68c1
  Author: Simon Fraser <[email protected]>
  Date:   2023-09-16 (Sat, 16 Sep 2023)

  Changed paths:
    M Source/WebCore/rendering/RenderLayerCompositor.cpp
    M Source/WebCore/rendering/RenderLayerCompositor.h

  Log Message:
  -----------
  Avoid computing layer bounds in 
BackingSharingState::isAdditionalProviderCandidate()
https://bugs.webkit.org/show_bug.cgi?id=261630
rdar://115584910

Reviewed by Alan Baradlay.

isAdditionalProviderCandidate() is called when we're asking if a given 
RenderLayer can be added to
the list of composted layers that may share their backing store with other 
sibling layers. This does
a traversal over the existing list checking for overlap by computing the bounds 
of the incoming and
the existing layers. When this list gets long (thousands of layers), this is 
very slow.

The compositing code has already computed layer bounds for overlap testing, so 
we can just use the
existing rects. These come in via "OverlapExtent" which manages the lazy 
computation of layer
bounds. In order to support this lazy computation via a call to
`RenderLayerCompositor::computeExtent()`, move 
`updateBeforeDescendantTraversal()` and
`updateAfterDescendantTraversal()` to be member functions of 
RenderLayerComopsitor, and pass them
the LayerOverlapMap and OverlapExtent; they can then ensure that the bounds is 
computed only when
needed. We store each candidate layer's bounds in 
`BackingSharingState::Provider`.

* Source/WebCore/rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::BackingSharingState::backingProviderCandidates):
(WebCore::RenderLayerCompositor::BackingSharingState::backingSharingStackingContext
 const):
(WebCore::RenderLayerCompositor::BackingSharingState::startBackingSharingSequence):
(WebCore::RenderLayerCompositor::BackingSharingState::addBackingSharingCandidate):
(WebCore::RenderLayerCompositor::BackingSharingState::isAdditionalProviderCandidate
 const):
(WebCore::RenderLayerCompositor::computeCompositingRequirements):
(WebCore::RenderLayerCompositor::traverseUnchangedSubtree):
(WebCore::RenderLayerCompositor::updateBackingSharingBeforeDescendantTraversal):
(WebCore::RenderLayerCompositor::updateBackingSharingAfterDescendantTraversal):
(WebCore::RenderLayerCompositor::layerRepaintTargetsBackingSharingLayer const):
(WebCore::RenderLayerCompositor::BackingSharingState::backingProviderCandidates 
const): Deleted.
(WebCore::RenderLayerCompositor::BackingSharingState::updateBeforeDescendantTraversal):
 Deleted.
(WebCore::RenderLayerCompositor::BackingSharingState::updateAfterDescendantTraversal):
 Deleted.
* Source/WebCore/rendering/RenderLayerCompositor.h:

Canonical link: https://commits.webkit.org/268056@main


_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to