Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 145 } | 145 } |
| 146 | 146 |
| 147 void InspectorLayerTreeAgent::layerTreeDidChange() | 147 void InspectorLayerTreeAgent::layerTreeDidChange() |
| 148 { | 148 { |
| 149 m_frontend->layerTreeDidChange(buildLayerTree()); | 149 m_frontend->layerTreeDidChange(buildLayerTree()); |
| 150 } | 150 } |
| 151 | 151 |
| 152 void InspectorLayerTreeAgent::didPaint(RenderObject* renderer, GraphicsContext*, const LayoutRect& rect) | 152 void InspectorLayerTreeAgent::didPaint(RenderObject* renderer, GraphicsContext*, const LayoutRect& rect) |
| 153 { | 153 { |
| 154 RenderLayer* renderLayer = toRenderLayerModelObject(renderer)->layer(); | 154 RenderLayer* renderLayer = toRenderLayerModelObject(renderer)->layer(); |
| 155 CompositedLayerMapping* compositedLayerMapping = renderLayer->compositedLaye rMapping(); | |
| 156 // Should only happen for FrameView paints when compositing is off. Consider different instrumentation method for that. | 155 // Should only happen for FrameView paints when compositing is off. Consider different instrumentation method for that. |
| 157 if (!compositedLayerMapping) | 156 // Note, that this only gets called with the FrameView's RenderView which, i f it is composited, only |
|
caseq
2013/11/13 15:45:20
This statement is not correct, there are two call
| |
| 157 // paint into its own backing. | |
|
shawnsingh
2013/11/12 09:55:50
s/paint/paints/
| |
| 158 ASSERT(renderLayer->compositingState() == PaintsIntoOwnBacking || renderLaye r->compositingState() == NotComposited); | |
| 159 if (renderLayer->compositingState() != PaintsIntoOwnBacking) | |
| 158 return; | 160 return; |
| 159 GraphicsLayer* graphicsLayer = compositedLayerMapping->mainGraphicsLayer(); | 161 GraphicsLayer* graphicsLayer = renderLayer->compositedLayerMapping()->mainGr aphicsLayer(); |
| 160 RefPtr<TypeBuilder::DOM::Rect> domRect = TypeBuilder::DOM::Rect::create() | 162 RefPtr<TypeBuilder::DOM::Rect> domRect = TypeBuilder::DOM::Rect::create() |
| 161 .setX(rect.x()) | 163 .setX(rect.x()) |
| 162 .setY(rect.y()) | 164 .setY(rect.y()) |
| 163 .setWidth(rect.width()) | 165 .setWidth(rect.width()) |
| 164 .setHeight(rect.height()); | 166 .setHeight(rect.height()); |
| 165 m_frontend->layerPainted(idForLayer(graphicsLayer), domRect.release()); | 167 m_frontend->layerPainted(idForLayer(graphicsLayer), domRect.release()); |
| 166 } | 168 } |
| 167 | 169 |
| 168 PassRefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer> > InspectorLayerTre eAgent::buildLayerTree() | 170 PassRefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer> > InspectorLayerTre eAgent::buildLayerTree() |
| 169 { | 171 { |
| 170 RenderLayerCompositor* compositor = renderLayerCompositor(); | 172 RenderLayerCompositor* compositor = renderLayerCompositor(); |
| 171 if (!compositor || !compositor->inCompositingMode()) | 173 if (!compositor || !compositor->inCompositingMode()) |
| 172 return 0; | 174 return 0; |
| 173 LayerIdToNodeIdMap layerIdToNodeIdMap; | 175 LayerIdToNodeIdMap layerIdToNodeIdMap; |
| 174 RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer> > layers = TypeBuil der::Array<TypeBuilder::LayerTree::Layer>::create(); | 176 RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer> > layers = TypeBuil der::Array<TypeBuilder::LayerTree::Layer>::create(); |
| 175 buildLayerIdToNodeIdMap(compositor->rootRenderLayer(), layerIdToNodeIdMap); | 177 buildLayerIdToNodeIdMap(compositor->rootRenderLayer(), layerIdToNodeIdMap); |
| 176 gatherGraphicsLayers(compositor->rootGraphicsLayer(), layerIdToNodeIdMap, la yers); | 178 gatherGraphicsLayers(compositor->rootGraphicsLayer(), layerIdToNodeIdMap, la yers); |
| 177 return layers.release(); | 179 return layers.release(); |
| 178 } | 180 } |
| 179 | 181 |
| 180 void InspectorLayerTreeAgent::buildLayerIdToNodeIdMap(RenderLayer* root, LayerId ToNodeIdMap& layerIdToNodeIdMap) | 182 void InspectorLayerTreeAgent::buildLayerIdToNodeIdMap(RenderLayer* root, LayerId ToNodeIdMap& layerIdToNodeIdMap) |
| 181 { | 183 { |
| 182 if (root->compositedLayerMapping()) { | 184 // The layer-id to node-id map is used later in buildObjectForLayer to map e ach graphics |
| 185 // layer back to its corresponding Node. We only want to map a graphics laye r to map back | |
| 186 // to the Node corresponding to its owning RenderLayer, not some other Rende rLayer that | |
| 187 // paints into that GraphicsLayer. | |
| 188 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.
| |
| 183 if (Node* node = root->renderer()->generatingNode()) { | 189 if (Node* node = root->renderer()->generatingNode()) { |
| 184 GraphicsLayer* graphicsLayer = root->compositedLayerMapping()->child ForSuperlayers(); | 190 GraphicsLayer* graphicsLayer = root->compositedLayerMapping()->child ForSuperlayers(); |
| 185 layerIdToNodeIdMap.set(graphicsLayer->platformLayer()->id(), idForNo de(node)); | 191 layerIdToNodeIdMap.set(graphicsLayer->platformLayer()->id(), idForNo de(node)); |
| 186 } | 192 } |
| 187 } | 193 } |
| 188 for (RenderLayer* child = root->firstChild(); child; child = child->nextSibl ing()) | 194 for (RenderLayer* child = root->firstChild(); child; child = child->nextSibl ing()) |
| 189 buildLayerIdToNodeIdMap(child, layerIdToNodeIdMap); | 195 buildLayerIdToNodeIdMap(child, layerIdToNodeIdMap); |
| 190 if (!root->renderer()->isRenderIFrame()) | 196 if (!root->renderer()->isRenderIFrame()) |
| 191 return; | 197 return; |
| 192 FrameView* childFrameView = toFrameView(toRenderWidget(root->renderer())->wi dget()); | 198 FrameView* childFrameView = toFrameView(toRenderWidget(root->renderer())->wi dget()); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 298 continue; | 304 continue; |
| 299 reasonStrings->addItem(compositingReasonNames[i].protocolName); | 305 reasonStrings->addItem(compositingReasonNames[i].protocolName); |
| 300 #ifndef _NDEBUG | 306 #ifndef _NDEBUG |
| 301 reasonsBitmask &= ~compositingReasonNames[i].mask; | 307 reasonsBitmask &= ~compositingReasonNames[i].mask; |
| 302 #endif | 308 #endif |
| 303 } | 309 } |
| 304 ASSERT(!reasonsBitmask); | 310 ASSERT(!reasonsBitmask); |
| 305 } | 311 } |
| 306 | 312 |
| 307 } // namespace WebCore | 313 } // namespace WebCore |
| OLD | NEW |