| 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     ASSERT(enclosingLayer->enclosingCompositingLayer()); | 
|  200     GraphicsLayer* enclosingGraphicsLayer = enclosingLayer->enclosingCompositing
     Layer()->compositedLayerMapping()->childForSuperlayers(); |  203     GraphicsLayer* enclosingGraphicsLayer = enclosingLayer->enclosingCompositing
     Layer()->compositedLayerMapping()->childForSuperlayers(); | 
|  201     buildLayerIdToNodeIdMap(errorString, enclosingLayer, layerIdToNodeIdMap); |  204     buildLayerIdToNodeIdMap(errorString, enclosingLayer, layerIdToNodeIdMap); | 
|  202     gatherGraphicsLayers(enclosingGraphicsLayer, layerIdToNodeIdMap, layers); |  205     gatherGraphicsLayers(enclosingGraphicsLayer, layerIdToNodeIdMap, layers); | 
|  203 } |  206 } | 
|  204  |  207  | 
|  205 void InspectorLayerTreeAgent::buildLayerIdToNodeIdMap(ErrorString* errorString, 
     RenderLayer* root, LayerIdToNodeIdMap& layerIdToNodeIdMap) |  208 void InspectorLayerTreeAgent::buildLayerIdToNodeIdMap(ErrorString* errorString, 
     RenderLayer* root, LayerIdToNodeIdMap& layerIdToNodeIdMap) | 
|  206 { |  209 { | 
|  207     if (root->compositedLayerMapping()) { |  210     if (root->compositedLayerMapping()) { | 
|  208         if (Node* node = root->renderer()->generatingNode()) { |  211         if (Node* node = root->renderer()->generatingNode()) { | 
|  209             GraphicsLayer* graphicsLayer = root->compositedLayerMapping()->child
     ForSuperlayers(); |  212             GraphicsLayer* graphicsLayer = root->compositedLayerMapping()->child
     ForSuperlayers(); | 
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  324             continue; |  327             continue; | 
|  325         reasonStrings->addItem(compositingReasonNames[i].protocolName); |  328         reasonStrings->addItem(compositingReasonNames[i].protocolName); | 
|  326 #ifndef _NDEBUG |  329 #ifndef _NDEBUG | 
|  327         reasonsBitmask &= ~compositingReasonNames[i].mask; |  330         reasonsBitmask &= ~compositingReasonNames[i].mask; | 
|  328 #endif |  331 #endif | 
|  329     } |  332     } | 
|  330     ASSERT(!reasonsBitmask); |  333     ASSERT(!reasonsBitmask); | 
|  331 } |  334 } | 
|  332  |  335  | 
|  333 } // namespace WebCore |  336 } // namespace WebCore | 
| OLD | NEW |