mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 20:29:18 +00:00
LibDevTools: Move message data into a structure
This is to prepare for an upcoming change where we will need to track replies to messages by ID. We will be able to add parameters to this structure without having to edit every single actor subclass header file.
This commit is contained in:
parent
509eaca73d
commit
24a5e4e7d5
Notes:
github-actions[bot]
2025-03-13 20:57:59 +00:00
Author: https://github.com/trflynn89
Commit: 24a5e4e7d5
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3920
42 changed files with 162 additions and 146 deletions
|
@ -85,11 +85,11 @@ PageStyleActor::PageStyleActor(DevToolsServer& devtools, String name, WeakPtr<In
|
|||
|
||||
PageStyleActor::~PageStyleActor() = default;
|
||||
|
||||
void PageStyleActor::handle_message(StringView type, JsonObject const& message)
|
||||
void PageStyleActor::handle_message(Message const& message)
|
||||
{
|
||||
JsonObject response;
|
||||
|
||||
if (type == "getApplied"sv) {
|
||||
if (message.type == "getApplied"sv) {
|
||||
// FIXME: This provides information to the "styles" pane in the inspector tab, which allows toggling and editing
|
||||
// styles live. We do not yet support figuring out the list of styles that apply to a specific node.
|
||||
response.set("entries"sv, JsonArray {});
|
||||
|
@ -97,7 +97,7 @@ void PageStyleActor::handle_message(StringView type, JsonObject const& message)
|
|||
return;
|
||||
}
|
||||
|
||||
if (type == "getComputed"sv) {
|
||||
if (message.type == "getComputed"sv) {
|
||||
auto node = get_required_parameter<String>(message, "node"sv);
|
||||
if (!node.has_value())
|
||||
return;
|
||||
|
@ -109,7 +109,7 @@ void PageStyleActor::handle_message(StringView type, JsonObject const& message)
|
|||
return;
|
||||
}
|
||||
|
||||
if (type == "getLayout"sv) {
|
||||
if (message.type == "getLayout"sv) {
|
||||
auto node = get_required_parameter<String>(message, "node"sv);
|
||||
if (!node.has_value())
|
||||
return;
|
||||
|
@ -121,13 +121,13 @@ void PageStyleActor::handle_message(StringView type, JsonObject const& message)
|
|||
return;
|
||||
}
|
||||
|
||||
if (type == "isPositionEditable") {
|
||||
if (message.type == "isPositionEditable") {
|
||||
response.set("value"sv, false);
|
||||
send_message(move(response));
|
||||
return;
|
||||
}
|
||||
|
||||
send_unrecognized_packet_type_error(type);
|
||||
send_unrecognized_packet_type_error(message);
|
||||
}
|
||||
|
||||
JsonValue PageStyleActor::serialize_style() const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue