Title: [260845] trunk/Source/WebCore
- Revision
- 260845
- Author
- [email protected]
- Date
- 2020-04-28 14:15:33 -0700 (Tue, 28 Apr 2020)
Log Message
Rewrite GraphicsLayerCA::updateSublayerList()
https://bugs.webkit.org/show_bug.cgi?id=211137
Reviewed by Zalan Bujtas.
This function was hard to understand, with aliasing of a layer list to handle
the various configurations. Future patches will add a bit more complexity here.
Rewrite using lambdas, which makes it easier to follow.
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::updateSublayerList):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (260844 => 260845)
--- trunk/Source/WebCore/ChangeLog 2020-04-28 20:59:00 UTC (rev 260844)
+++ trunk/Source/WebCore/ChangeLog 2020-04-28 21:15:33 UTC (rev 260845)
@@ -1,3 +1,18 @@
+2020-04-28 Simon Fraser <[email protected]>
+
+ Rewrite GraphicsLayerCA::updateSublayerList()
+ https://bugs.webkit.org/show_bug.cgi?id=211137
+
+ Reviewed by Zalan Bujtas.
+
+ This function was hard to understand, with aliasing of a layer list to handle
+ the various configurations. Future patches will add a bit more complexity here.
+
+ Rewrite using lambdas, which makes it easier to follow.
+
+ * platform/graphics/ca/GraphicsLayerCA.cpp:
+ (WebCore::GraphicsLayerCA::updateSublayerList):
+
2020-04-28 Christopher Reid <[email protected]>
[Win] Bundle Inspector Resources in Release builds
Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (260844 => 260845)
--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2020-04-28 20:59:00 UTC (rev 260844)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2020-04-28 21:15:33 UTC (rev 260845)
@@ -1971,48 +1971,68 @@
m_layer->setSublayers(PlatformCALayerList());
return;
}
+
+ auto appendStructuralLayerChildren = [&](PlatformCALayerList& list) {
+ if (m_backdropLayer)
+ list.append(m_backdropLayer);
+
+ if (m_replicaLayer)
+ list.append(downcast<GraphicsLayerCA>(*m_replicaLayer).primaryLayer());
- const PlatformCALayerList* customSublayers = m_layer->customSublayers();
+ list.append(m_layer);
+ };
- PlatformCALayerList structuralLayerChildren;
- PlatformCALayerList primaryLayerChildren;
+ auto appendClippingLayers = [&](PlatformCALayerList& list) {
+ if (!m_contentsVisible)
+ return;
- PlatformCALayerList& childListForSublayers = m_structuralLayer ? structuralLayerChildren : primaryLayerChildren;
+ if (m_contentsClippingLayer) {
+ list.append(m_contentsClippingLayer);
+ return;
+ }
- if (customSublayers)
- primaryLayerChildren.appendVector(*customSublayers);
+ if (m_contentsLayer)
+ list.append(m_contentsLayer);
+ };
- if (m_structuralLayer) {
- if (m_backdropLayer)
- structuralLayerChildren.append(m_backdropLayer);
+ auto appendCustomAndClippingLayers = [&](PlatformCALayerList& list) {
+ if (auto* customSublayers = m_layer->customSublayers())
+ list.appendVector(*customSublayers);
- if (m_replicaLayer)
- structuralLayerChildren.append(downcast<GraphicsLayerCA>(*m_replicaLayer).primaryLayer());
-
- structuralLayerChildren.append(m_layer);
- }
+ appendClippingLayers(list);
+ };
- if (m_contentsLayer && m_contentsVisible) {
- // FIXME: add the contents layer in the correct order with negative z-order children.
- // This does not cause visible rendering issues because currently contents layers are only used
- // for replaced elements that don't have children.
- primaryLayerChildren.append(m_contentsClippingLayer ? m_contentsClippingLayer : m_contentsLayer);
- }
-
- for (const auto& layer : children()) {
- const auto& currentChild = downcast<GraphicsLayerCA>(layer.get());
- PlatformCALayer* childLayer = currentChild.layerForSuperlayer();
- childListForSublayers.append(childLayer);
- }
+ auto appendLayersFromChildren = [&](PlatformCALayerList& list) {
+ for (const auto& layer : children()) {
+ const auto& currentChild = downcast<GraphicsLayerCA>(layer.get());
+ PlatformCALayer* childLayer = currentChild.layerForSuperlayer();
+ list.append(childLayer);
+ }
+ };
+ auto appendDebugLayers = [&](PlatformCALayerList& list) {
#ifdef VISIBLE_TILE_WASH
- if (m_visibleTileWashLayer)
- childListForSublayers.append(m_visibleTileWashLayer);
+ if (m_visibleTileWashLayer)
+ list.append(m_visibleTileWashLayer);
+#else
+ UNUSED_PARAM(list);
#endif
+ };
- if (m_structuralLayer)
- m_structuralLayer->setSublayers(structuralLayerChildren);
-
+ PlatformCALayerList primaryLayerChildren;
+ appendCustomAndClippingLayers(primaryLayerChildren);
+
+ if (m_structuralLayer) {
+ PlatformCALayerList layerList;
+ appendStructuralLayerChildren(layerList);
+ appendLayersFromChildren(layerList);
+ appendDebugLayers(layerList);
+ m_structuralLayer->setSublayers(layerList);
+ } else {
+ appendLayersFromChildren(primaryLayerChildren);
+ appendDebugLayers(primaryLayerChildren);
+ }
+
m_layer->setSublayers(primaryLayerChildren);
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes