LibWeb: Move CSSRule dumping code into CSSRule classes

Having the dumping code in a separate Dump.cpp meant that it was often
overlooked when the rules gained new features, and also limits dumping
to publicly-accessible information.
This commit is contained in:
Sam Atkins 2025-12-04 12:03:01 +00:00
parent 285892b5dd
commit 180cd4b799
Notes: github-actions[bot] 2025-12-04 16:25:53 +00:00
32 changed files with 211 additions and 204 deletions

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2024, Alex Ungurianu <alex@ungurianu.com>
* Copyright (c) 2025, Sam Atkins <sam@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -8,6 +9,7 @@
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/CSS/CSSPropertyRule.h>
#include <LibWeb/CSS/Serialize.h>
#include <LibWeb/Dump.h>
namespace Web::CSS {
@ -80,4 +82,23 @@ String CSSPropertyRule::serialized() const
return MUST(builder.to_string());
}
void CSSPropertyRule::dump(StringBuilder& builder, int indent_levels) const
{
Base::dump(builder, indent_levels);
dump_indent(builder, indent_levels + 1);
builder.appendff("Name: {}\n", name());
dump_indent(builder, indent_levels + 1);
builder.appendff("Syntax: {}\n", syntax());
dump_indent(builder, indent_levels + 1);
builder.appendff("Inherits: {}\n", inherits());
if (initial_value().has_value()) {
dump_indent(builder, indent_levels + 1);
builder.appendff("Initial value: {}\n", initial_value().value());
}
}
}