[webkit-changes] [WebKit/WebKit] e6d4d4: RenderObject::setNeedsBoundariesUpdate() should av...
Ryosuke Niwa
noreply at github.com
Fri Mar 15 14:51:19 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: e6d4d4d2b7504224bf106c2734c82c18bc8a27b7
https://github.com/WebKit/WebKit/commit/e6d4d4d2b7504224bf106c2734c82c18bc8a27b7
Author: Ryosuke Niwa <rniwa at webkit.org>
Date: 2024-03-15 (Fri, 15 Mar 2024)
Changed paths:
M Source/WebCore/rendering/RenderObject.cpp
M Source/WebCore/rendering/RenderObject.h
M Source/WebCore/rendering/svg/RenderSVGBlock.cpp
M Source/WebCore/rendering/svg/RenderSVGInline.cpp
M Source/WebCore/rendering/svg/RenderSVGText.cpp
M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGContainer.cpp
M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGContainer.h
M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGForeignObject.cpp
M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGImage.cpp
M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGImage.h
M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGModelObject.cpp
M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGResourceContainer.cpp
M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGRoot.cpp
M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGRoot.h
M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGShape.cpp
M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGShape.h
M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGViewportContainer.cpp
Log Message:
-----------
RenderObject::setNeedsBoundariesUpdate() should avoid work in non-SVG elements
https://bugs.webkit.org/show_bug.cgi?id=271010
Reviewed by Simon Fraser.
This PR refactors RenderObject::setNeedsBoundariesUpdate() into two functions
invalidateCachedBoundaries which invalidates the ancestor with boundary box cache,
and setNeedsBoundariesUpdate, which sets a dirty bit on this boundary box cache.
This avoids the overhead of recursive function calls in setNeedsBoundariesUpdate(),
and avoids traversing upwards of non-SVG render objects. Each render SVG objects
which has a non-trivial setNeedsBoundariesUpdate now sets UsesBoundaryCaching flag
in type specific flags (ReplacedFlag or SVGModelObjectFlag).
A number of call sites of RenderObject::setNeedsBoundariesUpdate now need to call
invalidateCachedBoundaries on its parent since invalidateCachedBoundaries stops at
the first render SVG object which uses boundary box cache.
This PR also removes the unused RenderObject::needsBoundariesUpdate and its overrides.
* Source/WebCore/rendering/RenderObject.cpp:
(WebCore::RenderObject::willBeRemovedFromTree):
(WebCore::RenderObject::setNeedsBoundariesUpdate):
(WebCore::RenderObject::invalidateCachedBoundaries): Inline the code to walk up
the ancestor objects here along with an early exit for when we're out of SVG subtree.
* Source/WebCore/rendering/RenderObject.h:
(WebCore::RenderObject::isSVGRenderer const): Added.
(WebCore::RenderObject::setNeedsTransformUpdate):
(WebCore::RenderObject::needsBoundariesUpdate): Deleted.
(WebCore::RenderObject): Shuffled type flags so that TypeSpecificFlags can be now
16-bits instead of 8-bit like it used to be prior to this PR.
(WebCore::RenderObject::usesBoundaryCaching const): Added.
* Source/WebCore/rendering/svg/RenderSVGBlock.cpp:
(WebCore::RenderSVGBlock::styleDidChange):
* Source/WebCore/rendering/svg/RenderSVGInline.cpp:
(WebCore::RenderSVGInline::styleDidChange):
* Source/WebCore/rendering/svg/RenderSVGText.cpp:
(WebCore::RenderSVGText::layout):
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGContainer.cpp:
(WebCore::LegacyRenderSVGContainer::LegacyRenderSVGContainer):
(WebCore::LegacyRenderSVGContainer::layout):
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGContainer.h:
(WebCore::LegacyRenderSVGContainer::needsBoundariesUpdate): Deleted.
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGForeignObject.cpp:
(WebCore::LegacyRenderSVGForeignObject::layout):
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGImage.cpp:
(WebCore::LegacyRenderSVGImage::LegacyRenderSVGImage):
(WebCore::LegacyRenderSVGImage::layout):
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGImage.h:
(WebCore::LegacyRenderSVGImage::needsBoundariesUpdate): Deleted.
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGModelObject.cpp:
(WebCore::LegacyRenderSVGModelObject::LegacyRenderSVGModelObject):
(WebCore::LegacyRenderSVGModelObject::styleDidChange):
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGResourceContainer.cpp:
(WebCore::LegacyRenderSVGResourceContainer::markClientForInvalidation):
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGRoot.cpp:
(WebCore::LegacyRenderSVGRoot::LegacyRenderSVGRoot):
(WebCore::LegacyRenderSVGRoot::styleDidChange):
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGRoot.h:
(WebCore::LegacyRenderSVGRoot::needsBoundariesUpdate): Deleted.
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGShape.cpp:
(WebCore::LegacyRenderSVGShape::LegacyRenderSVGShape):
(WebCore::LegacyRenderSVGShape::layout):
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGShape.h:
(WebCore::LegacyRenderSVGShape::needsBoundariesUpdate): Deleted.
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGViewportContainer.cpp:
(WebCore::LegacyRenderSVGViewportContainer::calcViewport):
Canonical link: https://commits.webkit.org/276201@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list