Changeset 260845 in webkit
- Timestamp:
- Apr 28, 2020 2:15:33 PM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r260844 r260845 1 2020-04-28 Simon Fraser <simon.fraser@apple.com> 2 3 Rewrite GraphicsLayerCA::updateSublayerList() 4 https://bugs.webkit.org/show_bug.cgi?id=211137 5 6 Reviewed by Zalan Bujtas. 7 8 This function was hard to understand, with aliasing of a layer list to handle 9 the various configurations. Future patches will add a bit more complexity here. 10 11 Rewrite using lambdas, which makes it easier to follow. 12 13 * platform/graphics/ca/GraphicsLayerCA.cpp: 14 (WebCore::GraphicsLayerCA::updateSublayerList): 15 1 16 2020-04-28 Christopher Reid <chris.reid@sony.com> 2 17 -
trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
r260353 r260845 1972 1972 return; 1973 1973 } 1974 1975 const PlatformCALayerList* customSublayers = m_layer->customSublayers(); 1976 1977 PlatformCALayerList structuralLayerChildren; 1974 1975 auto appendStructuralLayerChildren = [&](PlatformCALayerList& list) { 1976 if (m_backdropLayer) 1977 list.append(m_backdropLayer); 1978 1979 if (m_replicaLayer) 1980 list.append(downcast<GraphicsLayerCA>(*m_replicaLayer).primaryLayer()); 1981 1982 list.append(m_layer); 1983 }; 1984 1985 auto appendClippingLayers = [&](PlatformCALayerList& list) { 1986 if (!m_contentsVisible) 1987 return; 1988 1989 if (m_contentsClippingLayer) { 1990 list.append(m_contentsClippingLayer); 1991 return; 1992 } 1993 1994 if (m_contentsLayer) 1995 list.append(m_contentsLayer); 1996 }; 1997 1998 auto appendCustomAndClippingLayers = [&](PlatformCALayerList& list) { 1999 if (auto* customSublayers = m_layer->customSublayers()) 2000 list.appendVector(*customSublayers); 2001 2002 appendClippingLayers(list); 2003 }; 2004 2005 auto appendLayersFromChildren = [&](PlatformCALayerList& list) { 2006 for (const auto& layer : children()) { 2007 const auto& currentChild = downcast<GraphicsLayerCA>(layer.get()); 2008 PlatformCALayer* childLayer = currentChild.layerForSuperlayer(); 2009 list.append(childLayer); 2010 } 2011 }; 2012 2013 auto appendDebugLayers = [&](PlatformCALayerList& list) { 2014 #ifdef VISIBLE_TILE_WASH 2015 if (m_visibleTileWashLayer) 2016 list.append(m_visibleTileWashLayer); 2017 #else 2018 UNUSED_PARAM(list); 2019 #endif 2020 }; 2021 1978 2022 PlatformCALayerList primaryLayerChildren; 1979 1980 PlatformCALayerList& childListForSublayers = m_structuralLayer ? structuralLayerChildren : primaryLayerChildren; 1981 1982 if (customSublayers) 1983 primaryLayerChildren.appendVector(*customSublayers); 2023 appendCustomAndClippingLayers(primaryLayerChildren); 1984 2024 1985 2025 if (m_structuralLayer) { 1986 if (m_backdropLayer) 1987 structuralLayerChildren.append(m_backdropLayer); 1988 1989 if (m_replicaLayer) 1990 structuralLayerChildren.append(downcast<GraphicsLayerCA>(*m_replicaLayer).primaryLayer()); 1991 1992 structuralLayerChildren.append(m_layer); 1993 } 1994 1995 if (m_contentsLayer && m_contentsVisible) { 1996 // FIXME: add the contents layer in the correct order with negative z-order children. 1997 // This does not cause visible rendering issues because currently contents layers are only used 1998 // for replaced elements that don't have children. 1999 primaryLayerChildren.append(m_contentsClippingLayer ? m_contentsClippingLayer : m_contentsLayer); 2000 } 2001 2002 for (const auto& layer : children()) { 2003 const auto& currentChild = downcast<GraphicsLayerCA>(layer.get()); 2004 PlatformCALayer* childLayer = currentChild.layerForSuperlayer(); 2005 childListForSublayers.append(childLayer); 2006 } 2007 2008 #ifdef VISIBLE_TILE_WASH 2009 if (m_visibleTileWashLayer) 2010 childListForSublayers.append(m_visibleTileWashLayer); 2011 #endif 2012 2013 if (m_structuralLayer) 2014 m_structuralLayer->setSublayers(structuralLayerChildren); 2015 2026 PlatformCALayerList layerList; 2027 appendStructuralLayerChildren(layerList); 2028 appendLayersFromChildren(layerList); 2029 appendDebugLayers(layerList); 2030 m_structuralLayer->setSublayers(layerList); 2031 } else { 2032 appendLayersFromChildren(primaryLayerChildren); 2033 appendDebugLayers(primaryLayerChildren); 2034 } 2035 2016 2036 m_layer->setSublayers(primaryLayerChildren); 2017 2037 }
Note: See TracChangeset
for help on using the changeset viewer.