LibDevTools: Stub out a layout inspector actor

The DevTools client will ask for this actor before trying to render any
box model or computed style information. We can just stub out this actor
for now.
This commit is contained in:
Timothy Flynn 2025-02-21 16:17:20 -05:00 committed by Tim Flynn
commit 3f8b65e45c
Notes: github-actions[bot] 2025-02-24 17:06:47 +00:00
6 changed files with 89 additions and 0 deletions

View file

@ -6,6 +6,7 @@
#include <AK/JsonArray.h>
#include <AK/StringUtils.h>
#include <LibDevTools/Actors/LayoutInspectorActor.h>
#include <LibDevTools/Actors/NodeActor.h>
#include <LibDevTools/Actors/TabActor.h>
#include <LibDevTools/Actors/WalkerActor.h>
@ -59,6 +60,18 @@ void WalkerActor::handle_message(StringView type, JsonObject const& message)
return;
}
if (type == "getLayoutInspector"sv) {
if (!m_layout_inspector)
m_layout_inspector = devtools().register_actor<LayoutInspectorActor>();
JsonObject actor;
actor.set("actor"sv, m_layout_inspector->name());
response.set("actor"sv, move(actor));
send_message(move(response));
return;
}
if (type == "querySelector"sv) {
auto node = message.get_string("node"sv);
if (!node.has_value()) {