<!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>[245502] 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/245502">245502</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2019-05-19 07:01:15 -0700 (Sun, 19 May 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>Layers painting into shared backing need to contribute to overlap
https://bugs.webkit.org/show_bug.cgi?id=198021

Reviewed by Zalan Bujtas.
Source/WebCore:

Layers that paint into a composited (non-root) layer get added to the overlap map so
that later layers correct overlap them; this is done via the test against currentState.compositingAncestor.

We need the same logic for layers that paint into shared backing; they need to behave
the same way in terms of how they contribute to overlap. We already had currentState.backingSharingAncestor
which was unused, but now use it for this, and correctly null it out when a layer composites.

Bug was noticed during testing, and not known to affect any websites (though it probably does).

Also move the overlap container popping into updateOverlapMap() so the two callers can
share the code, and more explicitly track whether a container was pushed.

Test: compositing/shared-backing/sharing-child-contributes-to-overlap.html

* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::computeCompositingRequirements):
(WebCore::RenderLayerCompositor::traverseUnchangedSubtree):
(WebCore::RenderLayerCompositor::updateOverlapMap const):
* rendering/RenderLayerCompositor.h:

LayoutTests:

* compositing/shared-backing/sharing-child-contributes-to-overlap-expected.html: Added.
* compositing/shared-backing/sharing-child-contributes-to-overlap.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>
<li><a href="#trunkSourceWebCorerenderingRenderLayerCompositorh">trunk/Source/WebCore/rendering/RenderLayerCompositor.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestscompositingsharedbackingsharingchildcontributestooverlapexpectedhtml">trunk/LayoutTests/compositing/shared-backing/sharing-child-contributes-to-overlap-expected.html</a></li>
<li><a href="#trunkLayoutTestscompositingsharedbackingsharingchildcontributestooverlaphtml">trunk/LayoutTests/compositing/shared-backing/sharing-child-contributes-to-overlap.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (245501 => 245502)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2019-05-19 07:46:45 UTC (rev 245501)
+++ trunk/LayoutTests/ChangeLog 2019-05-19 14:01:15 UTC (rev 245502)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2019-05-19  Simon Fraser  <simon.fraser@apple.com>
+
+        Layers painting into shared backing need to contribute to overlap
+        https://bugs.webkit.org/show_bug.cgi?id=198021
+
+        Reviewed by Zalan Bujtas.
+
+        * compositing/shared-backing/sharing-child-contributes-to-overlap-expected.html: Added.
+        * compositing/shared-backing/sharing-child-contributes-to-overlap.html: Added.
+
</ins><span class="cx"> 2019-05-18  Jiewen Tan  <jiewen_tan@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [WebAuthN] Allow authenticators that support both CTAP and U2F to try U2F if CTAP fails in authenticatorGetAssertion
</span></span></pre></div>
<a id="trunkLayoutTestscompositingsharedbackingsharingchildcontributestooverlapexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/shared-backing/sharing-child-contributes-to-overlap-expected.html (0 => 245502)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/shared-backing/sharing-child-contributes-to-overlap-expected.html                          (rev 0)
+++ trunk/LayoutTests/compositing/shared-backing/sharing-child-contributes-to-overlap-expected.html     2019-05-19 14:01:15 UTC (rev 245502)
</span><span class="lines">@@ -0,0 +1,64 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+    <style>
+        .provider {
+            position: absolute;
+            top: 20px;
+            left: 20px;
+            height: 50px;
+            width: 50px;
+            margin: 10px;
+            border: 1px solid black;
+            background-color: silver;
+        }
+        
+        .sharing {
+                       position: relative;
+            z-index: 0;
+                       top: 45px;
+                       left: 45px;
+            width: 100px;
+            height: 100px;
+            background-color: blue;
+        }
+        
+        .inner {
+            position: absolute;
+            left: 80px;
+            top: 80px;
+            width: 200px;
+            height: 200px;
+            background-color: orange;
+        }
+
+        .trigger {
+            transform: translateZ(0);
+            width: 50px;
+            height: 50px;
+            background-color: silver;
+        }
+        
+        .overlapper {
+            position: absolute;
+            top: 200px;
+            left: 200px;
+            width: 200px;
+            height: 200px;
+            background-color: green;
+            transform: translateZ(0);
+        }
+    </style>
+</head>
+<body>
+    <div class="trigger"></div>
+    <div class="provider">
+        <div class="sharing">
+            <div class="inner">
+            </div>
+        </div>
+    </div>
+    <div class="overlapper"></div>
+<pre id="layers"></pre>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscompositingsharedbackingsharingchildcontributestooverlaphtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/shared-backing/sharing-child-contributes-to-overlap.html (0 => 245502)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/shared-backing/sharing-child-contributes-to-overlap.html                           (rev 0)
+++ trunk/LayoutTests/compositing/shared-backing/sharing-child-contributes-to-overlap.html      2019-05-19 14:01:15 UTC (rev 245502)
</span><span class="lines">@@ -0,0 +1,64 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+    <title>Tests that the overlap bounds for a sharing layer includes descendants.</title>
+    <style>
+        .provider {
+            position: absolute;
+            top: 20px;
+            left: 20px;
+            height: 50px;
+            width: 50px;
+            margin: 10px;
+            border: 1px solid black;
+            background-color: silver;
+        }
+        
+        .sharing {
+                       position: relative;
+            z-index: 0;
+                       top: 45px;
+                       left: 45px;
+            width: 100px;
+            height: 100px;
+            background-color: blue;
+        }
+        
+        .inner {
+            position: absolute;
+            left: 80px;
+            top: 80px;
+            width: 200px;
+            height: 200px;
+            background-color: orange;
+        }
+
+        .trigger {
+            transform: translateZ(0);
+            width: 50px;
+            height: 50px;
+            background-color: silver;
+        }
+        
+        .overlapper {
+            position: absolute;
+            top: 200px;
+            left: 200px;
+            width: 200px;
+            height: 200px;
+            background-color: green;
+        }
+    </style>
+</head>
+<body>
+    <div class="trigger"></div>
+    <div class="provider">
+        <div class="sharing">
+            <div class="inner">
+            </div>
+        </div>
+    </div>
+    <div class="overlapper"></div>
+<pre id="layers"></pre>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (245501 => 245502)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2019-05-19 07:46:45 UTC (rev 245501)
+++ trunk/Source/WebCore/ChangeLog      2019-05-19 14:01:15 UTC (rev 245502)
</span><span class="lines">@@ -1,3 +1,30 @@
</span><ins>+2019-05-19  Simon Fraser  <simon.fraser@apple.com>
+
+        Layers painting into shared backing need to contribute to overlap
+        https://bugs.webkit.org/show_bug.cgi?id=198021
+
+        Reviewed by Zalan Bujtas.
+        
+        Layers that paint into a composited (non-root) layer get added to the overlap map so
+        that later layers correct overlap them; this is done via the test against currentState.compositingAncestor.
+
+        We need the same logic for layers that paint into shared backing; they need to behave
+        the same way in terms of how they contribute to overlap. We already had currentState.backingSharingAncestor
+        which was unused, but now use it for this, and correctly null it out when a layer composites.
+
+        Bug was noticed during testing, and not known to affect any websites (though it probably does).
+        
+        Also move the overlap container popping into updateOverlapMap() so the two callers can
+        share the code, and more explicitly track whether a container was pushed.
+
+        Test: compositing/shared-backing/sharing-child-contributes-to-overlap.html
+
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::computeCompositingRequirements):
+        (WebCore::RenderLayerCompositor::traverseUnchangedSubtree):
+        (WebCore::RenderLayerCompositor::updateOverlapMap const):
+        * rendering/RenderLayerCompositor.h:
+
</ins><span class="cx"> 2019-05-17  Joonghun Park  <pjh0718@gmail.com>
</span><span class="cx"> 
</span><span class="cx">         Implement CSS `display: flow-root` (modern clearfix)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerCompositorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (245501 => 245502)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2019-05-19 07:46:45 UTC (rev 245501)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp    2019-05-19 14:01:15 UTC (rev 245502)
</span><span class="lines">@@ -879,6 +879,7 @@
</span><span class="cx"> 
</span><span class="cx">     IndirectCompositingReason compositingReason = compositingState.subtreeIsCompositing ? IndirectCompositingReason::Stacking : IndirectCompositingReason::None;
</span><span class="cx">     bool layerPaintsIntoProvidedBacking = false;
</span><ins>+    bool didPushOverlapContainer = false;
</ins><span class="cx"> 
</span><span class="cx">     // If we know for sure the layer is going to be composited, don't bother looking it up in the overlap map
</span><span class="cx">     if (!willBeComposited && !overlapMap.isEmpty() && compositingState.testingOverlap) {
</span><span class="lines">@@ -927,15 +928,18 @@
</span><span class="cx">         currentState.testingOverlap = true;
</span><span class="cx">         // This layer now acts as the ancestor for kids.
</span><span class="cx">         currentState.compositingAncestor = &layer;
</span><del>-        
</del><ins>+        // Compositing turns off backing sharing.
+        currentState.backingSharingAncestor = nullptr;
+
</ins><span class="cx">         if (layerPaintsIntoProvidedBacking) {
</span><span class="cx">             layerPaintsIntoProvidedBacking = false;
</span><span class="cx">             // layerPaintsIntoProvidedBacking was only true for layers that would otherwise composite because of overlap. If we can
</span><span class="cx">             // no longer share, put this this indirect reason back on the layer so that requiresOwnBackingStore() sees it.
</span><span class="cx">             layer.setIndirectCompositingReason(IndirectCompositingReason::Overlap);
</span><del>-            LOG_WITH_STREAM(CompositingOverlap, stream << "layer " << &layer << " was sharing now will composite");
</del><ins>+            LOG_WITH_STREAM(Compositing, stream << "layer " << &layer << " was sharing now will composite");
</ins><span class="cx">         } else {
</span><span class="cx">             overlapMap.pushCompositingContainer();
</span><ins>+            didPushOverlapContainer = true;
</ins><span class="cx">             LOG_WITH_STREAM(CompositingOverlap, stream << "layer " << &layer << " will composite, pushed container " << overlapMap);
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -958,6 +962,7 @@
</span><span class="cx">     } else if (layerPaintsIntoProvidedBacking) {
</span><span class="cx">         currentState.backingSharingAncestor = &layer;
</span><span class="cx">         overlapMap.pushCompositingContainer();
</span><ins>+        didPushOverlapContainer = true;
</ins><span class="cx">         LOG_WITH_STREAM(CompositingOverlap, stream << "layer " << &layer << " will share, pushed container " << overlapMap);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -1064,17 +1069,11 @@
</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, layerExtent);
</span><ins>+    backingSharingState.updateAfterDescendantTraversal(layer, compositingState.stackingContextAncestor);
</ins><span class="cx"> 
</span><del>-    bool layerContributesToOverlap = currentState.compositingAncestor && !currentState.compositingAncestor->isRenderViewLayer();
-    updateOverlapMap(overlapMap, layer, layerExtent, layerContributesToOverlap, becameCompositedAfterDescendantTraversal && !descendantsAddedToOverlap);
</del><ins>+    bool layerContributesToOverlap = (currentState.compositingAncestor && !currentState.compositingAncestor->isRenderViewLayer()) || currentState.backingSharingAncestor;
+    updateOverlapMap(overlapMap, layer, layerExtent, didPushOverlapContainer, layerContributesToOverlap, becameCompositedAfterDescendantTraversal && !descendantsAddedToOverlap);
</ins><span class="cx"> 
</span><del>-    // Pop backing/overlap sharing state.
-    if ((willBeComposited && !layer.isRenderViewLayer()) || currentState.backingSharingAncestor == &layer) {
-        overlapMap.popCompositingContainer();
-        LOG_WITH_STREAM(CompositingOverlap, stream << "layer " << &layer << " is composited, popped container " << overlapMap);
-    }
-
-    backingSharingState.updateAfterDescendantTraversal(layer, compositingState.stackingContextAncestor);
</del><span class="cx">     overlapMap.geometryMap().popMappingsToAncestor(ancestorLayer);
</span><span class="cx"> 
</span><span class="cx">     LOG_WITH_STREAM(Compositing, stream << TextStream::Repeat(compositingState.depth * 2, ' ') << &layer << " computeCompositingRequirements - willBeComposited " << willBeComposited << " (backing provider candidate " << backingSharingState.backingProviderCandidate() << ")");
</span><span class="lines">@@ -1093,6 +1092,8 @@
</span><span class="cx">     layer.updateLayerListsIfNeeded();
</span><span class="cx"> 
</span><span class="cx">     bool layerIsComposited = layer.isComposited();
</span><ins>+    bool layerPaintsIntoProvidedBacking = false;
+    bool didPushOverlapContainer = false;
</ins><span class="cx"> 
</span><span class="cx">     OverlapExtent layerExtent;
</span><span class="cx">     if (layerIsComposited && !layer.isRenderViewLayer())
</span><span class="lines">@@ -1109,6 +1110,7 @@
</span><span class="cx">         ASSERT(backingSharingState.backingProviderCandidate());
</span><span class="cx">         ASSERT(backingProviderLayerCanIncludeLayer(*backingSharingState.backingProviderCandidate(), layer));
</span><span class="cx">         backingSharingState.appendSharingLayer(layer);
</span><ins>+        layerPaintsIntoProvidedBacking = true;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     CompositingState currentState = compositingState.stateForPaintOrderChildren(layer);
</span><span class="lines">@@ -1119,7 +1121,9 @@
</span><span class="cx">         currentState.testingOverlap = true;
</span><span class="cx">         // This layer now acts as the ancestor for kids.
</span><span class="cx">         currentState.compositingAncestor = &layer;
</span><ins>+        currentState.backingSharingAncestor = nullptr;
</ins><span class="cx">         overlapMap.pushCompositingContainer();
</span><ins>+        didPushOverlapContainer = true;
</ins><span class="cx">         LOG_WITH_STREAM(CompositingOverlap, stream << "unchangedSubtree: layer " << &layer << " will composite, pushed container " << overlapMap);
</span><span class="cx"> 
</span><span class="cx">         computeExtent(overlapMap, layer, layerExtent);
</span><span class="lines">@@ -1126,6 +1130,11 @@
</span><span class="cx">         currentState.ancestorHasTransformAnimation |= layerExtent.hasTransformAnimation;
</span><span class="cx">         // Too hard to compute animated bounds if both us and some ancestor is animating transform.
</span><span class="cx">         layerExtent.animationCausesExtentUncertainty |= layerExtent.hasTransformAnimation && compositingState.ancestorHasTransformAnimation;
</span><ins>+    } else if (layerPaintsIntoProvidedBacking) {
+        overlapMap.pushCompositingContainer();
+        currentState.backingSharingAncestor = &layer;
+        didPushOverlapContainer = true;
+        LOG_WITH_STREAM(CompositingOverlap, stream << "unchangedSubtree: layer " << &layer << " will share, pushed container " << overlapMap);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     backingSharingState.updateBeforeDescendantTraversal(layer, layerIsComposited);
</span><span class="lines">@@ -1156,16 +1165,11 @@
</span><span class="cx"> 
</span><span class="cx">     ASSERT(!currentState.fullPaintOrderTraversalRequired);
</span><span class="cx">     compositingState.updateWithDescendantStateAndLayer(currentState, layer, layerExtent, true);
</span><ins>+    backingSharingState.updateAfterDescendantTraversal(layer, compositingState.stackingContextAncestor);
</ins><span class="cx"> 
</span><del>-    bool layerContributesToOverlap = currentState.compositingAncestor && !currentState.compositingAncestor->isRenderViewLayer();
-    updateOverlapMap(overlapMap, layer, layerExtent, layerContributesToOverlap);
</del><ins>+    bool layerContributesToOverlap = (currentState.compositingAncestor && !currentState.compositingAncestor->isRenderViewLayer()) || currentState.backingSharingAncestor;
+    updateOverlapMap(overlapMap, layer, layerExtent, didPushOverlapContainer, layerContributesToOverlap);
</ins><span class="cx"> 
</span><del>-    if ((layerIsComposited && !layer.isRenderViewLayer()) || currentState.backingSharingAncestor == &layer) {
-        overlapMap.popCompositingContainer();
-        LOG_WITH_STREAM(CompositingOverlap, stream << "unchangedSubtree: layer " << &layer << " is composited, popped container " << overlapMap);
-    }
-
-    backingSharingState.updateAfterDescendantTraversal(layer, compositingState.stackingContextAncestor);
</del><span class="cx">     overlapMap.geometryMap().popMappingsToAncestor(ancestorLayer);
</span><span class="cx"> 
</span><span class="cx">     ASSERT(!layer.needsCompositingRequirementsTraversal());
</span><span class="lines">@@ -1840,16 +1844,9 @@
</span><span class="cx">         overlapMap.geometryMap().popMappingsToAncestor(ancestorLayer);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RenderLayerCompositor::updateOverlapMap(LayerOverlapMap& overlapMap, const RenderLayer& layer, OverlapExtent& layerExtent, bool layerContributesToOverlap, bool addDescendantsToOverlap) const
</del><ins>+void RenderLayerCompositor::updateOverlapMap(LayerOverlapMap& overlapMap, const RenderLayer& layer, OverlapExtent& layerExtent, bool didPushContainer, bool addLayerToOverlap, bool addDescendantsToOverlap) const
</ins><span class="cx"> {
</span><del>-    ASSERT_IMPLIES(addDescendantsToOverlap, layerContributesToOverlap);
-
-    // All layers (even ones that aren't being composited) need to get added to
-    // the overlap map. Layers that do not composite will draw into their
-    // compositing ancestor's backing, and so are still considered for overlap.
-    // FIXME: When layerExtent has taken animation bounds into account, we also know that the bounds
-    // include descendants, so we don't need to add them all to the overlap map.
-    if (layerContributesToOverlap) {
</del><ins>+    if (addLayerToOverlap) {
</ins><span class="cx">         addToOverlapMap(overlapMap, layer, layerExtent);
</span><span class="cx">         LOG_WITH_STREAM(CompositingOverlap, stream << "layer " << &layer << " contributes to overlap, added to map " << overlapMap);
</span><span class="cx">     }
</span><span class="lines">@@ -1859,6 +1856,11 @@
</span><span class="cx">         addDescendantsToOverlapMapRecursive(overlapMap, layer);
</span><span class="cx">         LOG_WITH_STREAM(CompositingOverlap, stream << "layer " << &layer << " composited post descendant traversal, added recursive " << overlapMap);
</span><span class="cx">     }
</span><ins>+
+    if (didPushContainer) {
+        overlapMap.popCompositingContainer();
+        LOG_WITH_STREAM(CompositingOverlap, stream << "layer " << &layer << " is composited or shared, popped container " << overlapMap);
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(VIDEO)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerCompositorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (245501 => 245502)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h   2019-05-19 07:46:45 UTC (rev 245501)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h      2019-05-19 14:01:15 UTC (rev 245502)
</span><span class="lines">@@ -408,7 +408,7 @@
</span><span class="cx">     void computeExtent(const LayerOverlapMap&, const RenderLayer&, OverlapExtent&) const;
</span><span class="cx">     void addToOverlapMap(LayerOverlapMap&, const RenderLayer&, OverlapExtent&) const;
</span><span class="cx">     void addDescendantsToOverlapMapRecursive(LayerOverlapMap&, const RenderLayer&, const RenderLayer* ancestorLayer = nullptr) const;
</span><del>-    void updateOverlapMap(LayerOverlapMap&, const RenderLayer&, OverlapExtent&, bool layerContributesToOverlap, bool addDescendantsToOverlap = false) const;
</del><ins>+    void updateOverlapMap(LayerOverlapMap&, const RenderLayer&, OverlapExtent&, bool didPushContainer, bool addLayerToOverlap, bool addDescendantsToOverlap = false) const;
</ins><span class="cx"> 
</span><span class="cx">     void updateCompositingLayersTimerFired();
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>