<!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>[245977] 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/245977">245977</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2019-05-31 12:07:30 -0700 (Fri, 31 May 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>Move code that sets compositing paint phases into a single function
https://bugs.webkit.org/show_bug.cgi?id=198420

Reviewed by Zalan Bujtas.

Source/WebCore:

To compute the correct paint phases for the various GraphicsLayers in a RenderLayerBacking,
we have to know which set of layers we've created (m_scrollContainerLayer, m_foregroundLayer etc).
So move the code that sets phases into a single function which is called when that
set of layers changes.

The test dumps paint phases for a stacking-context-composited scroller with a negative z-index child.

Also have GraphicsLayer::setPaintingPhase() trigger the necessary repaint when the paint phase changes.

Test: compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases.html

* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::setPaintingPhase):
* platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::setPaintingPhase): Deleted.
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateConfiguration):
(WebCore::RenderLayerBacking::updateForegroundLayer):
(WebCore::RenderLayerBacking::updateBackgroundLayer):
(WebCore::RenderLayerBacking::updateMaskingLayer):
(WebCore::RenderLayerBacking::updateScrollingLayers):
(WebCore::RenderLayerBacking::updatePaintingPhases):
(WebCore::RenderLayerBacking::paintingPhaseForPrimaryLayer const): Deleted.
* rendering/RenderLayerBacking.h:

LayoutTests:

* compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt: Added.
* compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases.html: Added.
* platform/ios-wk2/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt: Added.
* platform/mac-wk1/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt: 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="#trunkSourceWebCoreplatformgraphicsGraphicsLayercpp">trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsGraphicsLayerh">trunk/Source/WebCore/platform/graphics/GraphicsLayer.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerBackingcpp">trunk/Source/WebCore/rendering/RenderLayerBacking.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerBackingh">trunk/Source/WebCore/rendering/RenderLayerBacking.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestscompositingoverflowstackingcontextcompositedscrollerwithforegroundpaintphasesexpectedtxt">trunk/LayoutTests/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt</a></li>
<li><a href="#trunkLayoutTestscompositingoverflowstackingcontextcompositedscrollerwithforegroundpaintphaseshtml">trunk/LayoutTests/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases.html</a></li>
<li><a href="#trunkLayoutTestsplatformioswk2compositingoverflowstackingcontextcompositedscrollerwithforegroundpaintphasesexpectedtxt">trunk/LayoutTests/platform/ios-wk2/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk1compositingoverflowstackingcontextcompositedscrollerwithforegroundpaintphasesexpectedtxt">trunk/LayoutTests/platform/mac-wk1/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (245976 => 245977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2019-05-31 19:05:51 UTC (rev 245976)
+++ trunk/LayoutTests/ChangeLog 2019-05-31 19:07:30 UTC (rev 245977)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2019-05-31  Simon Fraser  <simon.fraser@apple.com>
+
+        Move code that sets compositing paint phases into a single function
+        https://bugs.webkit.org/show_bug.cgi?id=198420
+
+        Reviewed by Zalan Bujtas.
+
+        * compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt: Added.
+        * compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases.html: Added.
+        * platform/ios-wk2/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt: Added.
+        * platform/mac-wk1/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt: Added.
+
</ins><span class="cx"> 2019-05-31  Saam Barati  <sbarati@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [WHLSL] Make sure we properly emit code for "&*x"
</span></span></pre></div>
<a id="trunkLayoutTestscompositingoverflowstackingcontextcompositedscrollerwithforegroundpaintphasesexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt (0 => 245977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt                            (rev 0)
+++ trunk/LayoutTests/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt       2019-05-31 19:07:30 UTC (rev 245977)
</span><span class="lines">@@ -0,0 +1,60 @@
</span><ins>+Scrolled contents
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 800.00 600.00)
+  (paintingPhases
+    GraphicsLayerPaintBackground
+    GraphicsLayerPaintForeground
+    )
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (contentsOpaque 1)
+      (paintingPhases
+        GraphicsLayerPaintBackground
+        GraphicsLayerPaintForeground
+        )
+      (children 1
+        (GraphicsLayer
+          (position 8.00 8.00)
+          (bounds 322.00 322.00)
+          (drawsContent 1)
+          (paintingPhases
+            GraphicsLayerPaintBackground
+            GraphicsLayerPaintCompositedScroll
+            )
+          (children 1
+            (GraphicsLayer
+              (offsetFromRenderer width=1 height=1)
+              (position 1.00 1.00)
+              (bounds 305.00 305.00)
+              (children 1
+                (GraphicsLayer
+                  (offsetFromRenderer width=1 height=1)
+                  (anchor 0.00 0.00)
+                  (bounds 305.00 1020.00)
+                  (drawsContent 1)
+                  (paintingPhases
+                    GraphicsLayerPaintOverflowContents
+                    GraphicsLayerPaintCompositedScroll
+                    )
+                  (children 1
+                    (GraphicsLayer
+                      (offsetFromRenderer width=1 height=1)
+                      (bounds 305.00 1020.00)
+                      (drawsContent 1)
+                      (paintingPhases
+                        GraphicsLayerPaintForeground
+                        )
+                    )
+                  )
+                )
+              )
+            )
+          )
+        )
+      )
+    )
+  )
+)
+
</ins></span></pre></div>
<a id="trunkLayoutTestscompositingoverflowstackingcontextcompositedscrollerwithforegroundpaintphaseshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases.html (0 => 245977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases.html                            (rev 0)
+++ trunk/LayoutTests/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases.html       2019-05-31 19:07:30 UTC (rev 245977)
</span><span class="lines">@@ -0,0 +1,44 @@
</span><ins>+<!DOCTYPE html> <!-- webkit-test-runner [ internal:AsyncOverflowScrollingEnabled=true ] --><html>
+<head>
+    <style>
+        .scroller {
+            position: relative;
+            z-index: 0;
+            width: 300px;
+            height: 300px;
+            border: 1px solid black;
+            overflow: scroll;
+            padding: 10px;
+        }
+
+        .contents {
+            height: 1000px;
+        }
+        
+        .negative {
+            position: absolute;
+            z-index: -1;
+            top: 50px;
+            left: 30px;
+            width: 100px;
+            height: 100px;
+            background-color: blue;
+        }
+    </style>
+    <script>
+        if (window.testRunner)
+            testRunner.dumpAsText();
+
+        window.addEventListener('load', () => {
+            document.getElementById('layers').textContent = internals.layerTreeAsText(document, window.internals.LAYER_TREE_INCLUDES_PAINTING_PHASES);
+        }, false);
+    </script>
+</head>
+<body>
+    <div class="scroller">
+        <div class="negative"></div>
+        <div class="contents">Scrolled contents</div>
+    </div>
+<pre id="layers"></pre>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformioswk2compositingoverflowstackingcontextcompositedscrollerwithforegroundpaintphasesexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/ios-wk2/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt (0 => 245977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-wk2/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt                           (rev 0)
+++ trunk/LayoutTests/platform/ios-wk2/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt      2019-05-31 19:07:30 UTC (rev 245977)
</span><span class="lines">@@ -0,0 +1,60 @@
</span><ins>+Scrolled contents
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 800.00 600.00)
+  (paintingPhases
+    GraphicsLayerPaintBackground
+    GraphicsLayerPaintForeground
+    )
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (contentsOpaque 1)
+      (paintingPhases
+        GraphicsLayerPaintBackground
+        GraphicsLayerPaintForeground
+        )
+      (children 1
+        (GraphicsLayer
+          (position 8.00 8.00)
+          (bounds 322.00 322.00)
+          (drawsContent 1)
+          (paintingPhases
+            GraphicsLayerPaintBackground
+            GraphicsLayerPaintCompositedScroll
+            )
+          (children 1
+            (GraphicsLayer
+              (offsetFromRenderer width=1 height=1)
+              (position 1.00 1.00)
+              (bounds 320.00 320.00)
+              (children 1
+                (GraphicsLayer
+                  (offsetFromRenderer width=1 height=1)
+                  (anchor 0.00 0.00)
+                  (bounds 320.00 1020.00)
+                  (drawsContent 1)
+                  (paintingPhases
+                    GraphicsLayerPaintOverflowContents
+                    GraphicsLayerPaintCompositedScroll
+                    )
+                  (children 1
+                    (GraphicsLayer
+                      (offsetFromRenderer width=1 height=1)
+                      (bounds 320.00 1020.00)
+                      (drawsContent 1)
+                      (paintingPhases
+                        GraphicsLayerPaintForeground
+                        )
+                    )
+                  )
+                )
+              )
+            )
+          )
+        )
+      )
+    )
+  )
+)
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk1compositingoverflowstackingcontextcompositedscrollerwithforegroundpaintphasesexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac-wk1/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt (0 => 245977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk1/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt                           (rev 0)
+++ trunk/LayoutTests/platform/mac-wk1/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt      2019-05-31 19:07:30 UTC (rev 245977)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+Scrolled contents
+
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (245976 => 245977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2019-05-31 19:05:51 UTC (rev 245976)
+++ trunk/Source/WebCore/ChangeLog      2019-05-31 19:07:30 UTC (rev 245977)
</span><span class="lines">@@ -1,3 +1,35 @@
</span><ins>+2019-05-31  Simon Fraser  <simon.fraser@apple.com>
+
+        Move code that sets compositing paint phases into a single function
+        https://bugs.webkit.org/show_bug.cgi?id=198420
+
+        Reviewed by Zalan Bujtas.
+
+        To compute the correct paint phases for the various GraphicsLayers in a RenderLayerBacking,
+        we have to know which set of layers we've created (m_scrollContainerLayer, m_foregroundLayer etc).
+        So move the code that sets phases into a single function which is called when that
+        set of layers changes.
+
+        The test dumps paint phases for a stacking-context-composited scroller with a negative z-index child.
+
+        Also have GraphicsLayer::setPaintingPhase() trigger the necessary repaint when the paint phase changes.
+
+        Test: compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases.html
+
+        * platform/graphics/GraphicsLayer.cpp:
+        (WebCore::GraphicsLayer::setPaintingPhase):
+        * platform/graphics/GraphicsLayer.h:
+        (WebCore::GraphicsLayer::setPaintingPhase): Deleted.
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateConfiguration):
+        (WebCore::RenderLayerBacking::updateForegroundLayer):
+        (WebCore::RenderLayerBacking::updateBackgroundLayer):
+        (WebCore::RenderLayerBacking::updateMaskingLayer):
+        (WebCore::RenderLayerBacking::updateScrollingLayers):
+        (WebCore::RenderLayerBacking::updatePaintingPhases):
+        (WebCore::RenderLayerBacking::paintingPhaseForPrimaryLayer const): Deleted.
+        * rendering/RenderLayerBacking.h:
+
</ins><span class="cx"> 2019-05-31  Saam Barati  <sbarati@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [WHLSL] Make sure we properly emit code for "&*x"
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsGraphicsLayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp (245976 => 245977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp 2019-05-31 19:05:51 UTC (rev 245976)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp    2019-05-31 19:07:30 UTC (rev 245977)
</span><span class="lines">@@ -491,6 +491,15 @@
</span><span class="cx">     m_backgroundColor = color;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void GraphicsLayer::setPaintingPhase(OptionSet<GraphicsLayerPaintingPhase> phase)
+{
+    if (phase == m_paintingPhase)
+        return;
+
+    setNeedsDisplay();
+    m_paintingPhase = phase;
+}
+
</ins><span class="cx"> void GraphicsLayer::paintGraphicsLayerContents(GraphicsContext& context, const FloatRect& clip, GraphicsLayerPaintBehavior layerPaintBehavior)
</span><span class="cx"> {
</span><span class="cx">     FloatSize offset = offsetFromRenderer() - toFloatSize(scrollOffset());
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsGraphicsLayerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (245976 => 245977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h   2019-05-31 19:05:51 UTC (rev 245976)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h      2019-05-31 19:07:30 UTC (rev 245977)
</span><span class="lines">@@ -415,7 +415,7 @@
</span><span class="cx"> 
</span><span class="cx">     // Some GraphicsLayers paint only the foreground or the background content
</span><span class="cx">     OptionSet<GraphicsLayerPaintingPhase> paintingPhase() const { return m_paintingPhase; }
</span><del>-    void setPaintingPhase(OptionSet<GraphicsLayerPaintingPhase> phase) { m_paintingPhase = phase; }
</del><ins>+    void setPaintingPhase(OptionSet<GraphicsLayerPaintingPhase>);
</ins><span class="cx"> 
</span><span class="cx">     enum ShouldClipToLayer {
</span><span class="cx">         DoNotClipToLayer,
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerBackingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (245976 => 245977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp    2019-05-31 19:05:51 UTC (rev 245976)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp       2019-05-31 19:07:30 UTC (rev 245977)
</span><span class="lines">@@ -819,7 +819,8 @@
</span><span class="cx">             m_graphicsLayer->addChild(*flatteningLayer);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    updateMaskingLayer(renderer().hasMask(), renderer().hasClipPath());
</del><ins>+    if (updateMaskingLayer(renderer().hasMask(), renderer().hasClipPath()))
+        layerConfigChanged = true;
</ins><span class="cx"> 
</span><span class="cx">     updateChildClippingStrategy(needsDescendantsClippingLayer);
</span><span class="cx"> 
</span><span class="lines">@@ -888,6 +889,9 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    if (layerConfigChanged)
+        updatePaintingPhases();
+
</ins><span class="cx">     return layerConfigChanged;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1709,7 +1713,6 @@
</span><span class="cx">             String layerName = m_owningLayer.name() + " (foreground)";
</span><span class="cx">             m_foregroundLayer = createGraphicsLayer(layerName);
</span><span class="cx">             m_foregroundLayer->setDrawsContent(true);
</span><del>-            m_foregroundLayer->setPaintingPhase({ GraphicsLayerPaintingPhase::Foreground });
</del><span class="cx">             layerChanged = true;
</span><span class="cx">         }
</span><span class="cx">     } else if (m_foregroundLayer) {
</span><span class="lines">@@ -1718,11 +1721,6 @@
</span><span class="cx">         layerChanged = true;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (layerChanged) {
-        m_graphicsLayer->setNeedsDisplay();
-        m_graphicsLayer->setPaintingPhase(paintingPhaseForPrimaryLayer());
-    }
-
</del><span class="cx">     return layerChanged;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1735,7 +1733,6 @@
</span><span class="cx">             m_backgroundLayer = createGraphicsLayer(layerName);
</span><span class="cx">             m_backgroundLayer->setDrawsContent(true);
</span><span class="cx">             m_backgroundLayer->setAnchorPoint(FloatPoint3D());
</span><del>-            m_backgroundLayer->setPaintingPhase({ GraphicsLayerPaintingPhase::Background });
</del><span class="cx">             layerChanged = true;
</span><span class="cx">         }
</span><span class="cx">         
</span><span class="lines">@@ -1759,15 +1756,12 @@
</span><span class="cx">             m_graphicsLayer->setAppliesPageScale(true);
</span><span class="cx">         }
</span><span class="cx">     }
</span><del>-    
-    if (layerChanged)
-        m_graphicsLayer->setNeedsDisplay();
-    
</del><ins>+
</ins><span class="cx">     return layerChanged;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // Masking layer is used for masks or clip-path.
</span><del>-void RenderLayerBacking::updateMaskingLayer(bool hasMask, bool hasClipPath)
</del><ins>+bool RenderLayerBacking::updateMaskingLayer(bool hasMask, bool hasClipPath)
</ins><span class="cx"> {
</span><span class="cx">     bool layerChanged = false;
</span><span class="cx">     if (hasMask || hasClipPath) {
</span><span class="lines">@@ -1805,8 +1799,7 @@
</span><span class="cx">         layerChanged = true;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (layerChanged)
-        m_graphicsLayer->setPaintingPhase(paintingPhaseForPrimaryLayer());
</del><ins>+    return layerChanged;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void RenderLayerBacking::updateChildClippingStrategy(bool needsDescendantsClippingLayer)
</span><span class="lines">@@ -1846,8 +1839,9 @@
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     if (!m_scrollContainerLayer) {
</span><del>-        // Outer layer which corresponds with the scroll view.
</del><ins>+        // Outer layer which corresponds with the scroll view. This never paints content.
</ins><span class="cx">         m_scrollContainerLayer = createGraphicsLayer("scroll container", GraphicsLayer::Type::ScrollContainer);
</span><ins>+        m_scrollContainerLayer->setPaintingPhase({ });
</ins><span class="cx">         m_scrollContainerLayer->setDrawsContent(false);
</span><span class="cx">         m_scrollContainerLayer->setMasksToBounds(true);
</span><span class="cx"> 
</span><span class="lines">@@ -1855,11 +1849,6 @@
</span><span class="cx">         m_scrolledContentsLayer = createGraphicsLayer("scrolled contents", GraphicsLayer::Type::ScrolledContents);
</span><span class="cx">         m_scrolledContentsLayer->setDrawsContent(true);
</span><span class="cx">         m_scrolledContentsLayer->setAnchorPoint({ });
</span><del>-
-        OptionSet<GraphicsLayerPaintingPhase> paintPhases = { GraphicsLayerPaintingPhase::OverflowContents, GraphicsLayerPaintingPhase::CompositedScroll };
-        if (!m_foregroundLayer)
-            paintPhases.add(GraphicsLayerPaintingPhase::Foreground);
-        m_scrolledContentsLayer->setPaintingPhase(paintPhases);
</del><span class="cx">         m_scrollContainerLayer->addChild(*m_scrolledContentsLayer);
</span><span class="cx">     } else {
</span><span class="cx">         compositor().willRemoveScrollingLayerWithBacking(m_owningLayer, *this);
</span><span class="lines">@@ -1871,9 +1860,6 @@
</span><span class="cx">         GraphicsLayer::unparentAndClear(m_scrolledContentsLayer);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    m_graphicsLayer->setPaintingPhase(paintingPhaseForPrimaryLayer());
-    m_graphicsLayer->setNeedsDisplay(); // Because painting phases changed.
-
</del><span class="cx">     if (m_scrollContainerLayer)
</span><span class="cx">         compositor().didAddScrollingLayer(m_owningLayer);
</span><span class="cx">     
</span><span class="lines">@@ -1939,22 +1925,6 @@
</span><span class="cx">     m_graphicsLayer->setIsViewportConstrained(viewportCoordinated);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-OptionSet<GraphicsLayerPaintingPhase> RenderLayerBacking::paintingPhaseForPrimaryLayer() const
-{
-    OptionSet<GraphicsLayerPaintingPhase> phases;
-    if (!m_backgroundLayer)
-        phases.add(GraphicsLayerPaintingPhase::Background);
-    if (!m_foregroundLayer)
-        phases.add(GraphicsLayerPaintingPhase::Foreground);
-
-    if (m_scrolledContentsLayer) {
-        phases.remove(GraphicsLayerPaintingPhase::Foreground);
-        phases.add(GraphicsLayerPaintingPhase::CompositedScroll);
-    }
-
-    return phases;
-}
-
</del><span class="cx"> float RenderLayerBacking::compositingOpacity(float rendererOpacity) const
</span><span class="cx"> {
</span><span class="cx">     float finalOpacity = rendererOpacity;
</span><span class="lines">@@ -2123,6 +2093,35 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void RenderLayerBacking::updatePaintingPhases()
+{
+    // Phases for m_childClippingMaskLayer and m_maskLayer are set elsewhere.
+    OptionSet<GraphicsLayerPaintingPhase> primaryLayerPhases = { GraphicsLayerPaintingPhase::Background, GraphicsLayerPaintingPhase::Foreground };
+    
+    if (m_foregroundLayer) {
+        OptionSet<GraphicsLayerPaintingPhase> foregroundLayerPhases { GraphicsLayerPaintingPhase::Foreground };
+        m_foregroundLayer->setPaintingPhase(foregroundLayerPhases);
+        primaryLayerPhases.remove(GraphicsLayerPaintingPhase::Foreground);
+    }
+
+    if (m_backgroundLayer) {
+        m_backgroundLayer->setPaintingPhase(GraphicsLayerPaintingPhase::Background);
+        primaryLayerPhases.remove(GraphicsLayerPaintingPhase::Background);
+    }
+
+    if (m_scrolledContentsLayer) {
+        OptionSet<GraphicsLayerPaintingPhase> scrolledContentLayerPhases = { GraphicsLayerPaintingPhase::OverflowContents, GraphicsLayerPaintingPhase::CompositedScroll };
+        if (!m_foregroundLayer)
+            scrolledContentLayerPhases.add(GraphicsLayerPaintingPhase::Foreground);
+        m_scrolledContentsLayer->setPaintingPhase(scrolledContentLayerPhases);
+
+        primaryLayerPhases.remove(GraphicsLayerPaintingPhase::Foreground);
+        primaryLayerPhases.add(GraphicsLayerPaintingPhase::CompositedScroll);
+    }
+
+    m_graphicsLayer->setPaintingPhase(primaryLayerPhases);
+}
+
</ins><span class="cx"> static bool supportsDirectlyCompositedBoxDecorations(const RenderLayerModelObject& renderer)
</span><span class="cx"> {
</span><span class="cx">     if (!GraphicsLayer::supportsBackgroundColorContent())
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerBackingh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.h (245976 => 245977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayerBacking.h      2019-05-31 19:05:51 UTC (rev 245976)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.h 2019-05-31 19:07:30 UTC (rev 245977)
</span><span class="lines">@@ -316,7 +316,7 @@
</span><span class="cx">     bool updateOverflowControlsLayers(bool needsHorizontalScrollbarLayer, bool needsVerticalScrollbarLayer, bool needsScrollCornerLayer);
</span><span class="cx">     bool updateForegroundLayer(bool needsForegroundLayer);
</span><span class="cx">     bool updateBackgroundLayer(bool needsBackgroundLayer);
</span><del>-    void updateMaskingLayer(bool hasMask, bool hasClipPath);
</del><ins>+    bool updateMaskingLayer(bool hasMask, bool hasClipPath);
</ins><span class="cx">     bool requiresHorizontalScrollbarLayer() const;
</span><span class="cx">     bool requiresVerticalScrollbarLayer() const;
</span><span class="cx">     bool requiresScrollCornerLayer() const;
</span><span class="lines">@@ -326,15 +326,12 @@
</span><span class="cx">     void setLocationOfScrolledContents(ScrollOffset, ScrollingLayerPositionAction);
</span><span class="cx"> 
</span><span class="cx">     void updateChildClippingStrategy(bool needsDescendantsClippingLayer);
</span><del>-
</del><span class="cx">     void updateMaskingLayerGeometry();
</span><del>-    
</del><span class="cx">     void updateRootLayerConfiguration();
</span><ins>+    void updatePaintingPhases();
</ins><span class="cx"> 
</span><span class="cx">     void setBackgroundLayerPaintsFixedRootBackground(bool);
</span><span class="cx"> 
</span><del>-    OptionSet<GraphicsLayerPaintingPhase> paintingPhaseForPrimaryLayer() const;
-    
</del><span class="cx">     LayoutSize contentOffsetInCompositingLayer() const;
</span><span class="cx">     // Result is transform origin in device pixels.
</span><span class="cx">     FloatPoint3D computeTransformOriginForPainting(const LayoutRect& borderBox) const;
</span></span></pre>
</div>
</div>

</body>
</html>