From 1849eca50326c236e46e7fc619f928aa84cd760d Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Wed, 13 Nov 2024 16:07:16 +0000 Subject: [PATCH] WebContent: Dump style sheets that are inside shadow roots Also include a header to say what shadow root each style sheet is in, so we can distinguish between them. --- Services/WebContent/ConnectionFromClient.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Services/WebContent/ConnectionFromClient.cpp b/Services/WebContent/ConnectionFromClient.cpp index 4d60320bb6f..7ad62ce7d1c 100644 --- a/Services/WebContent/ConnectionFromClient.cpp +++ b/Services/WebContent/ConnectionFromClient.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -325,9 +326,17 @@ void ConnectionFromClient::debug_request(u64 page_id, ByteString const& request, if (request == "dump-style-sheets") { if (auto* doc = page->page().top_level_browsing_context().active_document()) { + dbgln("=== In document: ==="); for (auto& sheet : doc->style_sheets().sheets()) { Web::dump_sheet(sheet); } + + doc->for_each_shadow_root([&](auto& shadow_root) { + dbgln("=== In shadow root {}: ===", shadow_root.host()->debug_description()); + shadow_root.for_each_css_style_sheet([&](auto& sheet) { + Web::dump_sheet(sheet); + }); + }); } return; }