| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 transformArray->addItem(flattenedMatrix[i]); | 103 transformArray->addItem(flattenedMatrix[i]); |
| 104 layerObject->setTransform(transformArray); | 104 layerObject->setTransform(transformArray); |
| 105 const FloatPoint3D& anchor = graphicsLayer->anchorPoint(); | 105 const FloatPoint3D& anchor = graphicsLayer->anchorPoint(); |
| 106 layerObject->setAnchorX(anchor.x()); | 106 layerObject->setAnchorX(anchor.x()); |
| 107 layerObject->setAnchorY(anchor.y()); | 107 layerObject->setAnchorY(anchor.y()); |
| 108 layerObject->setAnchorZ(anchor.z()); | 108 layerObject->setAnchorZ(anchor.z()); |
| 109 } | 109 } |
| 110 return layerObject; | 110 return layerObject; |
| 111 } | 111 } |
| 112 | 112 |
| 113 void gatherGraphicsLayers(GraphicsLayer* root, HashMap<int, int>& layerIdToNodeI
dMap, RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer> >& layers) | |
| 114 { | |
| 115 int layerId = root->platformLayer()->id(); | |
| 116 layers->addItem(buildObjectForLayer(root, layerIdToNodeIdMap.get(layerId))); | |
| 117 if (GraphicsLayer* replica = root->replicaLayer()) | |
| 118 gatherGraphicsLayers(replica, layerIdToNodeIdMap, layers); | |
| 119 for (size_t i = 0, size = root->children().size(); i < size; ++i) | |
| 120 gatherGraphicsLayers(root->children()[i], layerIdToNodeIdMap, layers); | |
| 121 } | |
| 122 | |
| 123 InspectorLayerTreeAgent::InspectorLayerTreeAgent(InspectorDOMAgent* domAgent, Pa
ge* page) | 113 InspectorLayerTreeAgent::InspectorLayerTreeAgent(InspectorDOMAgent* domAgent, Pa
ge* page) |
| 124 : InspectorBaseAgent<InspectorLayerTreeAgent>("LayerTree") | 114 : InspectorBaseAgent<InspectorLayerTreeAgent>("LayerTree") |
| 125 , m_frontend(0) | 115 , m_frontend(0) |
| 126 , m_page(page) | 116 , m_page(page) |
| 127 , m_domAgent(domAgent) | 117 , m_domAgent(domAgent) |
| 128 { | 118 { |
| 129 } | 119 } |
| 130 | 120 |
| 131 InspectorLayerTreeAgent::~InspectorLayerTreeAgent() | 121 InspectorLayerTreeAgent::~InspectorLayerTreeAgent() |
| 132 { | 122 { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 buildLayerIdToNodeIdMap(child, layerIdToNodeIdMap); | 195 buildLayerIdToNodeIdMap(child, layerIdToNodeIdMap); |
| 206 if (!root->renderer()->isRenderIFrame()) | 196 if (!root->renderer()->isRenderIFrame()) |
| 207 return; | 197 return; |
| 208 FrameView* childFrameView = toFrameView(toRenderWidget(root->renderer())->wi
dget()); | 198 FrameView* childFrameView = toFrameView(toRenderWidget(root->renderer())->wi
dget()); |
| 209 if (RenderView* childRenderView = childFrameView->renderView()) { | 199 if (RenderView* childRenderView = childFrameView->renderView()) { |
| 210 if (RenderLayerCompositor* childCompositor = childRenderView->compositor
()) | 200 if (RenderLayerCompositor* childCompositor = childRenderView->compositor
()) |
| 211 buildLayerIdToNodeIdMap(childCompositor->rootRenderLayer(), layerIdT
oNodeIdMap); | 201 buildLayerIdToNodeIdMap(childCompositor->rootRenderLayer(), layerIdT
oNodeIdMap); |
| 212 } | 202 } |
| 213 } | 203 } |
| 214 | 204 |
| 205 void InspectorLayerTreeAgent::gatherGraphicsLayers(GraphicsLayer* root, HashMap<
int, int>& layerIdToNodeIdMap, RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree:
:Layer> >& layers) |
| 206 { |
| 207 int layerId = root->platformLayer()->id(); |
| 208 if (m_pageOverlayLayerIds.find(layerId) != WTF::kNotFound) |
| 209 return; |
| 210 layers->addItem(buildObjectForLayer(root, layerIdToNodeIdMap.get(layerId))); |
| 211 if (GraphicsLayer* replica = root->replicaLayer()) |
| 212 gatherGraphicsLayers(replica, layerIdToNodeIdMap, layers); |
| 213 for (size_t i = 0, size = root->children().size(); i < size; ++i) |
| 214 gatherGraphicsLayers(root->children()[i], layerIdToNodeIdMap, layers); |
| 215 } |
| 216 |
| 215 int InspectorLayerTreeAgent::idForNode(Node* node) | 217 int InspectorLayerTreeAgent::idForNode(Node* node) |
| 216 { | 218 { |
| 217 int nodeId = m_domAgent->boundNodeId(node); | 219 int nodeId = m_domAgent->boundNodeId(node); |
| 218 if (!nodeId) { | 220 if (!nodeId) { |
| 219 ErrorString ignoredError; | 221 ErrorString ignoredError; |
| 220 nodeId = m_domAgent->pushNodeToFrontend(&ignoredError, m_domAgent->bound
NodeId(&node->document()), node); | 222 nodeId = m_domAgent->pushNodeToFrontend(&ignoredError, m_domAgent->bound
NodeId(&node->document()), node); |
| 221 } | 223 } |
| 222 return nodeId; | 224 return nodeId; |
| 223 } | 225 } |
| 224 | 226 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 outTimings = TypeBuilder::Array<TypeBuilder::Array<double> >::create(); | 379 outTimings = TypeBuilder::Array<TypeBuilder::Array<double> >::create(); |
| 378 for (size_t i = 0; i < timings->size(); ++i) { | 380 for (size_t i = 0; i < timings->size(); ++i) { |
| 379 const Vector<double>& row = (*timings)[i]; | 381 const Vector<double>& row = (*timings)[i]; |
| 380 RefPtr<TypeBuilder::Array<double> > outRow = TypeBuilder::Array<double>:
:create(); | 382 RefPtr<TypeBuilder::Array<double> > outRow = TypeBuilder::Array<double>:
:create(); |
| 381 for (size_t j = 1; j < row.size(); ++j) | 383 for (size_t j = 1; j < row.size(); ++j) |
| 382 outRow->addItem(row[j] - row[j - 1]); | 384 outRow->addItem(row[j] - row[j - 1]); |
| 383 outTimings->addItem(outRow.release()); | 385 outTimings->addItem(outRow.release()); |
| 384 } | 386 } |
| 385 } | 387 } |
| 386 | 388 |
| 389 void InspectorLayerTreeAgent::willAddPageOverlay(const GraphicsLayer* layer) |
| 390 { |
| 391 m_pageOverlayLayerIds.append(layer->platformLayer()->id()); |
| 392 } |
| 393 |
| 394 void InspectorLayerTreeAgent::didRemovePageOverlay(const GraphicsLayer* layer) |
| 395 { |
| 396 size_t index = m_pageOverlayLayerIds.find(layer->platformLayer()->id()); |
| 397 if (index == WTF::kNotFound) |
| 398 return; |
| 399 m_pageOverlayLayerIds.remove(index); |
| 400 } |
| 401 |
| 402 |
| 387 } // namespace WebCore | 403 } // namespace WebCore |
| OLD | NEW |