<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[279636] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/279636">279636</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2021-07-06 20:36:45 -0700 (Tue, 06 Jul 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>REGRESSION (<a href="http://trac.webkit.org/projects/webkit/changeset/262237">r262237</a>) Safari 14.x shows graphics artifacts when scrolling, using drop-down menus or just moving the mouse
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.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerCompositorcpp">trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestscompositingsharedbackingbackingsharingcompositingchangeexpectedhtml">trunk/LayoutTests/compositing/shared-backing/backing-sharing-compositing-change-expected.html</a></li>
<li><a href="#trunkLayoutTestscompositingsharedbackingbackingsharingcompositingchangehtml">trunk/LayoutTests/compositing/shared-backing/backing-sharing-compositing-change.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (279635 => 279636)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2021-07-07 03:12:05 UTC (rev 279635)
+++ trunk/LayoutTests/ChangeLog 2021-07-07 03:36:45 UTC (rev 279636)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2021-07-06  Simon Fraser  <simon.fraser@apple.com>
+
+        REGRESSION (r262237) Safari 14.x shows graphics artifacts when scrolling, using drop-down menus or just moving the mouse
+        https://bugs.webkit.org/show_bug.cgi?id=220892
+        <rdar://73538454>
+
+        Reviewed by Alan Bujtas.
+
+        * compositing/shared-backing/backing-sharing-compositing-change-expected.html: Added.
+        * compositing/shared-backing/backing-sharing-compositing-change.html: Added.
+
</ins><span class="cx"> 2021-07-06  Commit Queue  <commit-queue@webkit.org>
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, reverting r279546, r279554, r279558 and r279567.
</span></span></pre></div>
<a id="trunkLayoutTestscompositingsharedbackingbackingsharingcompositingchangeexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/shared-backing/backing-sharing-compositing-change-expected.html (0 => 279636)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/shared-backing/backing-sharing-compositing-change-expected.html                            (rev 0)
+++ trunk/LayoutTests/compositing/shared-backing/backing-sharing-compositing-change-expected.html       2021-07-07 03:36:45 UTC (rev 279636)
</span><span class="lines">@@ -0,0 +1,80 @@
</span><ins>+<!DOCTYPE html> <!-- webkit-test-runner [ AsyncOverflowScrollingEnabled=true ] -->
+<html>
+<head>
+    <style>
+        #scroller {
+            position: absolute;
+            top: 20px;
+            left: 20px;
+            width: 500px;
+            height: 400px;
+            border: 2px solid gray;
+            overflow-y: scroll;
+            background-color: rgba(255, 255, 255, 0.5);
+            box-sizing: border-box;
+        }
+
+        .box {
+            position: absolute;
+            top: 210px;
+            left: 10px;
+            width: 300px;
+            height: 100px;
+            background-color: green;
+        }
+
+        .contents {
+            position: absolute;
+            left: 35px;
+            top: 28px;
+            width: 90%;
+            height: 300%;
+        }
+
+        .outside-box {
+            position: absolute;
+            overflow: hidden;
+            top: 20px;
+            left: 530px;
+            width: 20px;
+            height: 400px;
+            background-color: silver;
+        }
+
+        #header {
+            position: relative;
+            background-color: blue;
+            width: 100%;
+            height: 20px;
+        }
+    </style>
+    <script>
+        if (window.testRunner)
+            testRunner.waitUntilDone();
+
+        window.addEventListener('load', () => {
+            const scroller = document.getElementById('scroller');
+            scroller.addEventListener('scroll', () => {
+                const scrollPos = scroller.scrollTop;
+                const header = document.getElementById('header');
+                header.style.top = `-${scrollPos}px`;
+            }, false);
+            
+            requestAnimationFrame(() => {
+                scroller.scrollTop = 100;
+                if (window.testRunner)
+                    testRunner.notifyDone();
+            })
+        }, false);
+    </script>
+</head>
+<body>
+    <div id="scroller">
+        <div class="contents">
+            <div class="box"></div>
+        </div>
+    </div>
+    <div class="outside-box">
+        <div id="header">relative</div>
+    </div>
+</body>
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestscompositingsharedbackingbackingsharingcompositingchangehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/shared-backing/backing-sharing-compositing-change.html (0 => 279636)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/shared-backing/backing-sharing-compositing-change.html                             (rev 0)
+++ trunk/LayoutTests/compositing/shared-backing/backing-sharing-compositing-change.html        2021-07-07 03:36:45 UTC (rev 279636)
</span><span class="lines">@@ -0,0 +1,89 @@
</span><ins>+<!DOCTYPE html> <!-- webkit-test-runner [ AsyncOverflowScrollingEnabled=true ] -->
+<html>
+<head>
+    <style>
+        #scroller {
+            position: absolute;
+            top: 20px;
+            left: 20px;
+            width: 500px;
+            height: 400px;
+            border: 2px solid gray;
+            overflow-y: scroll;
+            background-color: rgba(255, 255, 255, 0.5);
+            box-sizing: border-box;
+        }
+
+        .fixed {
+            position: fixed;
+            left: 0px;
+            top: -200px; /* outside the viewport */
+            width: 200px;
+            height: 100px;
+        }
+
+        .box {
+            position: absolute;
+            top: 210px;
+            left: 10px;
+            width: 300px;
+            height: 100px;
+            background-color: green;
+        }
+
+        .contents {
+            position: absolute;
+            left: 35px;
+            top: 28px;
+            width: 90%;
+            height: 300%;
+        }
+
+        .outside-box {
+            position: absolute;
+            overflow: hidden;
+            top: 20px;
+            left: 530px;
+            width: 20px;
+            height: 400px;
+            background-color: silver;
+        }
+
+        #header {
+            position: relative;
+            background-color: blue;
+            width: 100%;
+            height: 20px;
+        }
+    </style>
+    <script>
+        if (window.testRunner)
+            testRunner.waitUntilDone();
+
+        window.addEventListener('load', () => {
+            const scroller = document.getElementById('scroller');
+            scroller.addEventListener('scroll', () => {
+                const scrollPos = scroller.scrollTop;
+                const header = document.getElementById('header');
+                header.style.top = `-${scrollPos}px`;
+            }, false);
+            
+            requestAnimationFrame(() => {
+                scroller.scrollTop = 100;
+                if (window.testRunner)
+                    testRunner.notifyDone();
+            })
+        }, false);
+    </script>
+</head>
+<body>
+    <div id="scroller">
+        <div class="contents">
+            <div class="fixed"></div>
+            <div class="box"></div>
+        </div>
+    </div>
+    <div class="outside-box">
+        <div id="header">relative</div>
+    </div>
+</body>
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (279635 => 279636)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2021-07-07 03:12:05 UTC (rev 279635)
+++ trunk/Source/WebCore/ChangeLog      2021-07-07 03:36:45 UTC (rev 279636)
</span><span class="lines">@@ -1,3 +1,31 @@
</span><ins>+2021-07-06  Simon Fraser  <simon.fraser@apple.com>
+
+        REGRESSION (r262237) Safari 14.x shows graphics artifacts when scrolling, using drop-down menus or just moving the mouse
+        https://bugs.webkit.org/show_bug.cgi?id=220892
+        <rdar://73538454>
+
+        Reviewed by Alan Bujtas.
+
+        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):
+
</ins><span class="cx"> 2021-07-06  Commit Queue  <commit-queue@webkit.org>
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, reverting r279546, r279554, r279558 and r279567.
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerCompositorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (279635 => 279636)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2021-07-07 03:12:05 UTC (rev 279635)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp    2021-07-07 03:36:45 UTC (rev 279636)
</span><span class="lines">@@ -252,8 +252,8 @@
</span><span class="cx">         m_backingSharingLayers.append(makeWeakPtr(layer));
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    void updateBeforeDescendantTraversal(RenderLayer&, bool willBeComposited);
-    void updateAfterDescendantTraversal(RenderLayer&, RenderLayer* stackingContextAncestor);
</del><ins>+    RenderLayer* updateBeforeDescendantTraversal(RenderLayer&, bool willBeComposited);
+    void updateAfterDescendantTraversal(RenderLayer&, RenderLayer* preDescendantProviderCandidate, RenderLayer* stackingContextAncestor);
</ins><span class="cx">     
</span><span class="cx">     bool isPotentialBackingSharingLayer(const RenderLayer& layer) const
</span><span class="cx">     {
</span><span class="lines">@@ -291,28 +291,36 @@
</span><span class="cx"> 
</span><span class="cx"> void RenderLayerCompositor::BackingSharingState::endBackingSharingSequence()
</span><span class="cx"> {
</span><del>-    if (m_backingProviderCandidate) {
-        m_backingProviderCandidate->backing()->setBackingSharingLayers(WTFMove(m_backingSharingLayers));
-        m_backingSharingLayers.clear();
-        issuePendingRepaints();
-    }
-    
</del><ins>+    if (!m_backingProviderCandidate)
+        return;
+
+    m_backingProviderCandidate->backing()->setBackingSharingLayers(WTFMove(m_backingSharingLayers));
+    m_backingSharingLayers.clear();
+    issuePendingRepaints();
+
</ins><span class="cx">     m_backingProviderCandidate = nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RenderLayerCompositor::BackingSharingState::updateBeforeDescendantTraversal(RenderLayer& layer, bool willBeComposited)
</del><ins>+RenderLayer* RenderLayerCompositor::BackingSharingState::updateBeforeDescendantTraversal(RenderLayer& layer, bool willBeComposited)
</ins><span class="cx"> {
</span><span class="cx">     layer.setBackingProviderLayer(nullptr);
</span><span class="cx"> 
</span><ins>+    LOG_WITH_STREAM(Compositing, stream << "BackingSharingState::updateBeforeDescendantTraversal: layer " << &layer << " will be composited " << willBeComposited);
+
</ins><span class="cx">     // A layer that composites resets backing-sharing, since subsequent layers need to composite to overlap it.
</span><span class="cx">     if (willBeComposited) {
</span><ins>+        LOG_WITH_STREAM(Compositing, stream << " ending sharing sequence on " << m_backingProviderCandidate);
</ins><span class="cx">         m_backingSharingLayers.removeAll(&layer);
</span><span class="cx">         endBackingSharingSequence();
</span><span class="cx">     }
</span><ins>+    
+    return m_backingProviderCandidate;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RenderLayerCompositor::BackingSharingState::updateAfterDescendantTraversal(RenderLayer& layer, RenderLayer* stackingContextAncestor)
</del><ins>+void RenderLayerCompositor::BackingSharingState::updateAfterDescendantTraversal(RenderLayer& layer, RenderLayer* preDescendantProviderCandidate, RenderLayer* stackingContextAncestor)
</ins><span class="cx"> {
</span><ins>+    LOG_WITH_STREAM(Compositing, stream << "BackingSharingState::updateAfterDescendantTraversal for layer " << &layer << " is composited " << layer.isComposited());
+
</ins><span class="cx">     if (layer.isComposited()) {
</span><span class="cx">         // If this layer is being composited, clean up sharing-related state.
</span><span class="cx">         layer.disconnectFromBackingProviderLayer();
</span><span class="lines">@@ -319,17 +327,34 @@
</span><span class="cx">         m_backingSharingLayers.removeAll(&layer);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (m_backingProviderCandidate && &layer == m_backingProviderStackingContext) {
-        LOG_WITH_STREAM(Compositing, stream << "End of stacking context for backing provider " << m_backingProviderCandidate << ", ending sharing sequence with " << m_backingSharingLayers.size() << " sharing layers");
</del><ins>+    // Backing sharing is constrained to layers in the same stacking context.
+    if (&layer == m_backingProviderStackingContext) {
+        ASSERT(&layer != m_backingProviderCandidate);
+        LOG_WITH_STREAM(Compositing, stream << "BackingSharingState::updateAfterDescendantTraversal: End of stacking context for backing provider " << m_backingProviderCandidate << ", ending sharing sequence with " << m_backingSharingLayers.size() << " sharing layers");
</ins><span class="cx">         endBackingSharingSequence();
</span><del>-    } else if (!m_backingProviderCandidate && layer.isComposited()) {
-        LOG_WITH_STREAM(Compositing, stream << "Post-descendant compositing of " << &layer << ", ending sharing sequence for " << m_backingProviderCandidate << " with " << m_backingSharingLayers.size() << " sharing layers");
-        endBackingSharingSequence();
</del><ins>+
+        if (layer.isComposited())
+            layer.backing()->clearBackingSharingLayers();
+
+        return;
+    }
+
+    if (!layer.isComposited())
+        return;
+
+    if (!m_backingProviderCandidate) {
+        LOG_WITH_STREAM(Compositing, stream << "BackingSharingState::updateAfterDescendantTraversal: starting potential sharing sequence for " << &layer);
</ins><span class="cx">         startBackingSharingSequence(layer, stackingContextAncestor);
</span><ins>+    } else {
+        ASSERT(&layer != m_backingProviderCandidate);
+        layer.backing()->clearBackingSharingLayers();
+        LOG_WITH_STREAM(Compositing, stream << "BackingSharingState::updateAfterDescendantTraversal: " << &layer << " is composited; maybe ending existing backing sequence with candidate " << m_backingProviderCandidate << " context " << m_backingProviderStackingContext << " with " << m_backingSharingLayers.size() << " sharing layers");
+        
+        if (m_backingProviderCandidate && preDescendantProviderCandidate == m_backingProviderCandidate) {
+            m_backingSharingLayers.removeAll(&layer);
+            endBackingSharingSequence();
+        }
</ins><span class="cx">     }
</span><del>-    
-    if (&layer != m_backingProviderCandidate && layer.isComposited())
-        layer.backing()->clearBackingSharingLayers();
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void RenderLayerCompositor::BackingSharingState::issuePendingRepaints()
</span><span class="lines">@@ -1064,7 +1089,7 @@
</span><span class="cx">         LOG_WITH_STREAM(CompositingOverlap, stream << "layer " << &layer << " will share, pushed container " << overlapMap);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    backingSharingState.updateBeforeDescendantTraversal(layer, willBeComposited);
</del><ins>+    auto preDescendantProviderCandidate = backingSharingState.updateBeforeDescendantTraversal(layer, willBeComposited);
</ins><span class="cx"> 
</span><span class="cx"> #if ASSERT_ENABLED
</span><span class="cx">     LayerListMutationDetector mutationChecker(layer);
</span><span class="lines">@@ -1163,7 +1188,7 @@
</span><span class="cx">     // Compute state passed to the caller.
</span><span class="cx">     descendantHas3DTransform |= anyDescendantHas3DTransform || layer.has3DTransform();
</span><span class="cx">     compositingState.updateWithDescendantStateAndLayer(currentState, layer, ancestorLayer, layerExtent);
</span><del>-    backingSharingState.updateAfterDescendantTraversal(layer, compositingState.stackingContextAncestor);
</del><ins>+    backingSharingState.updateAfterDescendantTraversal(layer, preDescendantProviderCandidate, compositingState.stackingContextAncestor);
</ins><span class="cx"> 
</span><span class="cx">     bool layerContributesToOverlap = (currentState.compositingAncestor && !currentState.compositingAncestor->isRenderViewLayer()) || currentState.backingSharingAncestor;
</span><span class="cx">     updateOverlapMap(overlapMap, layer, layerExtent, didPushOverlapContainer, layerContributesToOverlap, becameCompositedAfterDescendantTraversal && !descendantsAddedToOverlap);
</span><span class="lines">@@ -1234,7 +1259,7 @@
</span><span class="cx">         LOG_WITH_STREAM(CompositingOverlap, stream << "unchangedSubtree: layer " << &layer << " will share, pushed container " << overlapMap);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    backingSharingState.updateBeforeDescendantTraversal(layer, layerIsComposited);
</del><ins>+    auto preDescendantProviderCandidate = backingSharingState.updateBeforeDescendantTraversal(layer, layerIsComposited);
</ins><span class="cx"> 
</span><span class="cx"> #if ASSERT_ENABLED
</span><span class="cx">     LayerListMutationDetector mutationChecker(layer);
</span><span class="lines">@@ -1262,7 +1287,7 @@
</span><span class="cx"> 
</span><span class="cx">     ASSERT(!currentState.fullPaintOrderTraversalRequired);
</span><span class="cx">     compositingState.updateWithDescendantStateAndLayer(currentState, layer, ancestorLayer, layerExtent, true);
</span><del>-    backingSharingState.updateAfterDescendantTraversal(layer, compositingState.stackingContextAncestor);
</del><ins>+    backingSharingState.updateAfterDescendantTraversal(layer, preDescendantProviderCandidate, compositingState.stackingContextAncestor);
</ins><span class="cx"> 
</span><span class="cx">     bool layerContributesToOverlap = (currentState.compositingAncestor && !currentState.compositingAncestor->isRenderViewLayer()) || currentState.backingSharingAncestor;
</span><span class="cx">     updateOverlapMap(overlapMap, layer, layerExtent, didPushOverlapContainer, layerContributesToOverlap);
</span></span></pre>
</div>
</div>

</body>
</html>