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,6 +1,6 @@
/*
* Copyright (c) 2021, the SerenityOS developers.
* Copyright (c) 2022-2024, Sam Atkins <sam@ladybird.org>
* Copyright (c) 2022-2025, Sam Atkins <sam@ladybird.org>
* Copyright (c) 2022, Andreas Kling <andreas@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
@ -10,6 +10,7 @@
#include <LibWeb/CSS/CSSLayerBlockRule.h>
#include <LibWeb/CSS/CSSRule.h>
#include <LibWeb/CSS/CSSStyleSheet.h>
#include <LibWeb/Dump.h>
namespace Web::CSS {
@ -67,6 +68,12 @@ void CSSRule::set_parent_style_sheet(CSSStyleSheet* parent_style_sheet)
clear_caches();
}
void CSSRule::dump(StringBuilder& builder, int indent_levels) const
{
dump_indent(builder, indent_levels);
builder.appendff("{}:\n", class_name());
}
void CSSRule::clear_caches()
{
m_cached_layer_name.clear();