Commit a7ff68ad authored by Wei Li's avatar Wei Li Committed by Commit Bot

UIDevTools: Update protocol and handling code

UI DevTools have been out of sync with platform DevTools protocol.
This will cause some runtime errors due to protocol incompatibility.
This CL updates UI Devtools' protocol and corresponding handling
code.

For protocol update, we update the domain fields and its properties
according to browser_protocol.pdl. We also arrange the order to
put the name or id at the first, and use consistent order across
different fields to make it more readable and easier for future
updates.

BUG=894623

Change-Id: Ic650c126155044d2e25c4ff068c5a7a17144584f
Reviewed-on: https://chromium-review.googlesource.com/c/1277835Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Commit-Queue: Wei Li <weili@chromium.org>
Cr-Commit-Position: refs/heads/master@{#599686}
parent c27e10f2
...@@ -80,7 +80,7 @@ std::unique_ptr<CSS::CSSStyle> BuildCSSStyle(UIElement* ui_element) { ...@@ -80,7 +80,7 @@ std::unique_ptr<CSS::CSSStyle> BuildCSSStyle(UIElement* ui_element) {
.setRange(BuildDefaultSourceRange()) .setRange(BuildDefaultSourceRange())
.setStyleSheetId(base::IntToString(ui_element->node_id())) .setStyleSheetId(base::IntToString(ui_element->node_id()))
.setCssProperties(std::move(css_properties)) .setCssProperties(std::move(css_properties))
.setShorthandEntries(Array<std::string>::create()) .setShorthandEntries(Array<protocol::CSS::ShorthandEntry>::create())
.build(); .build();
} }
......
...@@ -87,6 +87,12 @@ class CSSAgentTest : public testing::Test { ...@@ -87,6 +87,12 @@ class CSSAgentTest : public testing::Test {
auto edits = protocol::Array<protocol::CSS::StyleDeclarationEdit>::create(); auto edits = protocol::Array<protocol::CSS::StyleDeclarationEdit>::create();
auto edit = protocol::CSS::StyleDeclarationEdit::create() auto edit = protocol::CSS::StyleDeclarationEdit::create()
.setStyleSheetId(base::IntToString(node_id)) .setStyleSheetId(base::IntToString(node_id))
.setRange(protocol::CSS::SourceRange::create()
.setStartLine(0)
.setStartColumn(0)
.setEndLine(0)
.setEndColumn(0)
.build())
.setText(style_text) .setText(style_text)
.build(); .build();
edits->addItem(std::move(edit)); edits->addItem(std::move(edit));
......
...@@ -30,10 +30,6 @@ Response DOMAgent::getDocument(std::unique_ptr<DOM::Node>* out_root) { ...@@ -30,10 +30,6 @@ Response DOMAgent::getDocument(std::unique_ptr<DOM::Node>* out_root) {
return Response::OK(); return Response::OK();
} }
Response DOMAgent::hideHighlight() {
return Response::OK();
}
Response DOMAgent::pushNodesByBackendIdsToFrontend( Response DOMAgent::pushNodesByBackendIdsToFrontend(
std::unique_ptr<protocol::Array<int>> backend_node_ids, std::unique_ptr<protocol::Array<int>> backend_node_ids,
std::unique_ptr<protocol::Array<int>>* result) { std::unique_ptr<protocol::Array<int>>* result) {
......
...@@ -31,7 +31,6 @@ class UI_DEVTOOLS_EXPORT DOMAgent ...@@ -31,7 +31,6 @@ class UI_DEVTOOLS_EXPORT DOMAgent
protocol::Response disable() override; protocol::Response disable() override;
protocol::Response getDocument( protocol::Response getDocument(
std::unique_ptr<protocol::DOM::Node>* out_root) override; std::unique_ptr<protocol::DOM::Node>* out_root) override;
protocol::Response hideHighlight() override;
protocol::Response pushNodesByBackendIdsToFrontend( protocol::Response pushNodesByBackendIdsToFrontend(
std::unique_ptr<protocol::Array<int>> backend_node_ids, std::unique_ptr<protocol::Array<int>> backend_node_ids,
std::unique_ptr<protocol::Array<int>>* result) override; std::unique_ptr<protocol::Array<int>>* result) override;
......
...@@ -27,7 +27,6 @@ protocol::Response OverlayAgent::highlightNode( ...@@ -27,7 +27,6 @@ protocol::Response OverlayAgent::highlightNode(
} }
protocol::Response OverlayAgent::hideHighlight() { protocol::Response OverlayAgent::hideHighlight() {
NOTREACHED();
return protocol::Response::OK(); return protocol::Response::OK();
} }
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment