1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 20:47:45 +00:00

LibWebView+WebContent: Make the DOM node HTML retrieval IPC async

This commit is contained in:
Timothy Flynn 2023-12-30 14:32:50 -05:00 committed by Andreas Kling
parent c190294a76
commit 93db790974
9 changed files with 24 additions and 13 deletions

View file

@ -781,17 +781,18 @@ void ConnectionFromClient::remove_dom_node(i32 node_id)
async_did_finish_editing_dom_node(previous_dom_node->unique_id());
}
Messages::WebContentServer::GetDomNodeHtmlResponse ConnectionFromClient::get_dom_node_html(i32 node_id)
void ConnectionFromClient::get_dom_node_html(i32 node_id)
{
auto* dom_node = Web::DOM::Node::from_unique_id(node_id);
if (!dom_node)
return OptionalNone {};
return;
// FIXME: Implement Element's outerHTML attribute.
auto container = Web::DOM::create_element(dom_node->document(), Web::HTML::TagNames::div, Web::Namespace::HTML).release_value_but_fixme_should_propagate_errors();
container->append_child(dom_node->clone_node(nullptr, true)).release_value_but_fixme_should_propagate_errors();
return container->inner_html().release_value_but_fixme_should_propagate_errors();
auto html = container->inner_html().release_value_but_fixme_should_propagate_errors();
async_did_get_dom_node_html(move(html));
}
void ConnectionFromClient::initialize_js_console(Badge<PageClient>, Web::DOM::Document& document)

View file

@ -84,7 +84,7 @@ private:
virtual void create_child_text_node(i32 node_id) override;
virtual void clone_dom_node(i32 node_id) override;
virtual void remove_dom_node(i32 node_id) override;
virtual Messages::WebContentServer::GetDomNodeHtmlResponse get_dom_node_html(i32 node_id) override;
virtual void get_dom_node_html(i32 node_id) override;
virtual Messages::WebContentServer::DumpLayoutTreeResponse dump_layout_tree() override;
virtual Messages::WebContentServer::DumpPaintTreeResponse dump_paint_tree() override;

View file

@ -46,6 +46,7 @@ endpoint WebContentClient
did_inspect_accessibility_tree(ByteString accessibility_tree) =|
did_get_hovered_node_id(i32 node_id) =|
did_finish_editing_dom_node(Optional<i32> node_id) =|
did_get_dom_node_html(String html) =|
did_change_favicon(Gfx::ShareableBitmap favicon) =|
did_request_all_cookies(URL url) => (Vector<Web::Cookie::Cookie> cookies)

View file

@ -52,7 +52,7 @@ endpoint WebContentServer
create_child_text_node(i32 node_id) =|
clone_dom_node(i32 node_id) =|
remove_dom_node(i32 node_id) =|
get_dom_node_html(i32 node_id) => (Optional<String> html)
get_dom_node_html(i32 node_id) =|
take_document_screenshot() => (Gfx::ShareableBitmap data)
take_dom_node_screenshot(i32 node_id) => (Gfx::ShareableBitmap data)