Commit 176ec212 authored by Alex Rudenko's avatar Alex Rudenko Committed by Commit Bot

[DevTools]: Remove highlight tool and use new resources from DevTools

This CL removes inspect_tool_highlight.html and replaces it with
resources produced by DevTools[1], where the implementation has been
moved to in a separate CL[2].

[1]: https://goo.gle/devtools-overlay-reuse
[2]: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2192892

Bug: 1078267
Change-Id: I95d3faef98470e13430ed251cf135e59269358d1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2194865
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: default avatarJochen Eisinger <jochen@chromium.org>
Reviewed-by: default avatarMathias Bynens <mathias@chromium.org>
Reviewed-by: default avatarPeter Marshall <petermarshall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#774030}
parent 405fca51
......@@ -1054,6 +1054,7 @@ if (!is_ios) {
"//skia/public/mojom:mojom_js_data_deps",
"//testing/buildbot/filters:blink_web_tests_filter",
"//third_party/blink/public:blink_devtools_frontend_resources_files",
"//third_party/blink/public:blink_devtools_inspector_resources",
"//third_party/blink/public/mojom:mojom_platform_js_data_deps",
"//third_party/blink/renderer/core/html:js_files_for_form_controls_web_tests",
"//third_party/catapult/third_party/typ",
......
......@@ -802,6 +802,7 @@ if (is_win) {
# creating or destroying the symlink.
":chrome_app",
"//third_party/blink/public:blink_devtools_frontend_resources",
"//third_party/blink/public:blink_devtools_inspector_resources",
]
}
} else {
......@@ -1261,6 +1262,7 @@ group("child_dependencies") {
"//pdf",
"//services/tracing/public/cpp",
"//third_party/blink/public:blink_devtools_frontend_resources",
"//third_party/blink/public:blink_devtools_inspector_resources",
]
if (enable_nacl) {
......
......@@ -99,6 +99,7 @@ template("chrome_extra_paks") {
"$root_gen_dir/mojo/public/js/mojo_bindings_resources.pak",
"$root_gen_dir/net/net_resources.pak",
"$root_gen_dir/third_party/blink/public/resources/blink_resources.pak",
"$root_gen_dir/third_party/blink/public/resources/inspector_overlay_resources.pak",
"$root_gen_dir/ui/resources/webui_resources.pak",
]
deps = [
......@@ -111,6 +112,7 @@ template("chrome_extra_paks") {
"//content/browser/tracing:resources",
"//mojo/public/js:resources",
"//net:net_resources",
"//third_party/blink/public:devtools_inspector_resources",
"//third_party/blink/public:resources",
"//ui/resources",
]
......
......@@ -674,6 +674,7 @@ repack("pak") {
"$root_gen_dir/net/net_resources.pak",
"$root_gen_dir/third_party/blink/public/resources/blink_resources.pak",
"$root_gen_dir/third_party/blink/public/resources/blink_scaled_resources_100_percent.pak",
"$root_gen_dir/third_party/blink/public/resources/inspector_overlay_resources.pak",
"$root_gen_dir/third_party/blink/public/strings/blink_strings_en-US.pak",
"$root_gen_dir/ui/resources/ui_resources_100_percent.pak",
"$root_gen_dir/ui/resources/webui_resources.pak",
......@@ -691,6 +692,7 @@ repack("pak") {
"//content/browser/webrtc/resources",
"//mojo/public/js:resources",
"//net:net_resources",
"//third_party/blink/public:devtools_inspector_resources",
"//third_party/blink/public:resources",
"//third_party/blink/public:scaled_resources_100_percent",
"//third_party/blink/public/strings",
......
......@@ -421,6 +421,7 @@ source_set("blink_headers") {
]
public_deps = [
":devtools_inspector_resources_grit",
":resources_grit",
"//net",
"//services/service_manager/public/cpp",
......@@ -461,6 +462,10 @@ group("blink_devtools_frontend_resources") {
public_deps = [ "$devtools_frontend_path:devtools_frontend_resources" ]
}
group("blink_devtools_inspector_resources") {
public_deps = [ ":devtools_inspector_resources_grit" ]
}
group("blink_devtools_frontend_resources_files") {
testonly = true
data_deps = [ "$devtools_frontend_path:devtools_all_files" ]
......@@ -481,6 +486,25 @@ grit("resources") {
]
}
grit("devtools_inspector_resources") {
# Required because the .grd is generated.
enable_input_discovery_for_gn_analyze = false
source = "$root_out_dir/resources/inspector_overlay/inspector_overlay_resources.grd"
output_dir = resources_out_dir
outputs = [
"grit/inspector_overlay_resources_map.h",
"inspector_overlay_resources.pak",
]
defines =
[ "SHARED_INTERMEDIATE_DIR=" + rebase_path(root_out_dir, root_build_dir) ]
deps = [
"$devtools_frontend_path:generate_devtools_inspector_overlay_resources",
]
}
grit("image_resources") {
output_dir = resources_out_dir
source = "blink_image_resources.grd"
......
......@@ -34,7 +34,6 @@
<include name="IDR_INSPECT_TOOL_COMMON_JS" file="../renderer/core/inspector/inspect_tool_common.js" type="BINDATA" compress="gzip"/>
<include name="IDR_INSPECT_TOOL_COMMON_CSS" file="../renderer/core/inspector/inspect_tool_common.css" type="BINDATA" compress="gzip"/>
<include name="IDR_INSPECT_TOOL_DISTANCES_HTML" file="../renderer/core/inspector/inspect_tool_distances.html" type="BINDATA" compress="gzip"/>
<include name="IDR_INSPECT_TOOL_HIGHLIGHT_HTML" file="../renderer/core/inspector/inspect_tool_highlight.html" type="BINDATA" compress="gzip"/>
<include name="IDR_INSPECT_TOOL_PAUSED_HTML" file="../renderer/core/inspector/inspect_tool_paused.html" type="BINDATA" compress="gzip"/>
<include name="IDR_INSPECT_TOOL_VIEWPORT_SIZE_HTML" file="../renderer/core/inspector/inspect_tool_viewport_size.html" type="BINDATA" compress="gzip"/>
<include name="IDR_INSPECT_TOOL_SCREENSHOT_HTML" file="../renderer/core/inspector/inspect_tool_screenshot.html" type="BINDATA" compress="gzip"/>
......
......@@ -39,6 +39,7 @@
#include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/public/platform/web_data.h"
#include "third_party/blink/public/resources/grit/blink_resources.h"
#include "third_party/blink/public/resources/grit/inspector_overlay_resources_map.h"
#include "third_party/blink/public/web/web_widget_client.h"
#include "third_party/blink/renderer/bindings/core/v8/sanitize_script_errors.h"
#include "third_party/blink/renderer/bindings/core/v8/script_controller.h"
......@@ -120,7 +121,7 @@ void InspectTool::Init(InspectorOverlayAgent* overlay,
}
int InspectTool::GetDataResourceId() {
return IDR_INSPECT_TOOL_HIGHLIGHT_HTML;
return IDR_INSPECT_TOOL_HIGHLIGHT_JS;
}
bool InspectTool::HandleInputEvent(LocalFrameView* frame_view,
......@@ -223,7 +224,7 @@ Hinge::Hinge(FloatQuad quad,
int Hinge::GetDataResourceId() {
// TODO (soxia): In the future, we should make the hinge working properly
// with tools using different resources.
return IDR_INSPECT_TOOL_HIGHLIGHT_HTML;
return IDR_INSPECT_TOOL_HIGHLIGHT_JS;
}
void Hinge::Trace(Visitor* visitor) const {
......@@ -1015,13 +1016,25 @@ void InspectorOverlayAgent::LoadFrameForTool(int data_resource_id) {
frame->View()->SetBaseBackgroundColor(Color::kTransparent);
scoped_refptr<SharedBuffer> data = SharedBuffer::Create();
data->Append("<style>", static_cast<size_t>(7));
data->Append(UncompressResourceAsBinary(IDR_INSPECT_TOOL_COMMON_CSS));
data->Append("</style>", static_cast<size_t>(8));
data->Append("<script>", static_cast<size_t>(8));
data->Append(UncompressResourceAsBinary(IDR_INSPECT_TOOL_COMMON_JS));
data->Append("</script>", static_cast<size_t>(9));
data->Append(UncompressResourceAsBinary(frame_resource_name_));
// TODO(crbug.com/1078267): migrate all inspector tools
if (frame_resource_name_ == IDR_INSPECT_TOOL_HIGHLIGHT_JS) {
// New source of overlay resources.
data->Append("<style>", static_cast<size_t>(7));
data->Append(UncompressResourceAsBinary(IDR_INSPECT_COMMON_CSS));
data->Append("</style>", static_cast<size_t>(8));
data->Append("<script>", static_cast<size_t>(8));
data->Append(UncompressResourceAsBinary(frame_resource_name_));
data->Append("</script>", static_cast<size_t>(9));
} else {
// Old source of resources.
data->Append("<style>", static_cast<size_t>(7));
data->Append(UncompressResourceAsBinary(IDR_INSPECT_TOOL_COMMON_CSS));
data->Append("</style>", static_cast<size_t>(8));
data->Append("<script>", static_cast<size_t>(8));
data->Append(UncompressResourceAsBinary(IDR_INSPECT_TOOL_COMMON_JS));
data->Append("</script>", static_cast<size_t>(9));
data->Append(UncompressResourceAsBinary(frame_resource_name_));
}
frame->ForceSynchronousDocumentInstall("text/html", data);
......
......@@ -603,10 +603,16 @@
# This file is generated during the build.
"<(SHARED_INTERMEDIATE_DIR)/devtools/devtools_resources.grd": {
"META": {"sizes": {"includes": [500],}},
"META": {"sizes": {"includes": [1000],}},
"includes": [3860],
},
# This file is generated during the build.
"<(SHARED_INTERMEDIATE_DIR)/resources/inspector_overlay/inspector_overlay_resources.grd": {
"META": {"sizes": {"includes": [50],}},
"includes": [3880],
},
# END "everything else" section.
# Everything but chrome/, components/, content/, and ios/
......
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