Title: [213810] releases/WebKitGTK/webkit-2.16/Source/WebCore
- Revision
- 213810
- Author
- [email protected]
- Date
- 2017-03-13 03:37:34 -0700 (Mon, 13 Mar 2017)
Log Message
Merge r213435 - Make some RenderLayer tree traversal in RenderLayerBacking more generic
https://bugs.webkit.org/show_bug.cgi?id=169177
Reviewed by Zalan Bujtas.
The real goal of this patch is reduce the number of callers of
RenderLayerBacking::isPaintDestinationForDescendantLayers() to one. To achieve that,
have the setContentsVisible() logic (which is really just about the CSS 'visibility' property)
do its own tree traversal which just consults layer.hasVisibleContent(). So
make descendantLayerPaintsIntoAncestor() a generic traversal function which walks
descendant layers which may paint into the target layer. The "Visible" in the name
reflects the fact that it can bypass a subtree for a layer with !hasVisibleDescendant().
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateAfterDescendants):
(WebCore::traverseVisibleNonCompositedDescendantLayers):
(WebCore::RenderLayerBacking::isPaintDestinationForDescendantLayers):
(WebCore::RenderLayerBacking::hasVisibleNonCompositedDescendants):
(WebCore::descendantLayerPaintsIntoAncestor): Deleted.
* rendering/RenderLayerBacking.h:
Modified Paths
Diff
Modified: releases/WebKitGTK/webkit-2.16/Source/WebCore/ChangeLog (213809 => 213810)
--- releases/WebKitGTK/webkit-2.16/Source/WebCore/ChangeLog 2017-03-13 10:36:27 UTC (rev 213809)
+++ releases/WebKitGTK/webkit-2.16/Source/WebCore/ChangeLog 2017-03-13 10:37:34 UTC (rev 213810)
@@ -1,3 +1,26 @@
+2017-03-05 Simon Fraser <[email protected]>
+
+ Make some RenderLayer tree traversal in RenderLayerBacking more generic
+ https://bugs.webkit.org/show_bug.cgi?id=169177
+
+ Reviewed by Zalan Bujtas.
+
+ The real goal of this patch is reduce the number of callers of
+ RenderLayerBacking::isPaintDestinationForDescendantLayers() to one. To achieve that,
+ have the setContentsVisible() logic (which is really just about the CSS 'visibility' property)
+ do its own tree traversal which just consults layer.hasVisibleContent(). So
+ make descendantLayerPaintsIntoAncestor() a generic traversal function which walks
+ descendant layers which may paint into the target layer. The "Visible" in the name
+ reflects the fact that it can bypass a subtree for a layer with !hasVisibleDescendant().
+
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::updateAfterDescendants):
+ (WebCore::traverseVisibleNonCompositedDescendantLayers):
+ (WebCore::RenderLayerBacking::isPaintDestinationForDescendantLayers):
+ (WebCore::RenderLayerBacking::hasVisibleNonCompositedDescendants):
+ (WebCore::descendantLayerPaintsIntoAncestor): Deleted.
+ * rendering/RenderLayerBacking.h:
+
2017-03-04 Simon Fraser <[email protected]>
Clarify some terminology in RenderLayerBacking
Modified: releases/WebKitGTK/webkit-2.16/Source/WebCore/rendering/RenderLayerBacking.cpp (213809 => 213810)
--- releases/WebKitGTK/webkit-2.16/Source/WebCore/rendering/RenderLayerBacking.cpp 2017-03-13 10:36:27 UTC (rev 213809)
+++ releases/WebKitGTK/webkit-2.16/Source/WebCore/rendering/RenderLayerBacking.cpp 2017-03-13 10:37:34 UTC (rev 213810)
@@ -1103,7 +1103,7 @@
updateDrawsContent(isSimpleContainer);
- m_graphicsLayer->setContentsVisible(m_owningLayer.hasVisibleContent() || isPaintDestinationForDescendantLayers());
+ m_graphicsLayer->setContentsVisible(m_owningLayer.hasVisibleContent() || hasVisibleNonCompositedDescendants());
if (m_scrollingLayer) {
m_scrollingLayer->setContentsVisible(renderer().style().visibility() == VISIBLE);
m_scrollingLayer->setUserInteractionEnabled(renderer().style().pointerEvents() != PE_NONE);
@@ -1947,7 +1947,9 @@
return true;
}
-static bool descendantLayerPaintsIntoAncestor(RenderLayer& parent)
+enum class LayerTraversal { Continue, Stop };
+
+static LayerTraversal traverseVisibleNonCompositedDescendantLayers(RenderLayer& parent, std::function<LayerTraversal (const RenderLayer&)> layerFunc)
{
// FIXME: We shouldn't be called with a stale z-order lists. See bug 85512.
parent.updateLayerListsIfNeeded();
@@ -1958,40 +1960,75 @@
if (auto* normalFlowList = parent.normalFlowList()) {
for (auto* childLayer : *normalFlowList) {
- if (!compositedWithOwnBackingStore(*childLayer) && (childLayer->isVisuallyNonEmpty() || descendantLayerPaintsIntoAncestor(*childLayer)))
- return true;
+ if (compositedWithOwnBackingStore(*childLayer))
+ continue;
+
+ if (layerFunc(*childLayer) == LayerTraversal::Stop)
+ return LayerTraversal::Stop;
+
+ if (traverseVisibleNonCompositedDescendantLayers(*childLayer, layerFunc) == LayerTraversal::Stop)
+ return LayerTraversal::Stop;
}
}
if (parent.isStackingContainer()) {
if (!parent.hasVisibleDescendant())
- return false;
+ return LayerTraversal::Continue;
// Use the m_hasCompositingDescendant bit to optimize?
if (auto* negZOrderList = parent.negZOrderList()) {
for (auto* childLayer : *negZOrderList) {
- if (!compositedWithOwnBackingStore(*childLayer) && (childLayer->isVisuallyNonEmpty() || descendantLayerPaintsIntoAncestor(*childLayer)))
- return true;
+ if (compositedWithOwnBackingStore(*childLayer))
+ continue;
+
+ if (layerFunc(*childLayer) == LayerTraversal::Stop)
+ return LayerTraversal::Stop;
+
+ if (traverseVisibleNonCompositedDescendantLayers(*childLayer, layerFunc) == LayerTraversal::Stop)
+ return LayerTraversal::Stop;
}
}
if (auto* posZOrderList = parent.posZOrderList()) {
for (auto* childLayer : *posZOrderList) {
- if (!compositedWithOwnBackingStore(*childLayer) && (childLayer->isVisuallyNonEmpty() || descendantLayerPaintsIntoAncestor(*childLayer)))
- return true;
+ if (compositedWithOwnBackingStore(*childLayer))
+ continue;
+
+ if (layerFunc(*childLayer) == LayerTraversal::Stop)
+ return LayerTraversal::Stop;
+
+ if (traverseVisibleNonCompositedDescendantLayers(*childLayer, layerFunc) == LayerTraversal::Stop)
+ return LayerTraversal::Stop;
}
}
}
- return false;
+ return LayerTraversal::Continue;
}
// Conservative test for having no rendered children.
bool RenderLayerBacking::isPaintDestinationForDescendantLayers() const
{
- return descendantLayerPaintsIntoAncestor(m_owningLayer);
+ bool hasPaintingDescendant = false;
+ traverseVisibleNonCompositedDescendantLayers(m_owningLayer, [&hasPaintingDescendant](const RenderLayer& layer) {
+ hasPaintingDescendant = layer.isVisuallyNonEmpty();
+ return hasPaintingDescendant ? LayerTraversal::Stop : LayerTraversal::Continue;
+ });
+
+ return hasPaintingDescendant;
}
+bool RenderLayerBacking::hasVisibleNonCompositedDescendants() const
+{
+ bool hasVisibleDescendant = false;
+ traverseVisibleNonCompositedDescendantLayers(m_owningLayer, [&hasVisibleDescendant](const RenderLayer& layer) {
+ hasVisibleDescendant = layer.hasVisibleContent();
+ return hasVisibleDescendant ? LayerTraversal::Stop : LayerTraversal::Continue;
+ });
+
+ return hasVisibleDescendant;
+}
+
bool RenderLayerBacking::containsPaintedContent(bool isSimpleContainer) const
{
if (isSimpleContainer || paintsIntoWindow() || paintsIntoCompositedAncestor() || m_artificiallyInflatedBounds || m_owningLayer.isReflection())
Modified: releases/WebKitGTK/webkit-2.16/Source/WebCore/rendering/RenderLayerBacking.h (213809 => 213810)
--- releases/WebKitGTK/webkit-2.16/Source/WebCore/rendering/RenderLayerBacking.h 2017-03-13 10:36:27 UTC (rev 213809)
+++ releases/WebKitGTK/webkit-2.16/Source/WebCore/rendering/RenderLayerBacking.h 2017-03-13 10:37:34 UTC (rev 213810)
@@ -329,6 +329,7 @@
void resetContentsRect();
bool isPaintDestinationForDescendantLayers() const;
+ bool hasVisibleNonCompositedDescendants() const;
bool shouldClipCompositedBounds() const;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes