mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 23:37:35 +00:00
LibWeb+WebContent: Add IPC flow for Inspect DOM Tree
Add `inspect_dom_tree` to WebContentServer and 'did_get_dom_tree' to WebContentClient. These two async methods form a request & response for requesting a JSON representation of the Content's DOM tree.
This commit is contained in:
parent
4affe052b8
commit
cd6b9613c5
9 changed files with 31 additions and 0 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <AK/Badge.h>
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/JsonObject.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/FontDatabase.h>
|
||||
#include <LibGfx/SystemTheme.h>
|
||||
|
@ -216,6 +217,13 @@ void ClientConnection::get_source()
|
|||
}
|
||||
}
|
||||
|
||||
void ClientConnection::inspect_dom_tree()
|
||||
{
|
||||
if (auto* doc = page().top_level_browsing_context().document()) {
|
||||
async_did_get_dom_tree(doc->dump_dom_tree_as_json());
|
||||
}
|
||||
}
|
||||
|
||||
void ClientConnection::js_console_initialize()
|
||||
{
|
||||
if (auto* document = page().top_level_browsing_context().document()) {
|
||||
|
|
|
@ -48,6 +48,7 @@ private:
|
|||
virtual void remove_backing_store(i32) override;
|
||||
virtual void debug_request(String const&, String const&) override;
|
||||
virtual void get_source() override;
|
||||
virtual void inspect_dom_tree() override;
|
||||
virtual void js_console_initialize() override;
|
||||
virtual void js_console_input(String const&) override;
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ endpoint WebContentClient
|
|||
did_request_confirm(String message) => (bool result)
|
||||
did_request_prompt(String message, String default_) => (String response)
|
||||
did_get_source(URL url, String source) =|
|
||||
did_get_dom_tree(String dom_tree) =|
|
||||
did_js_console_output(String method, String line) =|
|
||||
did_change_favicon(Gfx::ShareableBitmap favicon) =|
|
||||
did_request_cookie(URL url, u8 source) => (String cookie)
|
||||
|
|
|
@ -22,6 +22,7 @@ endpoint WebContentServer
|
|||
|
||||
debug_request(String request, String argument) =|
|
||||
get_source() =|
|
||||
inspect_dom_tree() =|
|
||||
js_console_initialize() =|
|
||||
js_console_input(String js_source) =|
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue