[webkit-changes] [WebKit/WebKit] 7f4d81: Avoid evaluating layer backing store contents twic...

Simon Fraser noreply at github.com
Wed Jun 28 10:17:50 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7f4d81cc368a03b8e402309bdd04fa0f5dcf6904
      https://github.com/WebKit/WebKit/commit/7f4d81cc368a03b8e402309bdd04fa0f5dcf6904
  Author: Simon Fraser <simon.fraser at apple.com>
  Date:   2023-06-28 (Wed, 28 Jun 2023)

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

  Log Message:
  -----------
  Avoid evaluating layer backing store contents twice per update
https://bugs.webkit.org/show_bug.cgi?id=258579
rdar://111397321

Reviewed by Alan Baradlay.

Profiling youtube pages shows that we spend a lot of time in the PaintedContentsInfo code, which
does a partial tree walk to determine if a compositing layer can be rendered as a simple color, or
has no contents. This is called from `updateDirectlyCompositedBoxDecorations()` which is called by
both RenderLayerBacking::updateConfiguration() and RenderLayerBacking::updateAfterDescendants(); the
latter call can give different results, since the result depends on the configuration of descendant
layers.

Fix this by moving all the code that leverages PaintedContentsInfo into updateAfterDescendants(), so
the contents evaluation is done only once; also guard it on a
m_owningLayer.needsCompositingConfigurationUpdate() check.

It's safe to move the code that calls setAppliesDeviceScale() and setShouldPaintUsingCompositeCopy()
here; those calls don't change the GraphicsLayer hierarchy (the intent of "layerConfigChanged"),
they only set state on a GraphicsLayer.

Also remove some #if ENABLE(CSS_COMPOSITING) checks; these were intended to surround code related to
CSS Compositing and Blending, not internal compositing changes.

Tested by existing tests, particularly compositing/backing/solid-color-with-paints-into-ancestor.html.

* Source/WebCore/rendering/RenderHTMLCanvas.cpp:
(WebCore::RenderHTMLCanvas::paintReplaced):
* Source/WebCore/rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateConfiguration):
(WebCore::RenderLayerBacking::updateAfterDescendants):
* Source/WebCore/rendering/RenderLayerBacking.h:
* Source/WebCore/rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateBackingAndHierarchy):

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




More information about the webkit-changes mailing list