LibWeb/CSS: Dump out media queries in more detail

Instead of just serializing them, dump out the query condition as a
tree, taking advantage of the existing dump code for
BooleanExpressions.
This commit is contained in:
Sam Atkins 2025-12-04 12:52:36 +00:00
parent 1db13c52be
commit 5343c9bd2e
Notes: github-actions[bot] 2025-12-04 16:25:37 +00:00
5 changed files with 37 additions and 5 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2023, Sam Atkins <atkinssj@serenityos.org>
* Copyright (c) 2021-2025, Sam Atkins <sam@ladybird.org>
* Copyright (c) 2022-2023, Andreas Kling <andreas@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
@ -10,6 +10,7 @@
#include <LibWeb/CSS/CSSStyleSheet.h>
#include <LibWeb/CSS/MediaList.h>
#include <LibWeb/CSS/Parser/Parser.h>
#include <LibWeb/Dump.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
namespace Web::CSS {
@ -136,4 +137,12 @@ Optional<JS::Value> MediaList::item_value(size_t index) const
return JS::PrimitiveString::create(vm(), m_media[index]->to_string());
}
void MediaList::dump(StringBuilder& builder, int indent_levels) const
{
dump_indent(builder, indent_levels);
builder.appendff("Media list ({}):\n", m_media.size());
for (auto const& media : m_media)
media->dump(builder, indent_levels + 1);
}
}