Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1096)

Unified Diff: Source/core/inspector/InspectorLayerTreeAgent.cpp

Issue 59063003: Don't coerce pointers to compositor layer mappings to booleans. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Respond to reviewer feedback. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/inspector/InspectorLayerTreeAgent.cpp
diff --git a/Source/core/inspector/InspectorLayerTreeAgent.cpp b/Source/core/inspector/InspectorLayerTreeAgent.cpp
index 1d56a28c3ec98b72066f643086df81a947df14ac..3cbe21efb3222fab65b69e2e5239e5314eac8a61 100644
--- a/Source/core/inspector/InspectorLayerTreeAgent.cpp
+++ b/Source/core/inspector/InspectorLayerTreeAgent.cpp
@@ -152,11 +152,13 @@ void InspectorLayerTreeAgent::layerTreeDidChange()
void InspectorLayerTreeAgent::didPaint(RenderObject* renderer, GraphicsContext*, const LayoutRect& rect)
{
RenderLayer* renderLayer = toRenderLayerModelObject(renderer)->layer();
- CompositedLayerMapping* compositedLayerMapping = renderLayer->compositedLayerMapping();
// Should only happen for FrameView paints when compositing is off. Consider different instrumentation method for that.
- if (!compositedLayerMapping)
+ // Note, that this only gets called with the FrameView's RenderView which, if it is composited, only
caseq 2013/11/13 15:45:20 This statement is not correct, there are two call
+ // paint into its own backing.
shawnsingh 2013/11/12 09:55:50 s/paint/paints/
+ ASSERT(renderLayer->compositingState() == PaintsIntoOwnBacking || renderLayer->compositingState() == NotComposited);
+ if (renderLayer->compositingState() != PaintsIntoOwnBacking)
return;
- GraphicsLayer* graphicsLayer = compositedLayerMapping->mainGraphicsLayer();
+ GraphicsLayer* graphicsLayer = renderLayer->compositedLayerMapping()->mainGraphicsLayer();
RefPtr<TypeBuilder::DOM::Rect> domRect = TypeBuilder::DOM::Rect::create()
.setX(rect.x())
.setY(rect.y())
@@ -179,7 +181,11 @@ PassRefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer> > InspectorLayerTre
void InspectorLayerTreeAgent::buildLayerIdToNodeIdMap(RenderLayer* root, LayerIdToNodeIdMap& layerIdToNodeIdMap)
{
- if (root->compositedLayerMapping()) {
+ // The layer-id to node-id map is used later in buildObjectForLayer to map each graphics
+ // layer back to its corresponding Node. We only want to map a graphics layer to map back
+ // to the Node corresponding to its owning RenderLayer, not some other RenderLayer that
+ // paints into that GraphicsLayer.
+ if (root->compositingState() == PaintsIntoOwnBacking) {
shawnsingh 2013/11/12 09:55:50 Isn't this a scenario where we really only care wh
caseq 2013/11/13 15:45:20 +1 to what Shawn says. Since the mere presence of
Ian Vollick 2013/11/14 04:12:47 Agreed.
if (Node* node = root->renderer()->generatingNode()) {
GraphicsLayer* graphicsLayer = root->compositedLayerMapping()->childForSuperlayers();
layerIdToNodeIdMap.set(graphicsLayer->platformLayer()->id(), idForNode(node));

Powered by Google App Engine
This is Rietveld 408576698