Changeset 213435 in webkit
- Timestamp:
- Mar 5, 2017, 11:14:12 AM (9 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r213429 r213435 1 2017-03-05 Simon Fraser <simon.fraser@apple.com> 2 3 Make some RenderLayer tree traversal in RenderLayerBacking more generic 4 https://bugs.webkit.org/show_bug.cgi?id=169177 5 6 Reviewed by Zalan Bujtas. 7 8 The real goal of this patch is reduce the number of callers of 9 RenderLayerBacking::isPaintDestinationForDescendantLayers() to one. To achieve that, 10 have the setContentsVisible() logic (which is really just about the CSS 'visibility' property) 11 do its own tree traversal which just consults layer.hasVisibleContent(). So 12 make descendantLayerPaintsIntoAncestor() a generic traversal function which walks 13 descendant layers which may paint into the target layer. The "Visible" in the name 14 reflects the fact that it can bypass a subtree for a layer with !hasVisibleDescendant(). 15 16 * rendering/RenderLayerBacking.cpp: 17 (WebCore::RenderLayerBacking::updateAfterDescendants): 18 (WebCore::traverseVisibleNonCompositedDescendantLayers): 19 (WebCore::RenderLayerBacking::isPaintDestinationForDescendantLayers): 20 (WebCore::RenderLayerBacking::hasVisibleNonCompositedDescendants): 21 (WebCore::descendantLayerPaintsIntoAncestor): Deleted. 22 * rendering/RenderLayerBacking.h: 23 1 24 2017-03-04 Simon Fraser <simon.fraser@apple.com> 2 25 -
trunk/Source/WebCore/rendering/RenderLayerBacking.cpp
r213429 r213435 1105 1105 updateDrawsContent(isSimpleContainer); 1106 1106 1107 m_graphicsLayer->setContentsVisible(m_owningLayer.hasVisibleContent() || isPaintDestinationForDescendantLayers());1107 m_graphicsLayer->setContentsVisible(m_owningLayer.hasVisibleContent() || hasVisibleNonCompositedDescendants()); 1108 1108 if (m_scrollingLayer) { 1109 1109 m_scrollingLayer->setContentsVisible(renderer().style().visibility() == VISIBLE); … … 1949 1949 } 1950 1950 1951 static bool descendantLayerPaintsIntoAncestor(RenderLayer& parent) 1951 enum class LayerTraversal { Continue, Stop }; 1952 1953 static LayerTraversal traverseVisibleNonCompositedDescendantLayers(RenderLayer& parent, std::function<LayerTraversal (const RenderLayer&)> layerFunc) 1952 1954 { 1953 1955 // FIXME: We shouldn't be called with a stale z-order lists. See bug 85512. … … 1960 1962 if (auto* normalFlowList = parent.normalFlowList()) { 1961 1963 for (auto* childLayer : *normalFlowList) { 1962 if (!compositedWithOwnBackingStore(*childLayer) && (childLayer->isVisuallyNonEmpty() || descendantLayerPaintsIntoAncestor(*childLayer))) 1963 return true; 1964 if (compositedWithOwnBackingStore(*childLayer)) 1965 continue; 1966 1967 if (layerFunc(*childLayer) == LayerTraversal::Stop) 1968 return LayerTraversal::Stop; 1969 1970 if (traverseVisibleNonCompositedDescendantLayers(*childLayer, layerFunc) == LayerTraversal::Stop) 1971 return LayerTraversal::Stop; 1964 1972 } 1965 1973 } … … 1967 1975 if (parent.isStackingContainer()) { 1968 1976 if (!parent.hasVisibleDescendant()) 1969 return false;1977 return LayerTraversal::Continue; 1970 1978 1971 1979 // Use the m_hasCompositingDescendant bit to optimize? 1972 1980 if (auto* negZOrderList = parent.negZOrderList()) { 1973 1981 for (auto* childLayer : *negZOrderList) { 1974 if (!compositedWithOwnBackingStore(*childLayer) && (childLayer->isVisuallyNonEmpty() || descendantLayerPaintsIntoAncestor(*childLayer))) 1975 return true; 1982 if (compositedWithOwnBackingStore(*childLayer)) 1983 continue; 1984 1985 if (layerFunc(*childLayer) == LayerTraversal::Stop) 1986 return LayerTraversal::Stop; 1987 1988 if (traverseVisibleNonCompositedDescendantLayers(*childLayer, layerFunc) == LayerTraversal::Stop) 1989 return LayerTraversal::Stop; 1976 1990 } 1977 1991 } … … 1979 1993 if (auto* posZOrderList = parent.posZOrderList()) { 1980 1994 for (auto* childLayer : *posZOrderList) { 1981 if (!compositedWithOwnBackingStore(*childLayer) && (childLayer->isVisuallyNonEmpty() || descendantLayerPaintsIntoAncestor(*childLayer))) 1982 return true; 1995 if (compositedWithOwnBackingStore(*childLayer)) 1996 continue; 1997 1998 if (layerFunc(*childLayer) == LayerTraversal::Stop) 1999 return LayerTraversal::Stop; 2000 2001 if (traverseVisibleNonCompositedDescendantLayers(*childLayer, layerFunc) == LayerTraversal::Stop) 2002 return LayerTraversal::Stop; 1983 2003 } 1984 2004 } 1985 2005 } 1986 2006 1987 return false;2007 return LayerTraversal::Continue; 1988 2008 } 1989 2009 … … 1991 2011 bool RenderLayerBacking::isPaintDestinationForDescendantLayers() const 1992 2012 { 1993 return descendantLayerPaintsIntoAncestor(m_owningLayer); 2013 bool hasPaintingDescendant = false; 2014 traverseVisibleNonCompositedDescendantLayers(m_owningLayer, [&hasPaintingDescendant](const RenderLayer& layer) { 2015 hasPaintingDescendant = layer.isVisuallyNonEmpty(); 2016 return hasPaintingDescendant ? LayerTraversal::Stop : LayerTraversal::Continue; 2017 }); 2018 2019 return hasPaintingDescendant; 2020 } 2021 2022 bool RenderLayerBacking::hasVisibleNonCompositedDescendants() const 2023 { 2024 bool hasVisibleDescendant = false; 2025 traverseVisibleNonCompositedDescendantLayers(m_owningLayer, [&hasVisibleDescendant](const RenderLayer& layer) { 2026 hasVisibleDescendant = layer.hasVisibleContent(); 2027 return hasVisibleDescendant ? LayerTraversal::Stop : LayerTraversal::Continue; 2028 }); 2029 2030 return hasVisibleDescendant; 1994 2031 } 1995 2032 -
trunk/Source/WebCore/rendering/RenderLayerBacking.h
r213429 r213435 330 330 331 331 bool isPaintDestinationForDescendantLayers() const; 332 bool hasVisibleNonCompositedDescendants() const; 332 333 333 334 bool shouldClipCompositedBounds() const;
Note:
See TracChangeset
for help on using the changeset viewer.