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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 174 void InspectorLayerTreeAgent::getLayers(ErrorString* errorString, const int* nod eId, RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer> >& layers) | 174 void InspectorLayerTreeAgent::getLayers(ErrorString* errorString, const int* nod eId, RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer> >& layers) |
| 175 { | 175 { |
| 176 LayerIdToNodeIdMap layerIdToNodeIdMap; | 176 LayerIdToNodeIdMap layerIdToNodeIdMap; |
| 177 layers = TypeBuilder::Array<TypeBuilder::LayerTree::Layer>::create(); | 177 layers = TypeBuilder::Array<TypeBuilder::LayerTree::Layer>::create(); |
| 178 | 178 |
| 179 RenderLayerCompositor* compositor = renderLayerCompositor(); | 179 RenderLayerCompositor* compositor = renderLayerCompositor(); |
| 180 if (!compositor || !compositor->inCompositingMode()) { | 180 if (!compositor || !compositor->inCompositingMode()) { |
| 181 *errorString = "Not in the compositing mode"; | 181 *errorString = "Not in the compositing mode"; |
| 182 return; | 182 return; |
| 183 } | 183 } |
| 184 // FIXME: when inspector layer access is made asynchronous, this will probab ly need to be changed. | |
| 185 compositor->updateCompositingLayers(CompositingUpdateFinishAllDeferredWork); | |
| 184 if (!nodeId) { | 186 if (!nodeId) { |
| 185 buildLayerIdToNodeIdMap(errorString, compositor->rootRenderLayer(), laye rIdToNodeIdMap); | 187 buildLayerIdToNodeIdMap(errorString, compositor->rootRenderLayer(), laye rIdToNodeIdMap); |
| 186 gatherGraphicsLayers(compositor->rootGraphicsLayer(), layerIdToNodeIdMap , layers); | 188 gatherGraphicsLayers(compositor->rootGraphicsLayer(), layerIdToNodeIdMap , layers); |
| 187 return; | 189 return; |
| 188 } | 190 } |
| 189 Node* node = m_instrumentingAgents->inspectorDOMAgent()->nodeForId(*nodeId); | 191 Node* node = m_instrumentingAgents->inspectorDOMAgent()->nodeForId(*nodeId); |
| 190 if (!node) { | 192 if (!node) { |
| 191 *errorString = "Provided node id doesn't match any known node"; | 193 *errorString = "Provided node id doesn't match any known node"; |
| 192 return; | 194 return; |
| 193 } | 195 } |
| 194 RenderObject* renderer = node->renderer(); | 196 RenderObject* renderer = node->renderer(); |
| 195 if (!renderer) { | 197 if (!renderer) { |
| 196 *errorString = "Node for provided node id doesn't have a renderer"; | 198 *errorString = "Node for provided node id doesn't have a renderer"; |
| 197 return; | 199 return; |
| 198 } | 200 } |
| 199 RenderLayer* enclosingLayer = renderer->enclosingLayer(); | 201 RenderLayer* enclosingLayer = renderer->enclosingLayer(); |
| 202 if (!enclosingLayer->enclosingCompositingLayer() || !enclosingLayer->enclosi ngCompositingLayer()->compositedLayerMapping()) { | |
|
caseq
2013/10/18 05:39:56
I think this is never supposed to be true now that
| |
| 203 *errorString = "No CompositedLayerMapping for the provided node"; | |
| 204 return; | |
| 205 } | |
| 200 GraphicsLayer* enclosingGraphicsLayer = enclosingLayer->enclosingCompositing Layer()->compositedLayerMapping()->childForSuperlayers(); | 206 GraphicsLayer* enclosingGraphicsLayer = enclosingLayer->enclosingCompositing Layer()->compositedLayerMapping()->childForSuperlayers(); |
| 201 buildLayerIdToNodeIdMap(errorString, enclosingLayer, layerIdToNodeIdMap); | 207 buildLayerIdToNodeIdMap(errorString, enclosingLayer, layerIdToNodeIdMap); |
| 202 gatherGraphicsLayers(enclosingGraphicsLayer, layerIdToNodeIdMap, layers); | 208 gatherGraphicsLayers(enclosingGraphicsLayer, layerIdToNodeIdMap, layers); |
| 203 } | 209 } |
| 204 | 210 |
| 205 void InspectorLayerTreeAgent::buildLayerIdToNodeIdMap(ErrorString* errorString, RenderLayer* root, LayerIdToNodeIdMap& layerIdToNodeIdMap) | 211 void InspectorLayerTreeAgent::buildLayerIdToNodeIdMap(ErrorString* errorString, RenderLayer* root, LayerIdToNodeIdMap& layerIdToNodeIdMap) |
| 206 { | 212 { |
| 207 if (root->compositedLayerMapping()) { | 213 if (root->compositedLayerMapping()) { |
| 208 if (Node* node = root->renderer()->generatingNode()) { | 214 if (Node* node = root->renderer()->generatingNode()) { |
| 209 GraphicsLayer* graphicsLayer = root->compositedLayerMapping()->child ForSuperlayers(); | 215 GraphicsLayer* graphicsLayer = root->compositedLayerMapping()->child ForSuperlayers(); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 324 continue; | 330 continue; |
| 325 reasonStrings->addItem(compositingReasonNames[i].protocolName); | 331 reasonStrings->addItem(compositingReasonNames[i].protocolName); |
| 326 #ifndef _NDEBUG | 332 #ifndef _NDEBUG |
| 327 reasonsBitmask &= ~compositingReasonNames[i].mask; | 333 reasonsBitmask &= ~compositingReasonNames[i].mask; |
| 328 #endif | 334 #endif |
| 329 } | 335 } |
| 330 ASSERT(!reasonsBitmask); | 336 ASSERT(!reasonsBitmask); |
| 331 } | 337 } |
| 332 | 338 |
| 333 } // namespace WebCore | 339 } // namespace WebCore |
| OLD | NEW |