From 1dd3865de9bfedf065d48c2645f970f51409539b Mon Sep 17 00:00:00 2001 From: Alex Ungurianu Date: Tue, 15 Oct 2024 20:41:04 +0100 Subject: [PATCH] LibWeb: Usefully dump CSS property rules Sample dump: ``` CSSPropertyRule: name: --valid syntax: | none inherits: false initial-value: red ``` --- Userland/Libraries/LibWeb/Dump.cpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/Userland/Libraries/LibWeb/Dump.cpp b/Userland/Libraries/LibWeb/Dump.cpp index 83f9d91946d..851e531bda2 100644 --- a/Userland/Libraries/LibWeb/Dump.cpp +++ b/Userland/Libraries/LibWeb/Dump.cpp @@ -788,6 +788,23 @@ void dump_supports_rule(StringBuilder& builder, CSS::CSSSupportsRule const& supp dump_rule(builder, rule, indent_levels + 2); } +void dump_property_rule(StringBuilder& builder, CSS::CSSPropertyRule const& property, int indent_levels) +{ + indent(builder, indent_levels + 1); + builder.appendff("name: {}\n", property.name()); + + indent(builder, indent_levels + 1); + builder.appendff("syntax: {}\n", property.syntax()); + + indent(builder, indent_levels + 1); + builder.appendff("inherits: {}\n", property.inherits()); + + if (property.initial_value().has_value()) { + indent(builder, indent_levels + 1); + builder.appendff("initial-value: {}\n", property.initial_value().value()); + } +} + void dump_declaration(StringBuilder& builder, CSS::PropertyOwningCSSStyleDeclaration const& declaration, int indent_levels) { indent(builder, indent_levels); @@ -808,13 +825,6 @@ void dump_declaration(StringBuilder& builder, CSS::PropertyOwningCSSStyleDeclara } } -void dump_property_rule(StringBuilder& builder, CSS::CSSPropertyRule const& property, int indent_levels) -{ - (void)builder; - (void)property; - (void)indent_levels; -} - void dump_style_rule(StringBuilder& builder, CSS::CSSStyleRule const& rule, int indent_levels) { for (auto& selector : rule.selectors()) {