Skip to content
Permalink
Browse files
Eliminate one repaint from SVGResourcesCache::clientLayoutChanged
https://bugs.webkit.org/show_bug.cgi?id=241822

Reviewed by Simon Fraser.

SVGResourcesCache::clientLayoutChanged is called under all of the SVG
render object layout functions, to invalidate the SVG resource and
repaint the element. But all of the layout functions will already
repaint the element due to their LayoutRepainter on the stack.

This repaint can be expensive due to the rectangle calculations. We can
skip it by passing false into clientLayoutChanged.

This is an improvement of 3% on the MotionMark Suits sub-test on some
devices.

* Source/WebCore/rendering/svg/SVGResourcesCache.cpp:
(WebCore::SVGResourcesCache::clientLayoutChanged):

Canonical link: https://commits.webkit.org/251727@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@295722 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
heycam committed Jun 22, 2022
1 parent 49c1b53 commit 4ca5e92
Showing 1 changed file with 1 addition and 1 deletion.
@@ -88,7 +88,7 @@ void SVGResourcesCache::clientLayoutChanged(RenderElement& renderer)
// Invalidate the resources if either the RenderElement itself changed,
// or we have filter resources, which could depend on the layout of children.
if (renderer.selfNeedsLayout())
resources->removeClientFromCache(renderer);
resources->removeClientFromCache(renderer, false);
}

static inline bool rendererCanHaveResources(RenderObject& renderer)

0 comments on commit 4ca5e92

Please sign in to comment.