[webkit-changes] [WebKit/WebKit] 0ef1fe: Use dirty bits to only traverse the unchanged subt...
mattwoodrow
noreply at github.com
Mon Oct 7 13:18:54 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 0ef1fec1cdce7a5dd3007976f09afdf302267593
https://github.com/WebKit/WebKit/commit/0ef1fec1cdce7a5dd3007976f09afdf302267593
Author: Matt Woodrow <mattwoodrow at apple.com>
Date: 2024-10-07 (Mon, 07 Oct 2024)
Changed paths:
M LayoutTests/svg/compositing/transform-change-repainting-no-viewBox.html
M Source/WTF/wtf/Assertions.h
M Source/WebCore/page/LocalFrameView.cpp
M Source/WebCore/page/LocalFrameView.h
M Source/WebCore/rendering/RenderElement.cpp
M Source/WebCore/rendering/RenderLayer.cpp
M Source/WebCore/rendering/RenderLayer.h
M Source/WebCore/rendering/RenderLayerBacking.cpp
M Source/WebCore/rendering/RenderLayerCompositor.cpp
M Source/WebCore/rendering/RenderLayerModelObject.cpp
M Source/WebCore/rendering/RenderLayerScrollableArea.cpp
M Source/WebCore/rendering/RenderLayerScrollableArea.h
M Source/WebCore/rendering/RenderObject.cpp
M Source/WebCore/rendering/RenderObject.h
M Source/WebCore/rendering/RenderTreeAsText.cpp
M Source/WebCore/rendering/RenderView.cpp
M Source/WebCore/rendering/RenderView.h
Log Message:
-----------
Use dirty bits to only traverse the unchanged subtrees with recursiveUpdateLayerPositions.
https://bugs.webkit.org/show_bug.cgi?id=276706
<rdar://131903605>
Reviewed by Alan Baradlay.
Adds a set of dirty bits to mark which RenderLayers need their position updates,
and makes recursiveUpdateLayerPositions only walk the dirty subset of the tree.
With a debug build, the full traversal still gets completed, and it verifies
that all computed values would have been a no-op had they been skipped.
recursiveUpdateLayerPositions gets a templated 'mode' parameter so that the
compiled code in release should be mostly identical to before (except the flag
checks). Each block of state changes handles the write/verify branches, to keep
these together and hopefully keep them in sync.
Also adds a new tree dump to 'Compositing' logging, showing the RenderLayer tree
and its dirty bits before/after the recursiveUpdateLayerPositions.
The general approach is that we mark layers (and their ancestors) that we know
to be changed), and then descend into children of those to check if any ancestor
state that they depend on has changed.
We could instead ensure that changes to state that descendants use trigger a
full descendant subtree update, and avoid needing to iterate the child list to
check. Logging of visited vs updated layer counts suggests that this wouldn't
make much difference. We would likely also need to make sure these extra
triggers are specific (not all style changes for example) to avoid updating too
much.
Layout on a RenderObject with a layer triggers update on the direct children of
that layer, since we can move (but not layout) a descendant renderer, and the
child layer is then a further descendant of the moved renderer. We need to
update the child layer to account for the different offset to parent layer.
ClipRectsContext always (and only) specified
ClipRectsOption::IncludeOverlayScrollbarSize when using RootRelativeClipRects,
so that is now implicit. Clip rect validation now can assert these when adding
to the cache, and verify cached clips using it.
recursiveUpdateLayerPositionsAfterScroll no longer checks isVisuallyNonEmpty()
to clear repaint rects, since this doesn't match the condition we use any other
time (and changing the others results in lots of test failures).
* Source/WebCore/rendering/RenderElement.cpp:
(WebCore::RenderElement::repaintOldAndNewPositionsForSVGRenderer const):
* Source/WebCore/rendering/RenderLayer.cpp:
(WebCore::ClipRectsCache::ClipRectsCache):
(WebCore::ClipRectsCache::getClipRects const):
(WebCore::RenderLayer::RenderLayer):
(WebCore::RenderLayer::addChild):
(WebCore::RenderLayer::isStackingContextChanged):
(WebCore::RenderLayer::setNeedsPositionUpdate):
(WebCore::RenderLayer::setSelfAndChildrenNeedPositionUpdate):
(WebCore::RenderLayer::setSelfAndDescendantsNeedPositionUpdate):
(WebCore::compositingLogEnabledRenderLayer):
(WebCore::RenderLayer::updateLayerPositionsAfterStyleChange):
(WebCore::RenderLayer::updateLayerPositionsAfterLayout):
(WebCore::RenderLayer::ancestorLayerPositionStateChanged):
(WebCore::RenderLayer::recursiveUpdateLayerPositions):
(WebCore::RenderLayer::dirtyAncestorChainHasSelfPaintingLayerDescendantStatus):
(WebCore::RenderLayer::computeRepaintRects):
(WebCore::RenderLayer::computeRepaintRectsIncludingDescendants):
(WebCore::RenderLayer::compositingStatusChanged):
(WebCore::RenderLayer::recursiveUpdateLayerPositionsAfterScroll):
(WebCore::RenderLayer::dirtyAncestorChainHasBlendingDescendants):
(WebCore::RenderLayer::updateTransform):
(WebCore::RenderLayer::setHasVisibleContent):
(WebCore::RenderLayer::dirtyVisibleContentStatus):
(WebCore::RenderLayer::dirtyAncestorChainVisibleDescendantStatus):
(WebCore::RenderLayer::updateLayerPosition):
(WebCore::RenderLayer::hitTestLayer):
(WebCore::RenderLayer::hitTestTransformedLayerInFragments):
(WebCore::RenderLayer::verifyClipRects):
(WebCore::RenderLayer::verifyClipRect):
(WebCore::RenderLayer::updateClipRects):
(WebCore::RenderLayer::clipRects const):
(WebCore::RenderLayer::calculateClipRects const):
(WebCore::outputLayerPositionTreeLegend):
(WebCore::outputLayerPositionTreeRecursive):
(WebCore::showLayerPositionTree):
* Source/WebCore/rendering/RenderLayer.h:
(WebCore::RenderLayer::setIsHiddenByOverflowTruncation):
* Source/WebCore/rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::setBackingSharingLayers):
(WebCore::RenderLayerBacking::setRequiresOwnBackingStore):
* Source/WebCore/rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::BackingSharingState::issuePendingRepaints):
(WebCore::RenderLayerCompositor::updateBacking):
* Source/WebCore/rendering/RenderLayerScrollableArea.cpp:
(WebCore::RenderLayerScrollableArea::positionOverflowControls):
* Source/WebCore/rendering/RenderLayerScrollableArea.h:
* Source/WebCore/rendering/RenderObject.cpp:
(WebCore::RenderObject::clearNeedsLayout):
(WebCore::operator<<):
* Source/WebCore/rendering/RenderObject.h:
Canonical link: https://commits.webkit.org/284780@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