summaryrefslogtreecommitdiff
path: root/Userland/Services/WebContent/ClientConnection.cpp
diff options
context:
space:
mode:
authorAdam Hodgen <ant1441@gmail.com>2021-06-07 16:35:10 +0100
committerAndreas Kling <kling@serenityos.org>2021-06-29 23:06:48 +0200
commitcd6b9613c506096fa2737f37a2af7e85a8b01461 (patch)
treed2d5eeafedf77da2e328d9f1e8e7cd209ce6f8e2 /Userland/Services/WebContent/ClientConnection.cpp
parent4affe052b8e6a955e3c5ca06ea58accf985ae51e (diff)
downloadserenity-cd6b9613c506096fa2737f37a2af7e85a8b01461.zip
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.
Diffstat (limited to 'Userland/Services/WebContent/ClientConnection.cpp')
-rw-r--r--Userland/Services/WebContent/ClientConnection.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/Userland/Services/WebContent/ClientConnection.cpp b/Userland/Services/WebContent/ClientConnection.cpp
index 5cf714a0b3..b2ed2a32eb 100644
--- a/Userland/Services/WebContent/ClientConnection.cpp
+++ b/Userland/Services/WebContent/ClientConnection.cpp
@@ -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()) {