Index: third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp |
diff --git a/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp |
index e9bfe37f98c093e07819878b4e5a1bf6089d8b48..1169091ed338621218e597c7206daa0dc096b7eb 100644 |
--- a/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp |
+++ b/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp |
@@ -2302,13 +2302,30 @@ Response InspectorCSSAgent::getBackgroundColors( |
return Response::OK(); |
} |
-Response InspectorCSSAgent::getLayoutTreeAndStyles( |
+Response InspectorCSSAgent::getDocumentSnapshot( |
std::unique_ptr<protocol::Array<String>> style_whitelist, |
+ protocol::Maybe<int> dom_depth, |
+ protocol::Maybe<bool> pierce, |
+ std::unique_ptr<protocol::Array<protocol::DOM::Node>>* dom_nodes, |
std::unique_ptr<protocol::Array<protocol::CSS::LayoutTreeNode>>* |
layout_tree_nodes, |
std::unique_ptr<protocol::Array<protocol::CSS::ComputedStyle>>* |
computed_styles) { |
- dom_agent_->GetDocument()->UpdateStyleAndLayoutTree(); |
+ if (!dom_agent_->Enabled()) |
+ return Response::Error("DOM agent hasn't been enabled"); |
+ |
+ Document* document = dom_agent_->GetDocument(); |
+ if (!document) |
+ return Response::Error("Document is not available"); |
+ |
+ // Update layout tree first, so that it won't change between |
+ // getFlattenedDocument and VisitLayoutTreeNodes. |
+ document->UpdateStyleAndLayoutTree(); |
+ |
+ Response response = dom_agent_->getFlattenedDocument( |
+ std::move(dom_depth), std::move(pierce), dom_nodes); |
+ if (!response.isSuccess()) |
+ return response; |
// Look up the CSSPropertyIDs for each entry in |styleWhitelist|. |
Vector<std::pair<String, CSSPropertyID>> css_property_whitelist; |