1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 03:37:34 +00:00

LibWebView+WebContent: Add IPC to run the fragment serialization steps

This commit is contained in:
Timothy Flynn 2022-11-02 20:55:16 -04:00 committed by Linus Groh
parent 13b8eeff54
commit 82af1557dd
5 changed files with 22 additions and 0 deletions

View file

@ -257,6 +257,20 @@ void ConnectionFromClient::get_source()
}
}
Messages::WebContentServer::SerializeSourceResponse ConnectionFromClient::serialize_source()
{
if (auto* doc = page().top_level_browsing_context().active_document()) {
auto result = doc->serialize_fragment(Web::DOMParsing::RequireWellFormed::Yes);
if (!result.is_error())
return { result.release_value() };
auto source = MUST(doc->serialize_fragment(Web::DOMParsing::RequireWellFormed::No));
return { move(source) };
}
return { {} };
}
void ConnectionFromClient::inspect_dom_tree()
{
if (auto* doc = page().top_level_browsing_context().active_document()) {