REGRESSION (r245170): gmail.com inbox table header flickers
https://bugs.webkit.org/show_bug.cgi?id=198005
<rdar://problem/50907718>

Reviewed by Antti Koivisto.

Source/WebCore:

When a layer started as painting into shared backing, but then became independently
composited (e.g. by having to clip composited children), it wouldn't have the "overlap"
indirect compositing reason. This allowed requiresOwnBackingStore() to say that it
could paint into some ancestor, but this breaks overlap. So in this code path,
put IndirectCompositingReason::Overlap back on the layer which restores the previous
behavior.

Make some logging changes to help diagnose things like this.

Test: compositing/shared-backing/overlap-after-end-sharing.html

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::calculateClipRects const):
(WebCore::outputPaintOrderTreeLegend):
(WebCore::outputPaintOrderTreeRecursive):
* rendering/RenderLayer.h:
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::computeCompositingRequirements):
(WebCore::RenderLayerCompositor::updateBacking):
(WebCore::RenderLayerCompositor::requiresOwnBackingStore const):
(WebCore::RenderLayerCompositor::reasonsForCompositing const):
(WebCore::RenderLayerCompositor::requiresCompositingForIndirectReason const):
* rendering/RenderLayerCompositor.h:

LayoutTests:

* compositing/shared-backing/overlap-after-end-sharing-expected.html: Added.
* compositing/shared-backing/overlap-after-end-sharing.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@245490 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index c1d7ed1..f137ef3 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -35,6 +35,17 @@
 
 2019-05-17  Simon Fraser  <simon.fraser@apple.com>
 
+        REGRESSION (r245170): gmail.com inbox table header flickers
+        https://bugs.webkit.org/show_bug.cgi?id=198005
+        <rdar://problem/50907718>
+
+        Reviewed by Antti Koivisto.
+
+        * compositing/shared-backing/overlap-after-end-sharing-expected.html: Added.
+        * compositing/shared-backing/overlap-after-end-sharing.html: Added.
+
+2019-05-17  Simon Fraser  <simon.fraser@apple.com>
+
         REGRESSION (r245170): gmail.com header flickers when hovering over the animating buttons
         https://bugs.webkit.org/show_bug.cgi?id=197975
         <rdar://problem/50865946>
diff --git a/LayoutTests/compositing/shared-backing/overlap-after-end-sharing-expected.html b/LayoutTests/compositing/shared-backing/overlap-after-end-sharing-expected.html
new file mode 100644
index 0000000..8675e18
--- /dev/null
+++ b/LayoutTests/compositing/shared-backing/overlap-after-end-sharing-expected.html
@@ -0,0 +1,67 @@
+<!DOCTYPE html>
+<html>
+<head>
+	<style>
+		body {
+			margin: 0;
+		}
+		.backdrop {
+			position: fixed;
+			top: 10px;
+			left: 10px;
+			width: 500px;
+			height: 300px;
+			background-color: silver;
+		}
+		
+		.container {
+			position: relative;
+			top: 20px;
+			left: 20px;
+			width: 480px;
+			height: 280px;
+			border: 1px solid black;
+			padding: 10px;
+			box-sizing: border-box;
+		}
+		
+		.header {
+			position: relative;
+			z-index: 1;
+			overflow: hidden;
+			width: 460px;
+			height: 260px;
+			background-color: lightblue;
+		}
+
+		.target {
+			position: relative;
+			top: 10px;
+			left: 10px;
+			width: 200px;
+			height: 100px;
+			background-color: green;
+		}
+		
+		.animating {
+			position: relative;
+			background-color: orange;
+			opacity: 0.6;
+			top: 20px;
+			left: 250px;
+			width: 180px;
+			height: 100px;
+			padding: 10px;
+		}
+	</style>
+</head>
+<body>
+	<div class="backdrop"></div>
+	<div class="container">
+		<div class="header">
+			<div class="target"></div>
+			<div class="animating"></div>
+		</div>
+	</div>
+</body>
+</html>
diff --git a/LayoutTests/compositing/shared-backing/overlap-after-end-sharing.html b/LayoutTests/compositing/shared-backing/overlap-after-end-sharing.html
new file mode 100644
index 0000000..aa329be
--- /dev/null
+++ b/LayoutTests/compositing/shared-backing/overlap-after-end-sharing.html
@@ -0,0 +1,85 @@
+<!DOCTYPE html>
+<html>
+<head>
+	<style>
+		body {
+			margin: 0;
+		}
+		.backdrop {
+			position: fixed;
+			top: 10px;
+			left: 10px;
+			width: 500px;
+			height: 300px;
+			background-color: silver;
+		}
+		
+		.container {
+			position: relative;
+			top: 20px;
+			left: 20px;
+			width: 480px;
+			height: 280px;
+			border: 1px solid black;
+			padding: 10px;
+			box-sizing: border-box;
+		}
+		
+		.header {
+			position: relative;
+			z-index: 1;
+			overflow: hidden;
+			width: 460px;
+			height: 260px;
+			background-color: lightblue;
+		}
+
+		.target {
+			position: relative;
+			top: 10px;
+			left: 10px;
+			width: 200px;
+			height: 100px;
+			background-color: green;
+		}
+		
+		.animating {
+			position: relative;
+			background-color: orange;
+			top: auto;
+			left: 250px;
+			width: 180px;
+			height: 100px;
+			opacity: 0.6;
+			transition: opacity 500s;
+			padding: 10px;
+		}
+		
+		.animating.changed {
+			opacity: 1;
+			top: 20px;
+		}
+	</style>
+    <script>
+		if (window.testRunner)
+			testRunner.waitUntilDone();
+
+		window.addEventListener('load', () => {
+			setTimeout(() => {
+				document.querySelector('.animating').classList.add('changed');
+				if (window.testRunner)
+					testRunner.notifyDone();
+			}, 0);
+		}, false);
+    </script>
+</head>
+<body>
+	<div class="backdrop"></div>
+	<div class="container">
+		<div class="header">
+			<div class="target"></div>
+			<div class="animating"></div>
+		</div>
+	</div>
+</body>
+</html>
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index fdc28c1..877d639 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -149,6 +149,38 @@
 
 2019-05-17  Simon Fraser  <simon.fraser@apple.com>
 
+        REGRESSION (r245170): gmail.com inbox table header flickers
+        https://bugs.webkit.org/show_bug.cgi?id=198005
+        <rdar://problem/50907718>
+
+        Reviewed by Antti Koivisto.
+
+        When a layer started as painting into shared backing, but then became independently
+        composited (e.g. by having to clip composited children), it wouldn't have the "overlap"
+        indirect compositing reason. This allowed requiresOwnBackingStore() to say that it
+        could paint into some ancestor, but this breaks overlap. So in this code path,
+        put IndirectCompositingReason::Overlap back on the layer which restores the previous
+        behavior.
+
+        Make some logging changes to help diagnose things like this.
+
+        Test: compositing/shared-backing/overlap-after-end-sharing.html
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::calculateClipRects const):
+        (WebCore::outputPaintOrderTreeLegend):
+        (WebCore::outputPaintOrderTreeRecursive):
+        * rendering/RenderLayer.h:
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::computeCompositingRequirements):
+        (WebCore::RenderLayerCompositor::updateBacking):
+        (WebCore::RenderLayerCompositor::requiresOwnBackingStore const):
+        (WebCore::RenderLayerCompositor::reasonsForCompositing const):
+        (WebCore::RenderLayerCompositor::requiresCompositingForIndirectReason const):
+        * rendering/RenderLayerCompositor.h:
+
+2019-05-17  Simon Fraser  <simon.fraser@apple.com>
+
         REGRESSION (r245170): gmail.com header flickers when hovering over the animating buttons
         https://bugs.webkit.org/show_bug.cgi?id=197975
         <rdar://problem/50865946>
diff --git a/Source/WebCore/rendering/RenderLayer.cpp b/Source/WebCore/rendering/RenderLayer.cpp
index e5034c5..3c90cfb 100644
--- a/Source/WebCore/rendering/RenderLayer.cpp
+++ b/Source/WebCore/rendering/RenderLayer.cpp
@@ -6887,6 +6887,22 @@
     return ts;
 }
 
+TextStream& operator<<(TextStream& ts, IndirectCompositingReason reason)
+{
+    switch (reason) {
+    case IndirectCompositingReason::None: ts << "none"; break;
+    case IndirectCompositingReason::Stacking: ts << "stacking"; break;
+    case IndirectCompositingReason::OverflowScrollPositioning: ts << "overflow positioning"; break;
+    case IndirectCompositingReason::Overlap: ts << "overlap"; break;
+    case IndirectCompositingReason::BackgroundLayer: ts << "background layer"; break;
+    case IndirectCompositingReason::GraphicalEffect: ts << "graphical effect"; break;
+    case IndirectCompositingReason::Perspective: ts << "perspective"; break;
+    case IndirectCompositingReason::Preserve3D: ts << "preserve-3d"; break;
+    }
+
+    return ts;
+}
+
 } // namespace WebCore
 
 #if ENABLE(TREE_DEBUGGING)
@@ -6921,7 +6937,7 @@
 static void outputPaintOrderTreeLegend(TextStream& stream)
 {
     stream.nextLine();
-    stream << "(S)tacking Context/(F)orced SC/O(P)portunistic SC, (N)ormal flow only, (O)verflow clip, (A)lpha (opacity or mask), has (B)lend mode, (I)solates blending, (T)ransform-ish, (F)ilter, Fi(X)ed position, (C)omposited, (P)rovides backing/uses (p)rovided backing, (c)omposited descendant, (s)scrolling ancestor\n"
+    stream << "(S)tacking Context/(F)orced SC/O(P)portunistic SC, (N)ormal flow only, (O)verflow clip, (A)lpha (opacity or mask), has (B)lend mode, (I)solates blending, (T)ransform-ish, (F)ilter, Fi(X)ed position, (C)omposited, (P)rovides backing/uses (p)rovided backing/paints to (a)ncestor, (c)omposited descendant, (s)scrolling ancestor\n"
         "Dirty (z)-lists, Dirty (n)ormal flow lists\n"
         "Traversal needs: requirements (t)raversal on descendants, (b)acking or hierarchy traversal on descendants, (r)equirements traversal on all descendants, requirements traversal on all (s)ubsequent layers, (h)ierarchy traversal on all descendants, update of paint (o)rder children\n"
         "Update needs:    post-(l)ayout requirements, (g)eometry, (k)ids geometry, (c)onfig, layer conne(x)ion, (s)crolling tree\n";
@@ -6947,7 +6963,24 @@
     stream << (layer.hasFilter() ? "F" : "-");
     stream << (layer.renderer().isFixedPositioned() ? "X" : "-");
     stream << (layer.isComposited() ? "C" : "-");
-    stream << ((layer.isComposited() && layer.backing()->hasBackingSharingLayers()) ? "P" : (layer.paintsIntoProvidedBacking() ? "p" : "-"));
+    
+    auto compositedPaintingDestinationString = [&layer]() {
+        if (layer.paintsIntoProvidedBacking())
+            return "p";
+
+        if (!layer.isComposited())
+            return "-";
+
+        if (layer.backing()->hasBackingSharingLayers())
+            return "P";
+        
+        if (layer.backing()->paintsIntoCompositedAncestor())
+            return "a";
+
+        return "-";
+    };
+
+    stream << compositedPaintingDestinationString();
     stream << (layer.hasCompositingDescendant() ? "c" : "-");
     stream << (layer.hasCompositedScrollingAncestor() ? "s" : "-");
 
@@ -6986,6 +7019,9 @@
     if (layer.isComposited()) {
         auto& backing = *layer.backing();
         stream << " (layerID " << backing.graphicsLayer()->primaryLayerID() << ")";
+        
+        if (layer.indirectCompositingReason() != WebCore::IndirectCompositingReason::None)
+            stream << " " << layer.indirectCompositingReason();
 
         auto scrollingNodeID = backing.scrollingNodeIDForRole(WebCore::ScrollCoordinationRole::Scrolling);
         auto frameHostingNodeID = backing.scrollingNodeIDForRole(WebCore::ScrollCoordinationRole::FrameHosting);
diff --git a/Source/WebCore/rendering/RenderLayer.h b/Source/WebCore/rendering/RenderLayer.h
index aa96306..6ddc70d 100644
--- a/Source/WebCore/rendering/RenderLayer.h
+++ b/Source/WebCore/rendering/RenderLayer.h
@@ -117,6 +117,17 @@
     Undetermined
 };
 
+enum class IndirectCompositingReason {
+    None,
+    Stacking,
+    OverflowScrollPositioning,
+    Overlap,
+    BackgroundLayer,
+    GraphicalEffect, // opacity, mask, filter, transform etc.
+    Perspective,
+    Preserve3D
+};
+
 struct ScrollRectToVisibleOptions {
     SelectionRevealMode revealMode { SelectionRevealMode::Reveal };
     const ScrollAlignment& alignX { ScrollAlignment::alignCenterIfNeeded };
@@ -870,7 +881,9 @@
 
     void setViewportConstrainedNotCompositedReason(ViewportConstrainedNotCompositedReason reason) { m_viewportConstrainedNotCompositedReason = reason; }
     ViewportConstrainedNotCompositedReason viewportConstrainedNotCompositedReason() const { return static_cast<ViewportConstrainedNotCompositedReason>(m_viewportConstrainedNotCompositedReason); }
-    
+
+    IndirectCompositingReason indirectCompositingReason() const { return static_cast<IndirectCompositingReason>(m_indirectCompositingReason); }
+
     bool isRenderFragmentedFlow() const { return renderer().isRenderFragmentedFlow(); }
     bool isOutOfFlowRenderFragmentedFlow() const { return renderer().isOutOfFlowRenderFragmentedFlow(); }
     bool isInsideFragmentedFlow() const { return renderer().fragmentedFlowState() != RenderObject::NotInsideFragmentedFlow; }
@@ -1157,19 +1170,7 @@
 
     void setHasCompositingDescendant(bool b)  { m_hasCompositingDescendant = b; }
     
-    enum class IndirectCompositingReason {
-        None,
-        Stacking,
-        OverflowScrollPositioning,
-        Overlap,
-        BackgroundLayer,
-        GraphicalEffect, // opacity, mask, filter, transform etc.
-        Perspective,
-        Preserve3D
-    };
-    
     void setIndirectCompositingReason(IndirectCompositingReason reason) { m_indirectCompositingReason = static_cast<unsigned>(reason); }
-    IndirectCompositingReason indirectCompositingReason() const { return static_cast<IndirectCompositingReason>(m_indirectCompositingReason); }
     bool mustCompositeForIndirectReasons() const { return m_indirectCompositingReason; }
 
     friend class RenderLayerBacking;
@@ -1387,6 +1388,7 @@
 WTF::TextStream& operator<<(WTF::TextStream&, ClipRectsType);
 WTF::TextStream& operator<<(WTF::TextStream&, const RenderLayer&);
 WTF::TextStream& operator<<(WTF::TextStream&, const RenderLayer::ClipRectsContext&);
+WTF::TextStream& operator<<(WTF::TextStream&, IndirectCompositingReason);
 
 } // namespace WebCore
 
diff --git a/Source/WebCore/rendering/RenderLayerCompositor.cpp b/Source/WebCore/rendering/RenderLayerCompositor.cpp
index 5897baa..0482757 100644
--- a/Source/WebCore/rendering/RenderLayerCompositor.cpp
+++ b/Source/WebCore/rendering/RenderLayerCompositor.cpp
@@ -862,7 +862,7 @@
     bool becameCompositedAfterDescendantTraversal = false;
 
     if (layer.needsPostLayoutCompositingUpdate() || compositingState.fullPaintOrderTraversalRequired || compositingState.descendantsRequireCompositingUpdate) {
-        layer.setIndirectCompositingReason(RenderLayer::IndirectCompositingReason::None);
+        layer.setIndirectCompositingReason(IndirectCompositingReason::None);
         willBeComposited = needsToBeComposited(layer, queryData);
     }
 
@@ -877,7 +877,7 @@
     bool respectTransforms = !layerExtent.hasTransformAnimation;
     overlapMap.geometryMap().pushMappingsToAncestor(&layer, ancestorLayer, respectTransforms);
 
-    RenderLayer::IndirectCompositingReason compositingReason = compositingState.subtreeIsCompositing ? RenderLayer::IndirectCompositingReason::Stacking : RenderLayer::IndirectCompositingReason::None;
+    IndirectCompositingReason compositingReason = compositingState.subtreeIsCompositing ? IndirectCompositingReason::Stacking : IndirectCompositingReason::None;
     bool layerPaintsIntoProvidedBacking = false;
 
     // If we know for sure the layer is going to be composited, don't bother looking it up in the overlap map
@@ -889,12 +889,12 @@
             if (backingSharingState.backingProviderCandidate() && canBeComposited(layer) && backingProviderLayerCanIncludeLayer(*backingSharingState.backingProviderCandidate(), layer)) {
                 backingSharingState.appendSharingLayer(layer);
                 LOG(Compositing, " layer %p can share with %p", &layer, backingSharingState.backingProviderCandidate());
-                compositingReason = RenderLayer::IndirectCompositingReason::None;
+                compositingReason = IndirectCompositingReason::None;
                 layerPaintsIntoProvidedBacking = true;
             } else
-                compositingReason = RenderLayer::IndirectCompositingReason::Overlap;
+                compositingReason = IndirectCompositingReason::Overlap;
         } else
-            compositingReason = RenderLayer::IndirectCompositingReason::None;
+            compositingReason = IndirectCompositingReason::None;
     }
 
 #if ENABLE(VIDEO)
@@ -903,14 +903,15 @@
     // into. These children (the controls) always need to be promoted into their
     // own layers to draw on top of the accelerated video.
     if (compositingState.compositingAncestor && compositingState.compositingAncestor->renderer().isVideo())
-        compositingReason = RenderLayer::IndirectCompositingReason::Overlap;
+        compositingReason = IndirectCompositingReason::Overlap;
 #endif
 
-    if (compositingReason != RenderLayer::IndirectCompositingReason::None)
+    if (compositingReason != IndirectCompositingReason::None)
         layer.setIndirectCompositingReason(compositingReason);
 
     // Check if the computed indirect reason will force the layer to become composited.
     if (!willBeComposited && layer.mustCompositeForIndirectReasons() && canBeComposited(layer)) {
+        LOG_WITH_STREAM(Compositing, stream << "layer " << &layer << " compositing for indirect reason " << layer.indirectCompositingReason() << " (was sharing: " << layerPaintsIntoProvidedBacking << ")");
         willBeComposited = true;
         layerPaintsIntoProvidedBacking = false;
     }
@@ -927,13 +928,18 @@
         // This layer now acts as the ancestor for kids.
         currentState.compositingAncestor = &layer;
         
-        if (!layerPaintsIntoProvidedBacking) {
+        if (layerPaintsIntoProvidedBacking) {
+            layerPaintsIntoProvidedBacking = false;
+            // layerPaintsIntoProvidedBacking was only true for layers that would otherwise composite because of overlap. If we can
+            // no longer share, put this this indirect reason back on the layer so that requiresOwnBackingStore() sees it.
+            layer.setIndirectCompositingReason(IndirectCompositingReason::Overlap);
+            LOG_WITH_STREAM(CompositingOverlap, stream << "layer " << &layer << " was sharing now will composite");
+        } else {
             overlapMap.pushCompositingContainer();
             LOG_WITH_STREAM(CompositingOverlap, stream << "layer " << &layer << " will composite, pushed container " << overlapMap);
         }
 
         willBeComposited = true;
-        layerPaintsIntoProvidedBacking = false;
     };
 
     auto layerWillCompositePostDescendants = [&] {
@@ -971,7 +977,7 @@
         // (since we need to ensure that the -ve z-order child renders underneath our contents).
         if (!willBeComposited && currentState.subtreeIsCompositing) {
             // make layer compositing
-            layer.setIndirectCompositingReason(RenderLayer::IndirectCompositingReason::BackgroundLayer);
+            layer.setIndirectCompositingReason(IndirectCompositingReason::BackgroundLayer);
             layerWillComposite();
         }
     }
@@ -999,7 +1005,7 @@
     ASSERT(!layer.hasNotIsolatedCompositedBlendingDescendants() || layer.hasNotIsolatedBlendingDescendants());
 #endif
     // Now check for reasons to become composited that depend on the state of descendant layers.
-    RenderLayer::IndirectCompositingReason indirectCompositingReason;
+    IndirectCompositingReason indirectCompositingReason;
     if (!willBeComposited && canBeComposited(layer)
         && requiresCompositingForIndirectReason(layer, compositingState.compositingAncestor, currentState.subtreeIsCompositing, anyDescendantHas3DTransform, layerPaintsIntoProvidedBacking, indirectCompositingReason)) {
         layer.setIndirectCompositingReason(indirectCompositingReason);
@@ -1008,7 +1014,7 @@
     
     if (layer.reflectionLayer()) {
         // FIXME: Shouldn't we call computeCompositingRequirements to handle a reflection overlapping with another renderer?
-        layer.reflectionLayer()->setIndirectCompositingReason(willBeComposited ? RenderLayer::IndirectCompositingReason::Stacking : RenderLayer::IndirectCompositingReason::None);
+        layer.reflectionLayer()->setIndirectCompositingReason(willBeComposited ? IndirectCompositingReason::Stacking : IndirectCompositingReason::None);
     }
 
     // Set the flag to say that this layer has compositing children.
@@ -1583,7 +1589,7 @@
         if (!layer.backing()) {
             // If we need to repaint, do so before making backing
             if (shouldRepaint == CompositingChangeRepaintNow)
-                repaintOnCompositingChange(layer);
+                repaintOnCompositingChange(layer); // wrong backing
 
             layer.ensureBacking();
 
@@ -2282,13 +2288,13 @@
         return true;
 
     if (layer.mustCompositeForIndirectReasons()) {
-        RenderLayer::IndirectCompositingReason reason = layer.indirectCompositingReason();
-        return reason == RenderLayer::IndirectCompositingReason::Overlap
-            || reason == RenderLayer::IndirectCompositingReason::OverflowScrollPositioning
-            || reason == RenderLayer::IndirectCompositingReason::Stacking
-            || reason == RenderLayer::IndirectCompositingReason::BackgroundLayer
-            || reason == RenderLayer::IndirectCompositingReason::GraphicalEffect
-            || reason == RenderLayer::IndirectCompositingReason::Preserve3D; // preserve-3d has to create backing store to ensure that 3d-transformed elements intersect.
+        IndirectCompositingReason reason = layer.indirectCompositingReason();
+        return reason == IndirectCompositingReason::Overlap
+            || reason == IndirectCompositingReason::OverflowScrollPositioning
+            || reason == IndirectCompositingReason::Stacking
+            || reason == IndirectCompositingReason::BackgroundLayer
+            || reason == IndirectCompositingReason::GraphicalEffect
+            || reason == IndirectCompositingReason::Preserve3D; // preserve-3d has to create backing store to ensure that 3d-transformed elements intersect.
     }
 
     if (!ancestorCompositedBounds.contains(layerCompositedBoundsInAncestor))
@@ -2347,21 +2353,21 @@
         reasons.add(CompositingReason::OverflowScrolling);
 
     switch (renderer.layer()->indirectCompositingReason()) {
-    case RenderLayer::IndirectCompositingReason::None:
+    case IndirectCompositingReason::None:
         break;
-    case RenderLayer::IndirectCompositingReason::Stacking:
+    case IndirectCompositingReason::Stacking:
         reasons.add(CompositingReason::Stacking);
         break;
-    case RenderLayer::IndirectCompositingReason::OverflowScrollPositioning:
+    case IndirectCompositingReason::OverflowScrollPositioning:
         reasons.add(CompositingReason::OverflowScrollPositioning);
         break;
-    case RenderLayer::IndirectCompositingReason::Overlap:
+    case IndirectCompositingReason::Overlap:
         reasons.add(CompositingReason::Overlap);
         break;
-    case RenderLayer::IndirectCompositingReason::BackgroundLayer:
+    case IndirectCompositingReason::BackgroundLayer:
         reasons.add(CompositingReason::NegativeZIndexChildren);
         break;
-    case RenderLayer::IndirectCompositingReason::GraphicalEffect:
+    case IndirectCompositingReason::GraphicalEffect:
         if (renderer.hasTransform())
             reasons.add(CompositingReason::TransformWithCompositedDescendants);
 
@@ -2385,10 +2391,10 @@
             reasons.add(CompositingReason::BlendingWithCompositedDescendants);
 #endif
         break;
-    case RenderLayer::IndirectCompositingReason::Perspective:
+    case IndirectCompositingReason::Perspective:
         reasons.add(CompositingReason::Perspective);
         break;
-    case RenderLayer::IndirectCompositingReason::Preserve3D:
+    case IndirectCompositingReason::Preserve3D:
         reasons.add(CompositingReason::Preserve3D);
         break;
     }
@@ -2829,13 +2835,13 @@
 }
 
 // FIXME: why doesn't this handle the clipping cases?
-bool RenderLayerCompositor::requiresCompositingForIndirectReason(const RenderLayer& layer, const RenderLayer* compositingAncestor, bool hasCompositedDescendants, bool has3DTransformedDescendants, bool paintsIntoProvidedBacking, RenderLayer::IndirectCompositingReason& reason) const
+bool RenderLayerCompositor::requiresCompositingForIndirectReason(const RenderLayer& layer, const RenderLayer* compositingAncestor, bool hasCompositedDescendants, bool has3DTransformedDescendants, bool paintsIntoProvidedBacking, IndirectCompositingReason& reason) const
 {
     // When a layer has composited descendants, some effects, like 2d transforms, filters, masks etc must be implemented
     // via compositing so that they also apply to those composited descendants.
     auto& renderer = layer.renderer();
     if (hasCompositedDescendants && (layer.isolatesCompositedBlending() || layer.transform() || renderer.createsGroup() || renderer.hasReflection())) {
-        reason = RenderLayer::IndirectCompositingReason::GraphicalEffect;
+        reason = IndirectCompositingReason::GraphicalEffect;
         return true;
     }
 
@@ -2843,24 +2849,24 @@
     // will be affected by the preserve-3d or perspective.
     if (has3DTransformedDescendants) {
         if (renderer.style().transformStyle3D() == TransformStyle3D::Preserve3D) {
-            reason = RenderLayer::IndirectCompositingReason::Preserve3D;
+            reason = IndirectCompositingReason::Preserve3D;
             return true;
         }
     
         if (renderer.style().hasPerspective()) {
-            reason = RenderLayer::IndirectCompositingReason::Perspective;
+            reason = IndirectCompositingReason::Perspective;
             return true;
         }
     }
 
     if (!paintsIntoProvidedBacking && renderer.isAbsolutelyPositioned() && compositingAncestor && layer.hasCompositedScrollingAncestor()) {
         if (layerContainingBlockCrossesCoordinatedScrollingBoundary(layer, *compositingAncestor)) {
-            reason = RenderLayer::IndirectCompositingReason::OverflowScrollPositioning;
+            reason = IndirectCompositingReason::OverflowScrollPositioning;
             return true;
         }
     }
 
-    reason = RenderLayer::IndirectCompositingReason::None;
+    reason = IndirectCompositingReason::None;
     return false;
 }
 
diff --git a/Source/WebCore/rendering/RenderLayerCompositor.h b/Source/WebCore/rendering/RenderLayerCompositor.h
index f516b83..3bc2359 100644
--- a/Source/WebCore/rendering/RenderLayerCompositor.h
+++ b/Source/WebCore/rendering/RenderLayerCompositor.h
@@ -478,7 +478,7 @@
     bool requiresCompositingForPosition(RenderLayerModelObject&, const RenderLayer&, RequiresCompositingData&) const;
     bool requiresCompositingForOverflowScrolling(const RenderLayer&, RequiresCompositingData&) const;
     bool requiresCompositingForEditableImage(RenderLayerModelObject&) const;
-    bool requiresCompositingForIndirectReason(const RenderLayer&, const RenderLayer* compositingAncestor, bool hasCompositedDescendants, bool has3DTransformedDescendants, bool paintsIntoProvidedBacking, RenderLayer::IndirectCompositingReason&) const;
+    bool requiresCompositingForIndirectReason(const RenderLayer&, const RenderLayer* compositingAncestor, bool hasCompositedDescendants, bool has3DTransformedDescendants, bool paintsIntoProvidedBacking, IndirectCompositingReason&) const;
 
     static bool layerContainingBlockCrossesCoordinatedScrollingBoundary(const RenderLayer&, const RenderLayer& compositedAncestor);