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