mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-04 07:36:50 +00:00
There is a lot needed all at once to actually inspect a tab's DOM tree. It begins with requesting a "watcher" from a TabActor. It seems there can be many types of watchers, but here we implement the "frame" watcher only. The watcher creates an "inspector", which in turn creates a "walker", which is the actor ultimately responsible for serializing and inspecting the DOM tree. In between all that, the DevTools client will send a handful of other informational requests. If we do not reply to these, the client will not move forward with the walker. For example, the CSSPropertiesActor will be asked for a list of all known CSS properties.
44 lines
1.0 KiB
C++
44 lines
1.0 KiB
C++
/*
|
|
* Copyright (c) 2025, Tim Flynn <trflynn89@ladybird.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <AK/JsonObject.h>
|
|
#include <LibDevTools/Actors/PageStyleActor.h>
|
|
|
|
namespace DevTools {
|
|
|
|
NonnullRefPtr<PageStyleActor> PageStyleActor::create(DevToolsServer& devtools, ByteString name)
|
|
{
|
|
return adopt_ref(*new PageStyleActor(devtools, move(name)));
|
|
}
|
|
|
|
PageStyleActor::PageStyleActor(DevToolsServer& devtools, ByteString name)
|
|
: Actor(devtools, move(name))
|
|
{
|
|
}
|
|
|
|
PageStyleActor::~PageStyleActor() = default;
|
|
|
|
void PageStyleActor::handle_message(StringView type, JsonObject const&)
|
|
{
|
|
send_unrecognized_packet_type_error(type);
|
|
}
|
|
|
|
JsonValue PageStyleActor::serialize_style() const
|
|
{
|
|
JsonObject traits;
|
|
traits.set("fontStyleLevel4"sv, true);
|
|
traits.set("fontWeightLevel4"sv, true);
|
|
traits.set("fontStretchLevel4"sv, true);
|
|
traits.set("fontVariations"sv, true);
|
|
|
|
JsonObject style;
|
|
style.set("actor"sv, name());
|
|
style.set("traits"sv, move(traits));
|
|
return style;
|
|
}
|
|
|
|
}
|