| 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 21 matching lines...) Expand all Loading... |
| 32 #include "config.h" | 32 #include "config.h" |
| 33 | 33 |
| 34 #include "core/inspector/InspectorLayerTreeAgent.h" | 34 #include "core/inspector/InspectorLayerTreeAgent.h" |
| 35 | 35 |
| 36 #include "core/dom/DOMNodeIds.h" | 36 #include "core/dom/DOMNodeIds.h" |
| 37 #include "core/dom/Document.h" | 37 #include "core/dom/Document.h" |
| 38 #include "core/frame/FrameHost.h" | 38 #include "core/frame/FrameHost.h" |
| 39 #include "core/frame/LocalFrame.h" | 39 #include "core/frame/LocalFrame.h" |
| 40 #include "core/frame/Settings.h" | 40 #include "core/frame/Settings.h" |
| 41 #include "core/inspector/IdentifiersFactory.h" | 41 #include "core/inspector/IdentifiersFactory.h" |
| 42 #include "core/inspector/InspectorPageAgent.h" | |
| 43 #include "core/inspector/InspectorState.h" | 42 #include "core/inspector/InspectorState.h" |
| 44 #include "core/inspector/InstrumentingAgents.h" | 43 #include "core/inspector/InstrumentingAgents.h" |
| 45 #include "core/layout/LayoutPart.h" | 44 #include "core/layout/LayoutPart.h" |
| 46 #include "core/layout/LayoutView.h" | 45 #include "core/layout/LayoutView.h" |
| 47 #include "core/layout/compositing/CompositedDeprecatedPaintLayerMapping.h" | 46 #include "core/layout/compositing/CompositedDeprecatedPaintLayerMapping.h" |
| 48 #include "core/layout/compositing/DeprecatedPaintLayerCompositor.h" | 47 #include "core/layout/compositing/DeprecatedPaintLayerCompositor.h" |
| 49 #include "core/loader/DocumentLoader.h" | 48 #include "core/loader/DocumentLoader.h" |
| 50 #include "platform/geometry/IntRect.h" | 49 #include "platform/geometry/IntRect.h" |
| 51 #include "platform/graphics/CompositingReasons.h" | 50 #include "platform/graphics/CompositingReasons.h" |
| 52 #include "platform/graphics/GraphicsLayer.h" | 51 #include "platform/graphics/GraphicsLayer.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 else | 138 else |
| 140 layerObject->setAnchorY(0.0); | 139 layerObject->setAnchorY(0.0); |
| 141 layerObject->setAnchorZ(transformOrigin.z()); | 140 layerObject->setAnchorZ(transformOrigin.z()); |
| 142 } | 141 } |
| 143 RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::ScrollRect> > scrollRects
= buildScrollRectsForLayer(graphicsLayer); | 142 RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::ScrollRect> > scrollRects
= buildScrollRectsForLayer(graphicsLayer); |
| 144 if (scrollRects) | 143 if (scrollRects) |
| 145 layerObject->setScrollRects(scrollRects.release()); | 144 layerObject->setScrollRects(scrollRects.release()); |
| 146 return layerObject; | 145 return layerObject; |
| 147 } | 146 } |
| 148 | 147 |
| 149 InspectorLayerTreeAgent::InspectorLayerTreeAgent(InspectorPageAgent* pageAgent) | 148 InspectorLayerTreeAgent::InspectorLayerTreeAgent(LocalFrame* inspectedFrame) |
| 150 : InspectorBaseAgent<InspectorLayerTreeAgent, InspectorFrontend::LayerTree>(
"LayerTree") | 149 : InspectorBaseAgent<InspectorLayerTreeAgent, InspectorFrontend::LayerTree>(
"LayerTree") |
| 151 , m_pageAgent(pageAgent) | 150 , m_inspectedFrame(inspectedFrame) |
| 152 { | 151 { |
| 153 } | 152 } |
| 154 | 153 |
| 155 InspectorLayerTreeAgent::~InspectorLayerTreeAgent() | 154 InspectorLayerTreeAgent::~InspectorLayerTreeAgent() |
| 156 { | 155 { |
| 157 } | 156 } |
| 158 | 157 |
| 159 DEFINE_TRACE(InspectorLayerTreeAgent) | 158 DEFINE_TRACE(InspectorLayerTreeAgent) |
| 160 { | 159 { |
| 161 visitor->trace(m_pageAgent); | 160 visitor->trace(m_inspectedFrame); |
| 162 InspectorBaseAgent::trace(visitor); | 161 InspectorBaseAgent::trace(visitor); |
| 163 } | 162 } |
| 164 | 163 |
| 165 void InspectorLayerTreeAgent::restore() | 164 void InspectorLayerTreeAgent::restore() |
| 166 { | 165 { |
| 167 // We do not re-enable layer agent automatically after navigation. This is b
ecause | 166 // We do not re-enable layer agent automatically after navigation. This is b
ecause |
| 168 // it depends on DOMAgent and node ids in particular, so we let front-end re
quest document | 167 // it depends on DOMAgent and node ids in particular, so we let front-end re
quest document |
| 169 // and re-enable the agent manually after this. | 168 // and re-enable the agent manually after this. |
| 170 } | 169 } |
| 171 | 170 |
| 172 void InspectorLayerTreeAgent::enable(ErrorString*) | 171 void InspectorLayerTreeAgent::enable(ErrorString*) |
| 173 { | 172 { |
| 174 m_instrumentingAgents->setInspectorLayerTreeAgent(this); | 173 m_instrumentingAgents->setInspectorLayerTreeAgent(this); |
| 175 if (LocalFrame* frame = m_pageAgent->inspectedFrame()) { | 174 Document* document = m_inspectedFrame->document(); |
| 176 Document* document = frame->document(); | 175 if (document && document->lifecycle().state() >= DocumentLifecycle::Composit
ingClean) |
| 177 if (document && document->lifecycle().state() >= DocumentLifecycle::Comp
ositingClean) | 176 layerTreeDidChange(); |
| 178 layerTreeDidChange(); | |
| 179 } | |
| 180 } | 177 } |
| 181 | 178 |
| 182 void InspectorLayerTreeAgent::disable(ErrorString*) | 179 void InspectorLayerTreeAgent::disable(ErrorString*) |
| 183 { | 180 { |
| 184 m_instrumentingAgents->setInspectorLayerTreeAgent(0); | 181 m_instrumentingAgents->setInspectorLayerTreeAgent(0); |
| 185 m_snapshotById.clear(); | 182 m_snapshotById.clear(); |
| 186 ErrorString unused; | 183 ErrorString unused; |
| 187 } | 184 } |
| 188 | 185 |
| 189 void InspectorLayerTreeAgent::layerTreeDidChange() | 186 void InspectorLayerTreeAgent::layerTreeDidChange() |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 gatherGraphicsLayers(root->children()[i], layerIdToNodeIdMap, layers); | 246 gatherGraphicsLayers(root->children()[i], layerIdToNodeIdMap, layers); |
| 250 } | 247 } |
| 251 | 248 |
| 252 int InspectorLayerTreeAgent::idForNode(Node* node) | 249 int InspectorLayerTreeAgent::idForNode(Node* node) |
| 253 { | 250 { |
| 254 return DOMNodeIds::idForNode(node); | 251 return DOMNodeIds::idForNode(node); |
| 255 } | 252 } |
| 256 | 253 |
| 257 DeprecatedPaintLayerCompositor* InspectorLayerTreeAgent::deprecatedPaintLayerCom
positor() | 254 DeprecatedPaintLayerCompositor* InspectorLayerTreeAgent::deprecatedPaintLayerCom
positor() |
| 258 { | 255 { |
| 259 LayoutView* layoutView = m_pageAgent->inspectedFrame()->contentRenderer(); | 256 LayoutView* layoutView = m_inspectedFrame->contentRenderer(); |
| 260 DeprecatedPaintLayerCompositor* compositor = layoutView ? layoutView->compos
itor() : nullptr; | 257 DeprecatedPaintLayerCompositor* compositor = layoutView ? layoutView->compos
itor() : nullptr; |
| 261 return compositor; | 258 return compositor; |
| 262 } | 259 } |
| 263 | 260 |
| 264 GraphicsLayer* InspectorLayerTreeAgent::rootGraphicsLayer() | 261 GraphicsLayer* InspectorLayerTreeAgent::rootGraphicsLayer() |
| 265 { | 262 { |
| 266 return m_pageAgent->frameHost()->pinchViewport().rootGraphicsLayer(); | 263 return m_inspectedFrame->host()->pinchViewport().rootGraphicsLayer(); |
| 267 } | 264 } |
| 268 | 265 |
| 269 static GraphicsLayer* findLayerById(GraphicsLayer* root, int layerId) | 266 static GraphicsLayer* findLayerById(GraphicsLayer* root, int layerId) |
| 270 { | 267 { |
| 271 if (root->platformLayer()->id() == layerId) | 268 if (root->platformLayer()->id() == layerId) |
| 272 return root; | 269 return root; |
| 273 if (root->replicaLayer()) { | 270 if (root->replicaLayer()) { |
| 274 if (GraphicsLayer* layer = findLayerById(root->replicaLayer(), layerId)) | 271 if (GraphicsLayer* layer = findLayerById(root->replicaLayer(), layerId)) |
| 275 return layer; | 272 return layer; |
| 276 } | 273 } |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 void InspectorLayerTreeAgent::didRemovePageOverlay(const GraphicsLayer* layer) | 461 void InspectorLayerTreeAgent::didRemovePageOverlay(const GraphicsLayer* layer) |
| 465 { | 462 { |
| 466 size_t index = m_pageOverlayLayerIds.find(layer->platformLayer()->id()); | 463 size_t index = m_pageOverlayLayerIds.find(layer->platformLayer()->id()); |
| 467 if (index == WTF::kNotFound) | 464 if (index == WTF::kNotFound) |
| 468 return; | 465 return; |
| 469 m_pageOverlayLayerIds.remove(index); | 466 m_pageOverlayLayerIds.remove(index); |
| 470 } | 467 } |
| 471 | 468 |
| 472 | 469 |
| 473 } // namespace blink | 470 } // namespace blink |
| OLD | NEW |