| 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 // Should only happen for FrameView paints when compositing is off. Consider
different instrumentation method for that. |
| 156 if (!renderLayer->hasCompositedLayerMapping()) |
| 157 return; |
| 155 CompositedLayerMapping* compositedLayerMapping = renderLayer->compositedLaye
rMapping(); | 158 CompositedLayerMapping* compositedLayerMapping = renderLayer->compositedLaye
rMapping(); |
| 156 // Should only happen for FrameView paints when compositing is off. Consider
different instrumentation method for that. | |
| 157 if (!compositedLayerMapping) | |
| 158 return; | |
| 159 GraphicsLayer* graphicsLayer = compositedLayerMapping->mainGraphicsLayer(); | 159 GraphicsLayer* graphicsLayer = compositedLayerMapping->mainGraphicsLayer(); |
| 160 RefPtr<TypeBuilder::DOM::Rect> domRect = TypeBuilder::DOM::Rect::create() | 160 RefPtr<TypeBuilder::DOM::Rect> domRect = TypeBuilder::DOM::Rect::create() |
| 161 .setX(rect.x()) | 161 .setX(rect.x()) |
| 162 .setY(rect.y()) | 162 .setY(rect.y()) |
| 163 .setWidth(rect.width()) | 163 .setWidth(rect.width()) |
| 164 .setHeight(rect.height()); | 164 .setHeight(rect.height()); |
| 165 m_frontend->layerPainted(idForLayer(graphicsLayer), domRect.release()); | 165 m_frontend->layerPainted(idForLayer(graphicsLayer), domRect.release()); |
| 166 } | 166 } |
| 167 | 167 |
| 168 PassRefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer> > InspectorLayerTre
eAgent::buildLayerTree() | 168 PassRefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer> > InspectorLayerTre
eAgent::buildLayerTree() |
| 169 { | 169 { |
| 170 RenderLayerCompositor* compositor = renderLayerCompositor(); | 170 RenderLayerCompositor* compositor = renderLayerCompositor(); |
| 171 if (!compositor || !compositor->inCompositingMode()) | 171 if (!compositor || !compositor->inCompositingMode()) |
| 172 return 0; | 172 return 0; |
| 173 LayerIdToNodeIdMap layerIdToNodeIdMap; | 173 LayerIdToNodeIdMap layerIdToNodeIdMap; |
| 174 RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer> > layers = TypeBuil
der::Array<TypeBuilder::LayerTree::Layer>::create(); | 174 RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer> > layers = TypeBuil
der::Array<TypeBuilder::LayerTree::Layer>::create(); |
| 175 buildLayerIdToNodeIdMap(compositor->rootRenderLayer(), layerIdToNodeIdMap); | 175 buildLayerIdToNodeIdMap(compositor->rootRenderLayer(), layerIdToNodeIdMap); |
| 176 gatherGraphicsLayers(compositor->rootGraphicsLayer(), layerIdToNodeIdMap, la
yers); | 176 gatherGraphicsLayers(compositor->rootGraphicsLayer(), layerIdToNodeIdMap, la
yers); |
| 177 return layers.release(); | 177 return layers.release(); |
| 178 } | 178 } |
| 179 | 179 |
| 180 void InspectorLayerTreeAgent::buildLayerIdToNodeIdMap(RenderLayer* root, LayerId
ToNodeIdMap& layerIdToNodeIdMap) | 180 void InspectorLayerTreeAgent::buildLayerIdToNodeIdMap(RenderLayer* root, LayerId
ToNodeIdMap& layerIdToNodeIdMap) |
| 181 { | 181 { |
| 182 if (root->compositedLayerMapping()) { | 182 if (root->hasCompositedLayerMapping()) { |
| 183 if (Node* node = root->renderer()->generatingNode()) { | 183 if (Node* node = root->renderer()->generatingNode()) { |
| 184 GraphicsLayer* graphicsLayer = root->compositedLayerMapping()->child
ForSuperlayers(); | 184 GraphicsLayer* graphicsLayer = root->compositedLayerMapping()->child
ForSuperlayers(); |
| 185 layerIdToNodeIdMap.set(graphicsLayer->platformLayer()->id(), idForNo
de(node)); | 185 layerIdToNodeIdMap.set(graphicsLayer->platformLayer()->id(), idForNo
de(node)); |
| 186 } | 186 } |
| 187 } | 187 } |
| 188 for (RenderLayer* child = root->firstChild(); child; child = child->nextSibl
ing()) | 188 for (RenderLayer* child = root->firstChild(); child; child = child->nextSibl
ing()) |
| 189 buildLayerIdToNodeIdMap(child, layerIdToNodeIdMap); | 189 buildLayerIdToNodeIdMap(child, layerIdToNodeIdMap); |
| 190 if (!root->renderer()->isRenderIFrame()) | 190 if (!root->renderer()->isRenderIFrame()) |
| 191 return; | 191 return; |
| 192 FrameView* childFrameView = toFrameView(toRenderWidget(root->renderer())->wi
dget()); | 192 FrameView* childFrameView = toFrameView(toRenderWidget(root->renderer())->wi
dget()); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 continue; | 298 continue; |
| 299 reasonStrings->addItem(compositingReasonNames[i].protocolName); | 299 reasonStrings->addItem(compositingReasonNames[i].protocolName); |
| 300 #ifndef _NDEBUG | 300 #ifndef _NDEBUG |
| 301 reasonsBitmask &= ~compositingReasonNames[i].mask; | 301 reasonsBitmask &= ~compositingReasonNames[i].mask; |
| 302 #endif | 302 #endif |
| 303 } | 303 } |
| 304 ASSERT(!reasonsBitmask); | 304 ASSERT(!reasonsBitmask); |
| 305 } | 305 } |
| 306 | 306 |
| 307 } // namespace WebCore | 307 } // namespace WebCore |
| OLD | NEW |