mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 18:17:34 +00:00
LibWebView+WebContent: Add IPC to run the fragment serialization steps
This commit is contained in:
parent
13b8eeff54
commit
82af1557dd
5 changed files with 22 additions and 0 deletions
|
@ -447,6 +447,11 @@ void OutOfProcessWebView::get_source()
|
||||||
client().async_get_source();
|
client().async_get_source();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String OutOfProcessWebView::serialize_source()
|
||||||
|
{
|
||||||
|
return client().serialize_source();
|
||||||
|
}
|
||||||
|
|
||||||
void OutOfProcessWebView::inspect_dom_tree()
|
void OutOfProcessWebView::inspect_dom_tree()
|
||||||
{
|
{
|
||||||
client().async_inspect_dom_tree();
|
client().async_inspect_dom_tree();
|
||||||
|
|
|
@ -37,6 +37,7 @@ public:
|
||||||
|
|
||||||
void debug_request(String const& request, String const& argument = {});
|
void debug_request(String const& request, String const& argument = {});
|
||||||
void get_source();
|
void get_source();
|
||||||
|
String serialize_source();
|
||||||
|
|
||||||
void inspect_dom_tree();
|
void inspect_dom_tree();
|
||||||
struct DOMNodeProperties {
|
struct DOMNodeProperties {
|
||||||
|
|
|
@ -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()
|
void ConnectionFromClient::inspect_dom_tree()
|
||||||
{
|
{
|
||||||
if (auto* doc = page().top_level_browsing_context().active_document()) {
|
if (auto* doc = page().top_level_browsing_context().active_document()) {
|
||||||
|
|
|
@ -62,6 +62,7 @@ private:
|
||||||
virtual void remove_backing_store(i32) override;
|
virtual void remove_backing_store(i32) override;
|
||||||
virtual void debug_request(String const&, String const&) override;
|
virtual void debug_request(String const&, String const&) override;
|
||||||
virtual void get_source() override;
|
virtual void get_source() override;
|
||||||
|
virtual Messages::WebContentServer::SerializeSourceResponse serialize_source() override;
|
||||||
virtual void inspect_dom_tree() override;
|
virtual void inspect_dom_tree() override;
|
||||||
virtual Messages::WebContentServer::InspectDomNodeResponse inspect_dom_node(i32 node_id, Optional<Web::CSS::Selector::PseudoElement> const& pseudo_element) override;
|
virtual Messages::WebContentServer::InspectDomNodeResponse inspect_dom_node(i32 node_id, Optional<Web::CSS::Selector::PseudoElement> const& pseudo_element) override;
|
||||||
virtual Messages::WebContentServer::GetHoveredNodeIdResponse get_hovered_node_id() override;
|
virtual Messages::WebContentServer::GetHoveredNodeIdResponse get_hovered_node_id() override;
|
||||||
|
|
|
@ -32,6 +32,7 @@ endpoint WebContentServer
|
||||||
|
|
||||||
debug_request(String request, String argument) =|
|
debug_request(String request, String argument) =|
|
||||||
get_source() =|
|
get_source() =|
|
||||||
|
serialize_source() => (String source)
|
||||||
inspect_dom_tree() =|
|
inspect_dom_tree() =|
|
||||||
inspect_dom_node(i32 node_id, Optional<Web::CSS::Selector::PseudoElement> pseudo_element) => (bool has_style, String specified_style, String computed_style, String custom_properties, String node_box_sizing)
|
inspect_dom_node(i32 node_id, Optional<Web::CSS::Selector::PseudoElement> pseudo_element) => (bool has_style, String specified_style, String computed_style, String custom_properties, String node_box_sizing)
|
||||||
get_hovered_node_id() => (i32 node_id)
|
get_hovered_node_id() => (i32 node_id)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue