LibDevTools+LibWebView+WebContent: Selectively fetch DOM node properties

When we inspect a DOM node, we currently serialize many properties for
that node, including its layout, computed style, used fonts, etc. Now
that we aren't piggy-backing on the Inspector interface, we can instead
only serialize the specific information required by DevTools.
This commit is contained in:
Timothy Flynn 2025-03-19 15:50:56 -04:00 committed by Jelle Raaijmakers
commit daca9f5995
Notes: github-actions[bot] 2025-03-20 08:02:26 +00:00
18 changed files with 287 additions and 276 deletions

View file

@ -0,0 +1,26 @@
/*
* Copyright (c) 2025, Tim Flynn <trflynn89@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibIPC/Decoder.h>
#include <LibIPC/Encoder.h>
#include <LibWebView/DOMNodeProperties.h>
template<>
ErrorOr<void> IPC::encode(Encoder& encoder, WebView::DOMNodeProperties const& attribute)
{
TRY(encoder.encode(attribute.type));
TRY(encoder.encode(attribute.properties));
return {};
}
template<>
ErrorOr<WebView::DOMNodeProperties> IPC::decode(Decoder& decoder)
{
auto type = TRY(decoder.decode<WebView::DOMNodeProperties::Type>());
auto properties = TRY(decoder.decode<JsonValue>());
return WebView::DOMNodeProperties { type, move(properties) };
}