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.
This commit is contained in:
Sam Atkins 2024-11-13 16:07:16 +00:00 committed by Andreas Kling
parent 957032809b
commit 1849eca503
Notes: github-actions[bot] 2024-11-13 19:38:28 +00:00

View file

@ -27,6 +27,7 @@
#include <LibWeb/DOM/Document.h> #include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Element.h> #include <LibWeb/DOM/Element.h>
#include <LibWeb/DOM/ElementFactory.h> #include <LibWeb/DOM/ElementFactory.h>
#include <LibWeb/DOM/ShadowRoot.h>
#include <LibWeb/DOM/Text.h> #include <LibWeb/DOM/Text.h>
#include <LibWeb/Dump.h> #include <LibWeb/Dump.h>
#include <LibWeb/HTML/BrowsingContext.h> #include <LibWeb/HTML/BrowsingContext.h>
@ -325,9 +326,17 @@ void ConnectionFromClient::debug_request(u64 page_id, ByteString const& request,
if (request == "dump-style-sheets") { if (request == "dump-style-sheets") {
if (auto* doc = page->page().top_level_browsing_context().active_document()) { if (auto* doc = page->page().top_level_browsing_context().active_document()) {
dbgln("=== In document: ===");
for (auto& sheet : doc->style_sheets().sheets()) { for (auto& sheet : doc->style_sheets().sheets()) {
Web::dump_sheet(sheet); 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; return;
} }