Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Unified Diff: third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp

Issue 2882193002: [devtools] Add DOMSnapshot domain for dom+layout+style snapshots. (Closed)
Patch Set: move to CSS domain, remove getLayoutTreeAndStyles Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;

Powered by Google App Engine
This is Rietveld 408576698