mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
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:
parent
1db13c52be
commit
5343c9bd2e
Notes:
github-actions[bot]
2025-12-04 16:25:37 +00:00
Author: https://github.com/AtkinsSJ
Commit: 5343c9bd2e
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/7018
5 changed files with 37 additions and 5 deletions
|
|
@ -8,6 +8,7 @@
|
|||
#include <LibWeb/CSS/Serialize.h>
|
||||
#include <LibWeb/CSS/StyleComputer.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/Dump.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/Page/Page.h>
|
||||
|
||||
|
|
@ -261,7 +262,7 @@ MatchResult MediaFeature::compare(DOM::Document const& document, MediaFeatureVal
|
|||
void MediaFeature::dump(StringBuilder& builder, int indent_levels) const
|
||||
{
|
||||
indent(builder, indent_levels);
|
||||
builder.appendff("MediaFeature: {}", to_string());
|
||||
builder.appendff("MediaFeature: {}\n", to_string());
|
||||
}
|
||||
|
||||
String MediaQuery::to_string() const
|
||||
|
|
@ -318,6 +319,24 @@ bool MediaQuery::evaluate(DOM::Document const& document)
|
|||
return m_matches;
|
||||
}
|
||||
|
||||
void MediaQuery::dump(StringBuilder& builder, int indent_levels) const
|
||||
{
|
||||
dump_indent(builder, indent_levels);
|
||||
builder.appendff("Media condition: (matches = {})\n", m_matches);
|
||||
|
||||
dump_indent(builder, indent_levels + 1);
|
||||
builder.appendff("Negated: {}\n", m_negated);
|
||||
|
||||
dump_indent(builder, indent_levels + 1);
|
||||
builder.appendff("Type: {}\n", m_media_type.name);
|
||||
|
||||
if (m_media_condition) {
|
||||
dump_indent(builder, indent_levels + 1);
|
||||
builder.append("Condition:\n"sv);
|
||||
m_media_condition->dump(builder, indent_levels + 2);
|
||||
}
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/cssom-1/#serialize-a-media-query-list
|
||||
String serialize_a_media_query_list(Vector<NonnullRefPtr<MediaQuery>> const& media_queries)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue