[LBSE] Cache visual overflow rect computation#57206
Merged
webkit-commit-queue merged 1 commit intoWebKit:mainfrom Feb 4, 2026
Merged
Conversation
Collaborator
|
EWS run on previous version of this PR (hash e29d537) Details |
rwlbuis
reviewed
Jan 26, 2026
e29d537 to
cdb7643
Compare
Collaborator
|
EWS run on current version of this PR (hash cdb7643) Details |
https://bugs.webkit.org/show_bug.cgi?id=306213 Reviewed by Rob Buis. SVGBoundingBoxComputation::computeVisualOverflowRect() is expensive and appears frequently in profiling. This patch ensures the cached visual overflow rect is properly invalidated when: 1. Style changes affect visual overflow (stroke properties, outline, clip-path, mask, filter, marker references) 2. Referenced SVG resource content changes (e.g., a <rect> inside <clipPath> changes its geometry) Add RenderLayerModelObject::invalidateCachedVisualOverflowRect() virtual method with overrides in RenderSVGModelObject, RenderSVGRoot, and RenderSVGText. Override RenderSVGResourceContainer::layout() to call repaintAllClients() after children layout, ensuring clients are notified when resource content changes. In CSSSVGResourceElementClient::resourceChanged(), always invalidate the cached visual overflow rect, but skip the repaint call during layout since the existing post-layout mechanism handles it. Covered by existing tests. * Source/WebCore/rendering/ReferencedSVGResources.cpp: (WebCore::CSSSVGResourceElementClient::resourceChanged): * Source/WebCore/rendering/RenderLayerModelObject.h: (WebCore::RenderLayerModelObject::invalidateCachedVisualOverflowRect): * Source/WebCore/rendering/svg/RenderSVGContainer.cpp: (WebCore::RenderSVGContainer::layoutChildren): * Source/WebCore/rendering/svg/RenderSVGImage.cpp: (WebCore::RenderSVGImage::layout): * Source/WebCore/rendering/svg/RenderSVGModelObject.cpp: (WebCore::RenderSVGModelObject::styleDidChange): * Source/WebCore/rendering/svg/RenderSVGModelObject.h: (WebCore::RenderSVGModelObject::visualOverflowRectEquivalent const): * Source/WebCore/rendering/svg/RenderSVGResourceContainer.cpp: (WebCore::RenderSVGResourceContainer::layout): * Source/WebCore/rendering/svg/RenderSVGResourceContainer.h: * Source/WebCore/rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::layoutChildren): * Source/WebCore/rendering/svg/RenderSVGRoot.h: * Source/WebCore/rendering/svg/RenderSVGShape.cpp: (WebCore::RenderSVGShape::layout): * Source/WebCore/rendering/svg/RenderSVGText.cpp: (WebCore::RenderSVGText::updatePositionAndOverflow): * Source/WebCore/rendering/svg/RenderSVGText.h: Canonical link: https://commits.webkit.org/306815@main
cdb7643 to
4bc53a1
Compare
Collaborator
|
Committed 306815@main (4bc53a1): https://commits.webkit.org/306815@main Reviewed commits have been landed. Closing PR #57206 and removing active labels. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
4bc53a1
cdb7643