mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 13:47:35 +00:00
LibWeb+WebContent: Port DumpLayoutTree to OutOfProcessWebView
This required adding a simple OOPWV::dump_layout_tree() API that synchronously requests a dump of the layout tree from the WebContent process.
This commit is contained in:
parent
c6e56612f5
commit
9d03ea6f74
6 changed files with 28 additions and 18 deletions
|
@ -321,4 +321,17 @@ void ClientConnection::select_all()
|
|||
page().client().page_did_change_selection();
|
||||
}
|
||||
|
||||
Messages::WebContentServer::DumpLayoutTreeResponse ClientConnection::dump_layout_tree()
|
||||
{
|
||||
auto* document = page().top_level_browsing_context().document();
|
||||
if (!document)
|
||||
return String { "(no DOM tree)" };
|
||||
auto* layout_root = document->layout_node();
|
||||
if (!layout_root)
|
||||
return String { "(no layout tree)" };
|
||||
StringBuilder builder;
|
||||
Web::dump_tree(builder, *layout_root);
|
||||
return builder.to_string();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -54,6 +54,7 @@ private:
|
|||
virtual void inspect_dom_tree() override;
|
||||
virtual Messages::WebContentServer::InspectDomNodeResponse inspect_dom_node(i32) override;
|
||||
virtual Messages::WebContentServer::GetHoveredNodeIdResponse get_hovered_node_id() override;
|
||||
virtual Messages::WebContentServer::DumpLayoutTreeResponse dump_layout_tree() override;
|
||||
|
||||
virtual void js_console_input(String const&) override;
|
||||
virtual void run_javascript(String const&) override;
|
||||
|
|
|
@ -34,6 +34,8 @@ endpoint WebContentServer
|
|||
|
||||
run_javascript(String js_source) =|
|
||||
|
||||
dump_layout_tree() => (String dump)
|
||||
|
||||
get_selected_text() => (String selection)
|
||||
select_all() =|
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue