https://bugs.webkit.org/show_bug.cgi?id=220892
<rdar://73538454>
Reviewed by Alan Bujtas.
Source/WebCore:
Fix an issue with backing sharing where a composited layer needs to interrupted a backing
sharing sequence. In some cases, a layer that became composited via an indirect reason
(like overflow positioning) would not interrupt a backing sharing sequence, leaving a dangling
layer that ended up painting into the wrong ancestor.
The fix is to ensure that BackingSharingState::updateBeforeDescendantTraversal() and
BackingSharingState::updateAfterDescendantTraversal() have the same behavior when a layer
becomes composited (thus interrupting the sequence). However, we also have ensure that
updateAfterDescendantTraversal() doesn't erroeously interrupt the sequence when the sequence
was initiated by some descendant, hence the check against the preDescendantProviderCandidate.
Test: compositing/shared-backing/backing-sharing-compositing-change.html
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::BackingSharingState::endBackingSharingSequence):
(WebCore::RenderLayerCompositor::BackingSharingState::updateBeforeDescendantTraversal):
(WebCore::RenderLayerCompositor::BackingSharingState::updateAfterDescendantTraversal):
(WebCore::RenderLayerCompositor::computeCompositingRequirements):
(WebCore::RenderLayerCompositor::traverseUnchangedSubtree):
LayoutTests:
* compositing/shared-backing/backing-sharing-compositing-change-expected.html: Added.
* compositing/shared-backing/backing-sharing-compositing-change.html: Added.
Canonical link: https://commits.webkit.org/239450@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@279636 268f45cc-cd09-0410-ab3c-d52691b4dbfc