Browse Source

LibWeb: Usefully dump CSS property rules

Sample dump:
```
CSSPropertyRule:
  name: --valid
  syntax: <color> | none
  inherits: false
  initial-value: red
```
Alex Ungurianu 9 months ago
parent
commit
1dd3865de9
1 changed files with 17 additions and 7 deletions
  1. 17 7
      Userland/Libraries/LibWeb/Dump.cpp

+ 17 - 7
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()) {