mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 20:29:18 +00:00
LibWeb+LibWebView+WebContent: Inform the UI about DOM mutations
This will allow our DevTools server to inform the Firefox DevTools client about DOM mutations.
This commit is contained in:
parent
bf723aad98
commit
2c4b420acc
Notes:
github-actions[bot]
2025-03-08 00:27:41 +00:00
Author: https://github.com/trflynn89
Commit: 2c4b420acc
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3850
17 changed files with 253 additions and 12 deletions
69
Libraries/LibWebView/Mutation.h
Normal file
69
Libraries/LibWebView/Mutation.h
Normal file
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* Copyright (c) 2025, Tim Flynn <trflynn89@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/Variant.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibIPC/Forward.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
|
||||
namespace WebView {
|
||||
|
||||
struct AttributeMutation {
|
||||
String attribute_name;
|
||||
Optional<String> new_value;
|
||||
};
|
||||
|
||||
struct CharacterDataMutation {
|
||||
String new_value;
|
||||
};
|
||||
|
||||
struct ChildListMutation {
|
||||
Vector<Web::UniqueNodeID> added;
|
||||
Vector<Web::UniqueNodeID> removed;
|
||||
size_t target_child_count { 0 };
|
||||
};
|
||||
|
||||
struct Mutation {
|
||||
using Type = Variant<AttributeMutation, CharacterDataMutation, ChildListMutation>;
|
||||
|
||||
String type;
|
||||
Web::UniqueNodeID target { 0 };
|
||||
String serialized_target;
|
||||
Type mutation;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
namespace IPC {
|
||||
|
||||
template<>
|
||||
ErrorOr<void> encode(Encoder&, WebView::AttributeMutation const&);
|
||||
|
||||
template<>
|
||||
ErrorOr<WebView::AttributeMutation> decode(Decoder&);
|
||||
|
||||
template<>
|
||||
ErrorOr<void> encode(Encoder&, WebView::CharacterDataMutation const&);
|
||||
|
||||
template<>
|
||||
ErrorOr<WebView::CharacterDataMutation> decode(Decoder&);
|
||||
|
||||
template<>
|
||||
ErrorOr<void> encode(Encoder&, WebView::ChildListMutation const&);
|
||||
|
||||
template<>
|
||||
ErrorOr<WebView::ChildListMutation> decode(Decoder&);
|
||||
|
||||
template<>
|
||||
ErrorOr<void> encode(Encoder&, WebView::Mutation const&);
|
||||
|
||||
template<>
|
||||
ErrorOr<WebView::Mutation> decode(Decoder&);
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue